mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
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:
parent
0d5dfc9258
commit
b8bd6bfdca
@ -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)
|
||||||
|
@ -64,7 +64,8 @@ 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);
|
||||||
#endif
|
ui.chkRunRetroshareAtSystemStartupMinimized->setVisible(false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QuickStartWizard::~QuickStartWizard()
|
QuickStartWizard::~QuickStartWizard()
|
||||||
@ -180,10 +181,12 @@ 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();
|
||||||
|
|
||||||
close();
|
close();
|
||||||
@ -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();
|
||||||
|
@ -40,10 +40,6 @@ public:
|
|||||||
void loadNetwork();
|
void loadNetwork();
|
||||||
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);
|
||||||
|
@ -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>
|
||||||
|
@ -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->setCloseToTray(ui.checkClosetoTray->isChecked());
|
||||||
|
|
||||||
Settings->setValue(QString::fromUtf8("doQuit"), quit());
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
Settings->setValue(QString::fromUtf8("ClosetoTray"), closetoTray());
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
@ -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 */
|
||||||
|
@ -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>
|
||||||
|
@ -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 **/
|
||||||
|
@ -95,10 +95,13 @@ 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);
|
||||||
|
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user