added checkbox for Preferences to can disable the Quit MessageBox

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1508 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-08-10 01:40:17 +00:00
parent 792ddf1d25
commit 2380b0c793
4 changed files with 47 additions and 24 deletions

View File

@ -323,7 +323,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
menu->addAction(_appAct);
#endif
menu->addAction(_prefsAct);
//menu->addAction(_smplayerAct);
menu->addAction(_helpAct);
menu->addSeparator();
menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
@ -355,16 +354,16 @@ void MainWindow::displaySystrayMsg(const QString& title,const QString& msg)
void MainWindow::updateStatus()
{
if (ratesstatus)
ratesstatus->getRatesStatus();
if (ratesstatus)
ratesstatus->getRatesStatus();
if (peerstatus)
if (peerstatus)
peerstatus->getPeerStatus();
if (dhtstatus)
if (dhtstatus)
dhtstatus->getDHTStatus();
if (natstatus)
if (natstatus)
natstatus->getNATStatus();
std::list<std::string> ids;
@ -499,7 +498,6 @@ MainWindow::~MainWindow()
{
delete _bandwidthGraph;
delete _messengerwindowAct;
//delete _smplayerAct;
delete _preferencesWindow;
}
@ -524,9 +522,6 @@ void MainWindow::createActions()
_appAct = new QAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this);
connect(_appAct, SIGNAL(triggered()),this, SLOT(showApplWindow()));
//_smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this);
//connect(_smplayerAct, SIGNAL(triggered()),this, SLOT(showsmplayer()));
_helpAct = new QAction(QIcon(IMG_HELP), tr("Help"), this);
connect(_helpAct, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
@ -538,7 +533,10 @@ void MainWindow::createActions()
*/
void MainWindow::doQuit()
{
QString queryWrn;
if(!_settings->value(QString::fromUtf8("doQuit"), false).toBool())
{
QString queryWrn;
queryWrn.clear();
queryWrn.append(tr("Do you really want to exit RetroShare ?"));
@ -549,6 +547,10 @@ void MainWindow::doQuit()
}
else
return;
}
else
rsicontrol->rsGlobalShutDown();
qApp->quit();
}
void MainWindow::closeEvent(QCloseEvent *e)

View File

@ -55,6 +55,8 @@ bool
GeneralDialog::save(QString &errmsg)
{
_settings->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
_settings->setValue(QString::fromUtf8("doQuit"), quit());
_settings->setRunRetroshareOnBoot(
ui.chkRunRetroshareAtSystemStartup->isChecked());
@ -70,9 +72,16 @@ GeneralDialog::load()
_settings->runRetroshareOnBoot());
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), false).toBool());
}
bool GeneralDialog::quit() const {
if(ui.checkQuit->isChecked()) return true;
return ui.checkQuit->isChecked();
}
bool GeneralDialog::startMinimized() const {
if(ui.checkStartMinimized->isChecked()) return true;
return ui.checkStartMinimized->isChecked();

View File

@ -1,7 +1,7 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2006-2007, crypton
* This file is distributed under the following license:
*
* Copyright (c) 2006-2007, crypton
* Copyright (c) 2006, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
@ -47,6 +47,8 @@ public:
/** Loads the settings for this page */
void load();
bool startMinimized() const;
bool quit() const;
private slots:

View File

@ -499,13 +499,7 @@
<property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize">
@ -539,14 +533,30 @@
</widget>
</item>
<item row="1" column="0">
<spacer>
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Misc</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="checkQuit">
<property name="text">
<string>Do not show the Quit RetroShare MessageBox</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>401</width>
<height>91</height>
<width>178</width>
<height>95</height>
</size>
</property>
</spacer>