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

View File

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

View File

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

View File

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

View File

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

View File

@ -41,20 +41,6 @@ public:
bool save(QString &errmsg);
/** Loads the settings for this page */
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:
/** Qt Designer generated object */

View File

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

View File

@ -45,7 +45,6 @@
#define SETTING_SHEETNAME "SheetName"
#define SETTING_DATA_DIRECTORY "DataDirectory"
#define SETTING_SHOW_MAINWINDOW_AT_START "ShowMainWindowAtStart"
#define SETTING_BWGRAPH_FILTER "StatisticDialog/BWLineFilter"
#define SETTING_BWGRAPH_OPACITY "StatisticDialog/Opacity"
#define SETTING_BWGRAPH_ALWAYS_ON_TOP "StatisticDialog/AlwaysOnTop"
@ -115,7 +114,6 @@ void RshareSettings::initSettings()
setDefault(SETTING_LANGUAGE, LanguageSupport::defaultLanguageCode());
setDefault(SETTING_SHEETNAME, true);
setDefault(SETTING_SHOW_MAINWINDOW_AT_START, true);
/* 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
* application starts. */
bool
RshareSettings::showMainWindowAtStart()
bool RshareSettings::getStartMinimized()
{
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. */
void
RshareSettings::setShowMainWindowAtStart(bool show)
void RshareSettings::setStartMinimized(bool startMinimized)
{
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 **/

View File

@ -95,9 +95,12 @@ public:
/** Returns true if RetroShare's main window should be visible when the
* application starts. */
bool showMainWindowAtStart();
bool getStartMinimized();
/** 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. */
bool runRetroshareOnBoot(bool &minimized);

View File

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