added changes from GeneralDialog to GeneralPage

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1546 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2009-08-17 21:19:50 +00:00
parent 13d099702c
commit b91d9ab4b8
4 changed files with 89 additions and 63 deletions

View file

@ -509,7 +509,14 @@
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QTextEdit" name="certtextEdit"/> <widget class="QTextEdit" name="certtextEdit">
<property name="font">
<font>
<pointsize>7</pointsize>
<kerning>false</kerning>
</font>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View file

@ -1,8 +1,7 @@
/**************************************************************** /****************************************************************
* This file is distributed under the following license: * This file is distributed under the following license:
* *
* Copyright (c) 2006-2007, crypton * Copyright (c) 2009 RetroShare Team
* Copyright (c) 2006, Matt Edman, Justin Hipple
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -20,43 +19,44 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#include "GeneralPage.h"
#include "rshare.h" #include "rshare.h"
#include "GeneralPage.h"
#include <util/stringutil.h> #include <util/stringutil.h>
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
/** Constructor */
GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags) GeneralPage::GeneralPage(QWidget * parent, Qt::WFlags flags)
: QWidget(parent, flags) : QWidget(parent, flags)
{ {
ui.setupUi(this); /* Invoke the Qt Designer generated object setup routine */
setAttribute(Qt::WA_QuitOnClose, false); ui.setupUi(this);
setWindowTitle(windowTitle() + QLatin1String(" - General"));
/* Create RshareSettings object */
/* Create RshareSettings object */ _settings = new RshareSettings();
_settings = new RshareSettings();
load();
/* Hide platform specific features */ /* Hide platform specific features */
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
ui.chkRunRetroshareAtSystemStartup->setVisible(false); ui.chkRunRetroshareAtSystemStartup->setVisible(false);
#endif ´ //ui.autologincheckBox->setEnabled(false) ;
//ui.autologincheckBox->setChecked(false) ;
#endif
} }
void /** Destructor */
GeneralPage::closeEvent (QCloseEvent * event) /*GeneralPage::~GeneralPage()
{ {
delete _settings;
QWidget::closeEvent(event); }*/
}
/** 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->setValue(QString::fromUtf8("StartMinimized"), startMinimized());
_settings->setValue(QString::fromUtf8("doQuit"), quit());
_settings->setRunRetroshareOnBoot( _settings->setRunRetroshareOnBoot(
ui.chkRunRetroshareAtSystemStartup->isChecked()); ui.chkRunRetroshareAtSystemStartup->isChecked());
@ -67,11 +67,19 @@ GeneralPage::save(QString &errmsg)
/** Loads the settings for this page */ /** Loads the settings for this page */
void void
GeneralPage::load() GeneralPage::load()
{ {
ui.chkRunRetroshareAtSystemStartup->setChecked( ui.chkRunRetroshareAtSystemStartup->setChecked(
_settings->runRetroshareOnBoot()); _settings->runRetroshareOnBoot());
ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool()); ui.checkStartMinimized->setChecked(_settings->value(QString::fromUtf8("StartMinimized"), false).toBool());
ui.checkQuit->setChecked(_settings->value(QString::fromUtf8("doQuit"), false).toBool());
}
bool GeneralPage::quit() const {
if(ui.checkQuit->isChecked()) return true;
return ui.checkQuit->isChecked();
} }
bool GeneralPage::startMinimized() const { bool GeneralPage::startMinimized() const {
@ -86,5 +94,3 @@ GeneralPage::toggleShowOnStartup(bool checked)
//RshareSettings _settings; //RshareSettings _settings;
_settings->setShowMainWindowAtStart(checked); _settings->setShowMainWindowAtStart(checked);
} }

View file

@ -20,47 +20,50 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
#ifndef GENERALPAGE_H #ifndef _GENERALPAGE_H
# define GENERALPAGE_H #define _GENERALPAGE_H
#include <QStyleFactory> #include <QtGui>
#include <QFileDialog>
#include <QLineEdit> #include <QLineEdit>
#include "gui/Preferences/rsharesettings.h" #include "gui/Preferences/rsharesettings.h"
#include "lang/languagesupport.h"
# include <QtGui/QWidget> #include "ui_GeneralPage.h"
# include "ui_GeneralPage.h"
class GeneralPage: public QWidget
class GeneralPage : public QWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
GeneralPage(QWidget * parent = 0, Qt::WFlags flags = 0); /** Default Constructor */
~GeneralPage() {} GeneralPage(QWidget * parent = 0, Qt::WFlags flags = 0);
/** Default Destructor */
/** Saves the changes on this page */ ~GeneralPage() {}
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
bool startMinimized() const;
private slots: /** Saves the changes on this page */
bool save(QString &errmsg);
/** Loads the settings for this page */
void load();
bool startMinimized() const;
bool quit() const;
/** Called when the "show on startup" checkbox is toggled. */
void toggleShowOnStartup(bool checked);
private: private slots:
/** A VidaliaSettings object used for saving/loading settings */
RshareSettings* _settings; /** Called when the "show on startup" checkbox is toggled. */
void toggleShowOnStartup(bool checked);
void closeEvent (QCloseEvent * event); private:
/** A RetroShare Settings object used for saving/loading settings */
Ui::GeneralPage ui; RshareSettings *_settings;
/** Qt Designer generated object */
Ui::GeneralPage ui;
}; };
#endif // !GENERALPAGE_H #endif

View file

@ -499,13 +499,7 @@
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<layout class="QGridLayout"> <layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="minimumSize"> <property name="minimumSize">
@ -539,14 +533,30 @@
</widget> </widget>
</item> </item>
<item row="1" column="0"> <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"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>401</width> <width>178</width>
<height>91</height> <height>95</height>
</size> </size>
</property> </property>
</spacer> </spacer>