Show the new setting for starting minimized on system start only for Windows.

Cleaned some methods for accessing the settings.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3912 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2010-12-13 20:34:07 +00:00
parent 0d5dfc9258
commit b8bd6bfdca
10 changed files with 54 additions and 93 deletions

View File

@ -1085,7 +1085,7 @@ void MainWindow::createActions()
*/ */
void MainWindow::doQuit() void MainWindow::doQuit()
{ {
if(!Settings->value(QString::fromUtf8("doQuit"), false).toBool()) if(!Settings->value("doQuit", false).toBool())
{ {
QString queryWrn; QString queryWrn;
queryWrn.clear(); queryWrn.clear();
@ -1111,7 +1111,7 @@ void MainWindow::closeEvent(QCloseEvent *e)
{ {
static bool firstTime = true; static bool firstTime = true;
if(!Settings->value(QString::fromUtf8("ClosetoTray"), false).toBool()) if(!Settings->getCloseToTray())
{ {
if (trayIcon->isVisible()) { if (trayIcon->isVisible()) {
if (firstTime) if (firstTime)

View File

@ -64,6 +64,7 @@ QuickStartWizard::QuickStartWizard(QWidget *parent) :
/* Hide platform specific features */ /* Hide platform specific features */
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
ui.checkBoxRunRetroshareAtSystemStartup->setVisible(false); ui.checkBoxRunRetroshareAtSystemStartup->setVisible(false);
ui.chkRunRetroshareAtSystemStartupMinimized->setVisible(false);
#endif #endif
} }
@ -180,9 +181,11 @@ void QuickStartWizard::on_pushButtonSystemBack_clicked()
void QuickStartWizard::on_pushButtonSystemFinish_clicked() void QuickStartWizard::on_pushButtonSystemFinish_clicked()
{ {
Settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); Settings->setStartMinimized(ui.checkBoxStartMinimized->isChecked());
Settings->setValue(QString::fromUtf8("doQuit"), quitbox()); Settings->setValue("doQuit", ui.checkBoxQuit->isChecked());
#ifdef Q_WS_WIN
Settings->setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked()); Settings->setRunRetroshareOnBoot(ui.checkBoxRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked());
#endif
saveChanges(); saveChanges();
@ -361,25 +364,18 @@ bool QuickStartWizard::messageBoxOk(QString msg)
void void
QuickStartWizard::loadGeneral() QuickStartWizard::loadGeneral()
{ {
#ifdef Q_WS_WIN
bool minimized; bool minimized;
ui.checkBoxRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized)); ui.checkBoxRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized));
ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized); ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized);
ui.checkBoxStartMinimized->setChecked(Settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); #endif
ui.checkBoxQuit->setChecked(Settings->value(QString::fromUtf8("doQuit"), false).toBool());
ui.checkBoxStartMinimized->setChecked(Settings->getStartMinimized());
ui.checkBoxQuit->setChecked(Settings->value("doQuit", false).toBool());
//ui.checkBoxQuickWizard->setChecked(settings.value(QString::fromUtf8("FirstRun"), false).toBool()); //ui.checkBoxQuickWizard->setChecked(settings.value(QString::fromUtf8("FirstRun"), false).toBool());
} }
bool QuickStartWizard::quitbox() const {
if(ui.checkBoxQuit->isChecked()) return true;
return ui.checkBoxQuit->isChecked();
}
bool QuickStartWizard::startMinimized() const {
if(ui.checkBoxStartMinimized->isChecked()) return true;
return ui.checkBoxStartMinimized->isChecked();
}
//bool QuickStartWizard::firstRunWizard() const { //bool QuickStartWizard::firstRunWizard() const {
// if(ui.checkBoxQuickWizard->isChecked()) return true; // if(ui.checkBoxQuickWizard->isChecked()) return true;
// return ui.checkBoxQuickWizard->isChecked(); // return ui.checkBoxQuickWizard->isChecked();

View File

@ -41,10 +41,6 @@ public:
void loadShare(); void loadShare();
void loadGeneral(); void loadGeneral();
bool startMinimized() const;
bool quitbox() const;
protected: protected:
virtual void changeEvent(QEvent *e); virtual void changeEvent(QEvent *e);
// virtual void showEvent(QShowEvent * event); // virtual void showEvent(QShowEvent * event);

View File

@ -896,7 +896,7 @@ p, li { white-space: pre-wrap; }
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>10</width> <width>15</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>

View File

@ -34,14 +34,11 @@ GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
/* Invoke the Qt Designer generated object setup routine */ /* Invoke the Qt Designer generated object setup routine */
ui.setupUi(this); ui.setupUi(this);
connect(ui.autoLogin, SIGNAL(clicked()), this, SLOT(setAutoLogin()));
/* Hide platform specific features */ /* Hide platform specific features */
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
ui.chkRunRetroshareAtSystemStartup->setVisible(false); ui.chkRunRetroshareAtSystemStartup->setVisible(false);
ui.chkRunRetroshareAtSystemStartupMinimized->setVisible(false);
#endif #endif
ui.autoLogin->setChecked(RsInit::getAutoLogin());
} }
/** Destructor */ /** Destructor */
@ -50,61 +47,38 @@ GeneralPage::~GeneralPage()
} }
/** Saves the changes on this page */ /** Saves the changes on this page */
bool bool GeneralPage::save(QString &errmsg)
GeneralPage::save(QString &errmsg)
{ {
Settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized()); Settings->setStartMinimized(ui.checkStartMinimized->isChecked());
Settings->setValue("doQuit", ui.checkQuit->isChecked());
Settings->setValue(QString::fromUtf8("doQuit"), quit()); Settings->setCloseToTray(ui.checkClosetoTray->isChecked());
Settings->setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
#ifdef Q_WS_WIN
Settings->setRunRetroshareOnBoot(ui.chkRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked()); Settings->setRunRetroshareOnBoot(ui.chkRunRetroshareAtSystemStartup->isChecked(), ui.chkRunRetroshareAtSystemStartupMinimized->isChecked());
#endif
Settings->setMaxTimeBeforeIdle(ui.spinBox->value()); Settings->setMaxTimeBeforeIdle(ui.spinBox->value());
RsInit::setAutoLogin(ui.autoLogin->isChecked());
return true; return true;
} }
/** Loads the settings for this page */ /** Loads the settings for this page */
void void GeneralPage::load()
GeneralPage::load()
{ {
#ifdef Q_WS_WIN
bool minimized; bool minimized;
ui.chkRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized)); ui.chkRunRetroshareAtSystemStartup->setChecked(Settings->runRetroshareOnBoot(minimized));
ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized); ui.chkRunRetroshareAtSystemStartupMinimized->setChecked(minimized);
#endif
ui.checkStartMinimized->setChecked(Settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); ui.checkStartMinimized->setChecked(Settings->getStartMinimized());
ui.checkQuit->setChecked(Settings->value("doQuit", false).toBool());
ui.checkQuit->setChecked(Settings->value(QString::fromUtf8("doQuit"), false).toBool()); ui.checkClosetoTray->setChecked(Settings->getCloseToTray());
ui.checkClosetoTray->setChecked(Settings->value(QString::fromUtf8("ClosetoTray"), false).toBool());
ui.spinBox->setValue(Settings->getMaxTimeBeforeIdle()); ui.spinBox->setValue(Settings->getMaxTimeBeforeIdle());
}
bool GeneralPage::quit() const { ui.autoLogin->setChecked(RsInit::getAutoLogin());
if(ui.checkQuit->isChecked()) return true;
return ui.checkQuit->isChecked();
}
bool GeneralPage::startMinimized() const {
if(ui.checkStartMinimized->isChecked()) return true;
return ui.checkStartMinimized->isChecked();
}
bool GeneralPage::closetoTray() const {
if(ui.checkClosetoTray->isChecked()) return true;
return ui.checkClosetoTray->isChecked();
}
/** Called when the "show on startup" checkbox is toggled. */
void
GeneralPage::toggleShowOnStartup(bool checked)
{
Settings->setShowMainWindowAtStart(checked);
}
void GeneralPage::setAutoLogin(){
RsInit::setAutoLogin(ui.autoLogin->isChecked());
} }

