fix for the issue: the settings file is not stored on Windows if the software is running and the operating system is shut down

This commit is contained in:
Volker Fischer 2011-05-21 17:06:30 +00:00
parent aa0fd533e6
commit 41804bf223
5 changed files with 990 additions and 973 deletions

View file

@ -27,12 +27,14 @@
/* Implementation *************************************************************/
CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
CSettings* pNSetP,
const bool bNewConnectOnStartup,
const bool bNewDisalbeLEDs,
QWidget* parent,
Qt::WindowFlags f ) :
QDialog ( parent, f ),
pClient ( pNCliP ),
pSettings ( pNSetP ),
bUnreadChatMessage ( false ),
ClientSettingsDlg ( pNCliP, parent, Qt::Window ),
ChatDlg ( parent, Qt::Window ),
@ -376,6 +378,9 @@ CLlconClientDlg::CLlconClientDlg ( CClient* pNCliP,
SIGNAL ( CLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ),
this, SLOT ( OnCLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ) );
QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ),
this, SLOT ( OnAboutToQuit() ) );
QObject::connect ( &ClientSettingsDlg, SIGNAL ( GUIDesignChanged() ),
this, SLOT ( OnGUIDesignChanged() ) );

View file

@ -35,6 +35,7 @@
#include <qlayout.h>
#include "global.h"
#include "client.h"
#include "settings.h"
#include "multicolorled.h"
#include "audiomixerboard.h"
#include "clientsettingsdlg.h"
@ -75,6 +76,7 @@ class CLlconClientDlg : public QDialog, private Ui_CLlconClientDlgBase
public:
CLlconClientDlg ( CClient* pNCliP,
CSettings* pNSetP,
const bool bNewConnectOnStartup,
const bool bNewDisalbeLEDs,
QWidget* parent = 0,
@ -89,6 +91,8 @@ protected:
void ConnectDisconnect ( const bool bDoStart );
CClient* pClient;
CSettings* pSettings;
bool bConnected;
bool bUnreadChatMessage;
QTimer TimerSigMet;
@ -107,6 +111,8 @@ protected:
CConnectDlg ConnectDlg;
public slots:
void OnAboutToQuit() { pSettings->Save(); }
void OnConnectDisconBut();
void OnTimerSigMet();

View file

@ -27,11 +27,13 @@
/* Implementation *************************************************************/
CLlconServerDlg::CLlconServerDlg ( CServer* pNServP,
CSettings* pNSetP,
const bool bStartMinimized,
QWidget* parent,
Qt::WindowFlags f )
: QDialog ( parent, f ),
pServer ( pNServP ),
pSettings ( pNSetP ),
BitmapSystemTrayInactive ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreyArrow.png" ) ),
BitmapSystemTrayActive ( QString::fromUtf8 ( ":/png/LEDs/res/CLEDGreenArrow.png" ) )
{
@ -303,6 +305,9 @@ lvwClients->setMinimumHeight ( 140 );
QObject::connect ( pServer, SIGNAL ( Stopped() ),
this, SLOT ( OnServerStopped() ) );
QObject::connect ( QCoreApplication::instance(), SIGNAL ( aboutToQuit() ),
this, SLOT ( OnAboutToQuit() ) );
QObject::connect ( &SystemTrayIcon,
SIGNAL ( activated ( QSystemTrayIcon::ActivationReason ) ),
this, SLOT ( OnSysTrayActivated ( QSystemTrayIcon::ActivationReason ) ) );

View file

@ -34,6 +34,7 @@
#include <qsettings.h>
#include "global.h"
#include "server.h"
#include "settings.h"
#include "multicolorled.h"
#ifdef _WIN32
# include "../windows/moc/llconserverdlgbase.h"
@ -58,6 +59,7 @@ class CLlconServerDlg : public QDialog, private Ui_CLlconServerDlgBase
public:
CLlconServerDlg ( CServer* pNServP,
CSettings* pNSetP,
const bool bStartMinimized,
QWidget* parent = 0,
Qt::WindowFlags f = 0 );
@ -74,6 +76,7 @@ protected:
QTimer Timer;
CServer* pServer;
CSettings* pSettings;
CVector<CServerListViewItem*> vecpListViewItems;
QMutex ListViewMutex;
@ -87,6 +90,8 @@ protected:
QMenu* pSystemTrayIconMenu;
public slots:
void OnAboutToQuit() { pSettings->Save(); }
void OnRegisterServerStateChanged ( int value );
void OnDefaultCentralServerStateChanged ( int value );
void OnStartOnOSStartStateChanged ( int value );

View file

@ -350,6 +350,7 @@ int main ( int argc, char** argv )
// GUI object
CLlconClientDlg ClientDlg (
&Client,
&Settings,
bConnectOnStartup,
bDisalbeLEDs,
0,
@ -362,9 +363,6 @@ int main ( int argc, char** argv )
// show dialog
ClientDlg.show();
app.exec();
// save settings to init-file
Settings.Save();
}
else
{
@ -397,6 +395,7 @@ int main ( int argc, char** argv )
// GUI object for the server
CLlconServerDlg ServerDlg (
&Server,
&Settings,
bStartMinimized,
0,
Qt::Window );
@ -408,9 +407,6 @@ int main ( int argc, char** argv )
// show dialog
ServerDlg.show();
app.exec();
// save settings to init-file
Settings.Save();
}
else
{