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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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