View File

@ -41,20 +41,6 @@ public:
bool save(QString &errmsg); bool save(QString &errmsg);
/** Loads the settings for this page */ /** Loads the settings for this page */
void load(); void load();
bool startMinimized() const;
bool closetoTray() const;
bool quit() const;
private slots:
/** Called when the "show on startup" checkbox is toggled. */
void toggleShowOnStartup(bool checked);
/**
*
*/
void setAutoLogin();
private: private:
/** Qt Designer generated object */ /** Qt Designer generated object */

View File

@ -541,7 +541,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>10</width> <width>15</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>

View File

@ -45,7 +45,6 @@
#define SETTING_SHEETNAME "SheetName" #define SETTING_SHEETNAME "SheetName"
#define SETTING_DATA_DIRECTORY "DataDirectory" #define SETTING_DATA_DIRECTORY "DataDirectory"
#define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart"
#define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter" #define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter"
#define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity" #define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity"
#define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop" #define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop"
@ -115,7 +114,6 @@ void RshareSettings::initSettings()
setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode()); setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
setDefault(SETTING_SHEETNAME, true); setDefault(SETTING_SHEETNAME, true);
setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
/* defaults here are not ideal.... but dusent matter */ /* defaults here are not ideal.... but dusent matter */
@ -252,17 +250,25 @@ void RshareSettings::setBWGraphAlwaysOnTop(bool alwaysOnTop)
/** Returns true if RetroShare's main window should be visible when the /** Returns true if RetroShare's main window should be visible when the
* application starts. */ * application starts. */
bool bool RshareSettings::getStartMinimized()
RshareSettings::showMainWindowAtStart()
{ {
return value(SETTING_SHOW_MAINWINDOW_AT_START).toBool(); return value("StartMinimized", false).toBool();
} }
/** Sets whether to show RetroShare's main window when the application starts. */ /** Sets whether to show RetroShare's main window when the application starts. */
void void RshareSettings::setStartMinimized(bool startMinimized)
RshareSettings::setShowMainWindowAtStart(bool show)
{ {
setValue(SETTING_SHOW_MAINWINDOW_AT_START, show); setValue("StartMinimized", startMinimized);
}
bool RshareSettings::getCloseToTray()
{
return value("ClosetoTray", false).toBool();
}
void RshareSettings::setCloseToTray(bool closeToTray)
{
setValue("ClosetoTray", closeToTray);
} }
/** Setting for Notify / Chat and NewsFeeds **/ /** Setting for Notify / Chat and NewsFeeds **/

View File

@ -95,9 +95,12 @@ public:
/** Returns true if RetroShare's main window should be visible when the /** Returns true if RetroShare's main window should be visible when the
* application starts. */ * application starts. */
bool showMainWindowAtStart(); bool getStartMinimized();
/** Sets whether to show main window when the application starts. */ /** Sets whether to show main window when the application starts. */
void setShowMainWindowAtStart(bool show); void setStartMinimized(bool startMinimized);
bool getCloseToTray();
void setCloseToTray(bool closeToTray);
/** Returns true if RetroShare should start on system boot. */ /** Returns true if RetroShare should start on system boot. */
bool runRetroshareOnBoot(bool &minimized); bool runRetroshareOnBoot(bool &minimized);

View File

@ -263,7 +263,7 @@ int main(int argc, char *argv[])
w->installGroupChatNotifier(); w->installGroupChatNotifier();
/* only show window, if not startMinimized */ /* only show window, if not startMinimized */
if (RsInit::setStartMinimised() || Settings->value("StartMinimized", false).toBool()) if (RsInit::setStartMinimised() || Settings->getStartMinimized())
{ {
splashScreen.close(); splashScreen.close();
} else { } else {