mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Reworked settings dialog.
The settings page loads the data with the first show. The dialog now starts faster. Cleaned DirectoriesPage, removed the directory list and save the data with the OK button. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4265 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
25b888d31f
commit
2a82826fba
@ -280,6 +280,7 @@ HEADERS += rshare.h \
|
|||||||
gui/settings/RsharePeerSettings.h \
|
gui/settings/RsharePeerSettings.h \
|
||||||
gui/settings/rsettings.h \
|
gui/settings/rsettings.h \
|
||||||
gui/settings/rsettingswin.h \
|
gui/settings/rsettingswin.h \
|
||||||
|
gui/settings/configpage.h \
|
||||||
gui/settings/GeneralPage.h \
|
gui/settings/GeneralPage.h \
|
||||||
gui/settings/DirectoriesPage.h \
|
gui/settings/DirectoriesPage.h \
|
||||||
gui/settings/ServerPage.h \
|
gui/settings/ServerPage.h \
|
||||||
@ -528,6 +529,7 @@ SOURCES += main.cpp \
|
|||||||
gui/common/RSTreeView.cpp \
|
gui/common/RSTreeView.cpp \
|
||||||
gui/style/RSStyle.cpp \
|
gui/style/RSStyle.cpp \
|
||||||
gui/style/StyleDialog.cpp \
|
gui/style/StyleDialog.cpp \
|
||||||
|
gui/settings/configpage.cpp \
|
||||||
gui/settings/rsharesettings.cpp \
|
gui/settings/rsharesettings.cpp \
|
||||||
gui/settings/RsharePeerSettings.cpp \
|
gui/settings/RsharePeerSettings.cpp \
|
||||||
gui/settings/rsettings.cpp \
|
gui/settings/rsettings.cpp \
|
||||||
|
@ -91,12 +91,6 @@ ChatPage::ChatPage(QWidget * parent, Qt::WFlags flags)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ChatPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
ChatPage::save(QString &errmsg)
|
ChatPage::save(QString &errmsg)
|
||||||
|
@ -50,7 +50,6 @@ class ChatPage : public ConfigPage
|
|||||||
void on_historyList_currentRowChanged(int currentRow);
|
void on_historyList_currentRowChanged(int currentRow);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
void setPreviewMessages(QString &stylePath, QString styleVariant, QTextBrowser *textBrowser);
|
||||||
void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
void fillPreview(QListWidget *listWidget, QComboBox *comboBox, QTextBrowser *textBrowser);
|
||||||
|
|
||||||
|
@ -40,10 +40,6 @@ CryptoPage::CryptoPage(QWidget * parent, Qt::WFlags flags)
|
|||||||
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
|
connect(ui.copykeyButton, SIGNAL(clicked()), this, SLOT(copyPublicKey()));
|
||||||
connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
|
connect(ui.saveButton, SIGNAL(clicked()), this, SLOT(fileSaveAs()));
|
||||||
|
|
||||||
|
|
||||||
loadPublicKey();
|
|
||||||
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
|
||||||
@ -54,13 +50,6 @@ CryptoPage::~CryptoPage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
CryptoPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
CryptoPage::save(QString &errmsg)
|
CryptoPage::save(QString &errmsg)
|
||||||
@ -72,13 +61,7 @@ CryptoPage::save(QString &errmsg)
|
|||||||
void
|
void
|
||||||
CryptoPage::load()
|
CryptoPage::load()
|
||||||
{
|
{
|
||||||
|
/* Loads ouer default Puplickey */
|
||||||
}
|
|
||||||
|
|
||||||
/** Loads ouer default Puplickey */
|
|
||||||
void
|
|
||||||
CryptoPage::loadPublicKey()
|
|
||||||
{
|
|
||||||
QFont font("Courier New",9,50,false) ;
|
QFont font("Courier New",9,50,false) ;
|
||||||
ui.certtextEdit->setFont(font) ;
|
ui.certtextEdit->setFont(font) ;
|
||||||
|
|
||||||
@ -96,7 +79,6 @@ CryptoPage::copyPublicKey()
|
|||||||
" friend via email or some other way"));
|
" friend via email or some other way"));
|
||||||
QClipboard *clipboard = QApplication::clipboard();
|
QClipboard *clipboard = QApplication::clipboard();
|
||||||
clipboard->setText(ui.certtextEdit->toPlainText());
|
clipboard->setText(ui.certtextEdit->toPlainText());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CryptoPage::fileSave()
|
bool CryptoPage::fileSave()
|
||||||
|
@ -35,30 +35,22 @@ class CryptoPage : public ConfigPage
|
|||||||
/** Default Destructor */
|
/** Default Destructor */
|
||||||
~CryptoPage();
|
~CryptoPage();
|
||||||
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool save(QString &errmsg);
|
bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void loadPublicKey();
|
|
||||||
|
|
||||||
void copyPublicKey();
|
void copyPublicKey();
|
||||||
|
|
||||||
bool fileSave();
|
bool fileSave();
|
||||||
bool fileSaveAs();
|
bool fileSaveAs();
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
void setCurrentFileName(const QString &fileName);
|
void setCurrentFileName(const QString &fileName);
|
||||||
|
|
||||||
QString fileName;
|
QString fileName;
|
||||||
|
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::CryptoPage ui;
|
Ui::CryptoPage ui;
|
||||||
};
|
};
|
||||||
|
@ -32,30 +32,14 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
|||||||
: ConfigPage(parent, flags)
|
: ConfigPage(parent, flags)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
|
|
||||||
ui.checkBox->setChecked(rsFiles->getShareDownloadDirectory()); /* signal not emitted */
|
|
||||||
|
|
||||||
uint32_t t = rsFiles->rememberHashFilesDuration() ;
|
|
||||||
bool b = rsFiles->rememberHashFiles() ;
|
|
||||||
|
|
||||||
ui.rememberHashesSB->setValue(t) ;
|
|
||||||
ui.rememberHashesCB->setChecked(b) ;
|
|
||||||
|
|
||||||
int u = rsFiles->watchPeriod() ;
|
|
||||||
ui.autoCheckDirectoriesDelay_SB->setValue(abs(u)) ;
|
|
||||||
ui.autoCheckDirectories_CB->setChecked(u>0) ;
|
|
||||||
ui.autoCheckDirectoriesDelay_SB->setEnabled(u>0) ;
|
|
||||||
|
|
||||||
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
|
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
|
||||||
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
||||||
connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int)));
|
connect(ui.editShareButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
||||||
connect(ui.editButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
|
||||||
connect(ui.cleanHashCachePB, SIGNAL(clicked()), this, SLOT(clearHashCache()));
|
connect(ui.cleanHashCachePB, SIGNAL(clicked()), this, SLOT(clearHashCache()));
|
||||||
connect(ui.rememberHashesCB, SIGNAL(toggled(bool)), this, SLOT(toggleRememberHashes(bool)));
|
connect(ui.rememberHashesCB, SIGNAL(clicked(bool)), this, SLOT(clickedRememberHashes(bool)));
|
||||||
connect(ui.rememberHashesSB, SIGNAL(valueChanged(int)), this, SLOT(setRememberHashesDuration(int)));
|
connect(ui.rememberHashesCB, SIGNAL(clicked(bool)), this, SLOT(toggleRememberHashes()));
|
||||||
connect(ui.autoCheckDirectoriesDelay_SB, SIGNAL(valueChanged(int)), this, SLOT(setAutoCheckDirectoriesDelay(int)));
|
connect(ui.autoCheckDirectories_CB, SIGNAL(clicked(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
|
||||||
connect(ui.autoCheckDirectories_CB, SIGNAL(toggled(bool)), this, SLOT(toggleAutoCheckDirectories(bool)));
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
@ -63,62 +47,15 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::setAutoCheckDirectoriesDelay(int b)
|
|
||||||
{
|
|
||||||
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value()) ;
|
|
||||||
}
|
|
||||||
void DirectoriesPage::toggleAutoCheckDirectories(bool b)
|
|
||||||
{
|
|
||||||
if(!b)
|
|
||||||
{
|
|
||||||
rsFiles->setWatchPeriod(-ui.autoCheckDirectoriesDelay_SB->value()) ;
|
|
||||||
ui.autoCheckDirectoriesDelay_SB->setEnabled(false) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value()) ;
|
|
||||||
ui.autoCheckDirectoriesDelay_SB->setEnabled(true) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DirectoriesPage::setRememberHashesDuration(int d)
|
|
||||||
{
|
|
||||||
rsFiles->setRememberHashFilesDuration(d) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DirectoriesPage::toggleRememberHashes(bool b)
|
|
||||||
{
|
|
||||||
if(!b)
|
|
||||||
{
|
|
||||||
if(QMessageBox::question(NULL,"Cache cleaning confirmation","The will forget any former hash of non shared files. Do you confirm ?") == QMessageBox::Ok)
|
|
||||||
{
|
|
||||||
rsFiles->clearHashCache() ;
|
|
||||||
rsFiles->setRememberHashFiles(b) ;
|
|
||||||
ui.rememberHashesSB->setEnabled(false) ;
|
|
||||||
ui.cleanHashCachePB->setEnabled(false) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ui.rememberHashesCB->setChecked(true) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rsFiles->setRememberHashFiles(true) ;
|
|
||||||
ui.rememberHashesSB->setEnabled(true) ;
|
|
||||||
ui.cleanHashCachePB->setEnabled(true) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DirectoriesPage::clearHashCache()
|
void DirectoriesPage::clearHashCache()
|
||||||
{
|
{
|
||||||
if(QMessageBox::question(NULL,"Cache cleaning confirmation","The will forget any former hash of non shared files. Do you confirm ?", QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok)
|
if(QMessageBox::question(this,"Cache cleaning confirmation","The will forget any former hash of non shared files. Do you confirm ?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::Yes)
|
||||||
rsFiles->clearHashCache() ;
|
rsFiles->clearHashCache() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void DirectoriesPage::toggleAutoCheckDirectories(bool b)
|
||||||
DirectoriesPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
{
|
||||||
QWidget::closeEvent(event);
|
ui.autoCheckDirectoriesDelay_SB->setEnabled(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::editDirectories()
|
void DirectoriesPage::editDirectories()
|
||||||
@ -126,13 +63,54 @@ void DirectoriesPage::editDirectories()
|
|||||||
ShareManager::showYourself() ;
|
ShareManager::showYourself() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DirectoriesPage::clickedRememberHashes(bool b)
|
||||||
|
{
|
||||||
|
if (!b) {
|
||||||
|
if (QMessageBox::question(this,"Cache cleaning confirmation","The will forget any former hash of non shared files. Do you confirm ?", QMessageBox::Yes | QMessageBox::No, QMessageBox::No) == QMessageBox::No) {
|
||||||
|
ui.rememberHashesCB->setChecked(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DirectoriesPage::toggleRememberHashes()
|
||||||
|
{
|
||||||
|
bool b = ui.rememberHashesCB->isChecked();
|
||||||
|
ui.rememberHashesSB->setEnabled(b);
|
||||||
|
ui.cleanHashCachePB->setEnabled(b);
|
||||||
|
}
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool DirectoriesPage::save(QString &errmsg)
|
bool DirectoriesPage::save(QString &errmsg)
|
||||||
{
|
{
|
||||||
/* this is usefull especially when shared incoming files is
|
rsFiles->setRememberHashFilesDuration(ui.rememberHashesSB->value());
|
||||||
* default option and when the user don't check/uncheck the
|
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value());
|
||||||
* checkBox, so no signal is emitted to update the shared list */
|
|
||||||
rsFiles->shareDownloadDirectory(ui.checkBox->isChecked());
|
std::string dir = ui.incomingDir->text().toUtf8().constData();
|
||||||
|
if (!dir.empty())
|
||||||
|
{
|
||||||
|
rsFiles->setDownloadDirectory(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
dir = ui.partialsDir->text().toUtf8().constData();
|
||||||
|
if (!dir.empty())
|
||||||
|
{
|
||||||
|
rsFiles->setPartialsDirectory(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui.rememberHashesCB->isChecked()) {
|
||||||
|
rsFiles->setRememberHashFiles(true);
|
||||||
|
} else {
|
||||||
|
rsFiles->setRememberHashFiles(false);
|
||||||
|
rsFiles->clearHashCache() ;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ui.autoCheckDirectories_CB->isChecked()) {
|
||||||
|
rsFiles->setWatchPeriod(ui.autoCheckDirectoriesDelay_SB->value());
|
||||||
|
} else {
|
||||||
|
rsFiles->setWatchPeriod(-ui.autoCheckDirectoriesDelay_SB->value());
|
||||||
|
}
|
||||||
|
|
||||||
|
rsFiles->shareDownloadDirectory(ui.shareDownloadDirectoryCB->isChecked());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -140,64 +118,37 @@ bool DirectoriesPage::save(QString &errmsg)
|
|||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void DirectoriesPage::load()
|
void DirectoriesPage::load()
|
||||||
{
|
{
|
||||||
std::list<SharedDirInfo>::const_iterator it;
|
ui.shareDownloadDirectoryCB->setChecked(rsFiles->getShareDownloadDirectory());
|
||||||
std::list<SharedDirInfo> dirs;
|
|
||||||
rsFiles->getSharedDirectories(dirs);
|
|
||||||
|
|
||||||
/* get a link to the table */
|
ui.rememberHashesSB->setValue(rsFiles->rememberHashFilesDuration());
|
||||||
QListWidget *listWidget = ui.dirList;
|
ui.rememberHashesCB->setChecked(rsFiles->rememberHashFiles());
|
||||||
|
toggleRememberHashes();
|
||||||
|
|
||||||
/* save current index */
|
int u = rsFiles->watchPeriod() ;
|
||||||
QModelIndex rootIndex = listWidget->rootIndex();
|
ui.autoCheckDirectoriesDelay_SB->setValue(abs(u)) ;
|
||||||
|
ui.autoCheckDirectories_CB->setChecked(u>0) ;
|
||||||
/* remove old items ??? */
|
ui.autoCheckDirectoriesDelay_SB->setEnabled(u>0) ;
|
||||||
listWidget->clear();
|
|
||||||
|
|
||||||
for(it = dirs.begin(); it != dirs.end(); it++)
|
|
||||||
{
|
|
||||||
/* (0) Dir Name */
|
|
||||||
listWidget->addItem(QString::fromUtf8((*it).filename.c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set saved index */
|
|
||||||
listWidget->setCurrentIndex(rootIndex);
|
|
||||||
|
|
||||||
ui.incomingDir->setText(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()));
|
ui.incomingDir->setText(QString::fromUtf8(rsFiles->getDownloadDirectory().c_str()));
|
||||||
ui.partialsDir->setText(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()));
|
ui.partialsDir->setText(QString::fromUtf8(rsFiles->getPartialsDirectory().c_str()));
|
||||||
|
|
||||||
listWidget->update(); /* update display */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::setIncomingDirectory()
|
void DirectoriesPage::setIncomingDirectory()
|
||||||
{
|
{
|
||||||
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Incoming Directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Incoming Directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
if (qdir.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string dir = qdir.toUtf8().constData();
|
ui.incomingDir->setText(qdir);
|
||||||
if (dir != "")
|
|
||||||
{
|
|
||||||
rsFiles->setDownloadDirectory(dir);
|
|
||||||
if (ui.checkBox->isChecked())
|
|
||||||
{
|
|
||||||
rsFiles->shareDownloadDirectory(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::setPartialsDirectory()
|
void DirectoriesPage::setPartialsDirectory()
|
||||||
{
|
{
|
||||||
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Partials Directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
QString qdir = QFileDialog::getExistingDirectory(this, tr("Set Partials Directory"), "", QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
|
||||||
|
if (qdir.isEmpty()) {
|
||||||
std::string dir = qdir.toUtf8().constData();
|
return;
|
||||||
if (dir != "")
|
|
||||||
{
|
|
||||||
rsFiles->setPartialsDirectory(dir);
|
|
||||||
}
|
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DirectoriesPage::shareDownloadDirectory(int state)
|
ui.partialsDir->setText(qdir);
|
||||||
{
|
|
||||||
rsFiles->shareDownloadDirectory(state == Qt::Checked);
|
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
@ -31,31 +31,22 @@ class DirectoriesPage: public ConfigPage
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DirectoriesPage(QWidget * parent = 0, Qt::WFlags flags = 0);
|
DirectoriesPage(QWidget * parent = 0, Qt::WFlags flags = 0);
|
||||||
// ~DirectoriesPage() {}
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool save(QString &errmsg);
|
bool save(QString &errmsg);
|
||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void editDirectories() ;
|
void editDirectories() ;
|
||||||
void setIncomingDirectory();
|
void setIncomingDirectory();
|
||||||
void setPartialsDirectory();
|
void setPartialsDirectory();
|
||||||
void shareDownloadDirectory(int state);
|
|
||||||
void clearHashCache();
|
void clearHashCache();
|
||||||
void setRememberHashesDuration(int) ;
|
void clickedRememberHashes(bool);
|
||||||
void toggleRememberHashes(bool) ;
|
void toggleRememberHashes();
|
||||||
void setAutoCheckDirectoriesDelay(int) ;
|
|
||||||
void toggleAutoCheckDirectories(bool);
|
void toggleAutoCheckDirectories(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
Ui::DirectoriesPage ui;
|
Ui::DirectoriesPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -611,13 +611,10 @@
|
|||||||
<string>Shared Directories</string>
|
<string>Shared Directories</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
|
||||||
<widget class="QListWidget" name="dirList"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QCheckBox" name="checkBox">
|
<widget class="QCheckBox" name="shareDownloadDirectoryCB">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
@ -630,7 +627,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="editButton">
|
<widget class="QPushButton" name="editShareButton">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edit Share</string>
|
<string>Edit Share</string>
|
||||||
</property>
|
</property>
|
||||||
@ -717,12 +714,24 @@ you plug it in.</string>
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>incomingDir</tabstop>
|
<tabstop>incomingDir</tabstop>
|
||||||
<tabstop>incomingButton</tabstop>
|
<tabstop>incomingButton</tabstop>
|
||||||
<tabstop>dirList</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../images.qrc"/>
|
<include location="../images.qrc"/>
|
||||||
|
@ -37,12 +37,6 @@ ForumPage::~ForumPage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ForumPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
ForumPage::save(QString &errmsg)
|
ForumPage::save(QString &errmsg)
|
||||||
|
@ -22,13 +22,9 @@
|
|||||||
#ifndef FORUMPAGE_H
|
#ifndef FORUMPAGE_H
|
||||||
#define FORUMPAGE_H
|
#define FORUMPAGE_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "ui_ForumPage.h"
|
#include "ui_ForumPage.h"
|
||||||
|
|
||||||
#include "NewTag.h"
|
|
||||||
|
|
||||||
class ForumPage : public ConfigPage
|
class ForumPage : public ConfigPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -43,8 +39,6 @@ public:
|
|||||||
void load();
|
void load();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
Ui::ForumPage ui;
|
Ui::ForumPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "ui_GeneralPage.h"
|
#include "ui_GeneralPage.h"
|
||||||
|
|
||||||
|
|
||||||
class GeneralPage : public ConfigPage
|
class GeneralPage : public ConfigPage
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -34,7 +34,6 @@ MessagePage::MessagePage(QWidget * parent, Qt::WFlags flags)
|
|||||||
: ConfigPage(parent, flags)
|
: ConfigPage(parent, flags)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
|
|
||||||
m_pTags = new MsgTagType;
|
m_pTags = new MsgTagType;
|
||||||
|
|
||||||
@ -57,12 +56,6 @@ MessagePage::~MessagePage()
|
|||||||
delete(m_pTags);
|
delete(m_pTags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
MessagePage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
MessagePage::save(QString &errmsg)
|
MessagePage::save(QString &errmsg)
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#ifndef MESSAGEPAGE_H
|
#ifndef MESSAGEPAGE_H
|
||||||
#define MESSAGEPAGE_H
|
#define MESSAGEPAGE_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
@ -53,7 +51,6 @@ private slots:
|
|||||||
void currentRowChangedTag(int row);
|
void currentRowChangedTag(int row);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
void fillTags();
|
void fillTags();
|
||||||
|
|
||||||
/* Pointer for not include of rsmsgs.h */
|
/* Pointer for not include of rsmsgs.h */
|
||||||
|
@ -30,13 +30,6 @@ NetworkPage::NetworkPage(QWidget * parent, Qt::WFlags flags)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
NetworkPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
NetworkPage::save(QString &errmsg)
|
NetworkPage::save(QString &errmsg)
|
||||||
@ -48,6 +41,5 @@ NetworkPage::save(QString &errmsg)
|
|||||||
void
|
void
|
||||||
NetworkPage::load()
|
NetworkPage::load()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#ifndef NETWORKPAGE_H
|
#ifndef NETWORKPAGE_H
|
||||||
#define NETWORKPAGE_H
|
#define NETWORKPAGE_H
|
||||||
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "ui_NetworkPage.h"
|
#include "ui_NetworkPage.h"
|
||||||
|
|
||||||
@ -39,9 +37,6 @@ class NetworkPage : public ConfigPage
|
|||||||
void load();
|
void load();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
Ui::NetworkPage ui;
|
Ui::NetworkPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,11 +64,6 @@ NewTag::NewTag(MsgTagType &Tags, uint32_t nId /*= 0*/, QWidget *parent, Qt::WFla
|
|||||||
showColor (m_Color);
|
showColor (m_Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NewTag::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QDialog::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
void NewTag::OnOK()
|
void NewTag::OnOK()
|
||||||
{
|
{
|
||||||
if (m_nId == 0) {
|
if (m_nId == 0) {
|
||||||
|
@ -40,9 +40,6 @@ public:
|
|||||||
|
|
||||||
uint32_t m_nId;
|
uint32_t m_nId;
|
||||||
|
|
||||||
protected:
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void OnOK();
|
void OnOK();
|
||||||
void OnCancel();
|
void OnCancel();
|
||||||
|
@ -35,8 +35,6 @@ NotifyPage::NotifyPage(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);
|
||||||
setAttribute(Qt::WA_QuitOnClose, false);
|
|
||||||
setWindowTitle(windowTitle() + QLatin1String(" - Notify"));
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
@ -48,12 +46,6 @@ NotifyPage::~NotifyPage()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
NotifyPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
NotifyPage::save(QString &errmsg)
|
NotifyPage::save(QString &errmsg)
|
||||||
@ -189,8 +181,3 @@ void NotifyPage::load()
|
|||||||
ui.spinBoxToasterXMargin->setValue(margin.x());
|
ui.spinBoxToasterXMargin->setValue(margin.x());
|
||||||
ui.spinBoxToasterYMargin->setValue(margin.y());
|
ui.spinBoxToasterYMargin->setValue(margin.y());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loads the settings for this page */
|
|
||||||
void NotifyPage::updateStatus()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
@ -22,9 +22,6 @@
|
|||||||
#ifndef NOTIFYPAGE_H
|
#ifndef NOTIFYPAGE_H
|
||||||
#define NOTIFYPAGE_H
|
#define NOTIFYPAGE_H
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "ui_NotifyPage.h"
|
#include "ui_NotifyPage.h"
|
||||||
|
|
||||||
@ -43,15 +40,7 @@ class NotifyPage : public ConfigPage
|
|||||||
/** Loads the settings for this page */
|
/** Loads the settings for this page */
|
||||||
void load();
|
void load();
|
||||||
|
|
||||||
public slots:
|
|
||||||
void updateStatus();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::NotifyPage ui;
|
Ui::NotifyPage ui;
|
||||||
};
|
};
|
||||||
|
@ -86,13 +86,6 @@ void ServerPage::toggleTunnelConnection(bool b)
|
|||||||
rsPeers->allowTunnelConnection(b) ;
|
rsPeers->allowTunnelConnection(b) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
ServerPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/** Saves the changes on this page */
|
/** Saves the changes on this page */
|
||||||
bool
|
bool
|
||||||
ServerPage::save(QString &errmsg)
|
ServerPage::save(QString &errmsg)
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
#ifndef SERVERPAGE_H
|
#ifndef SERVERPAGE_H
|
||||||
#define SERVERPAGE_H
|
#define SERVERPAGE_H
|
||||||
|
|
||||||
# include <QtGui/QWidget>
|
|
||||||
|
|
||||||
#include "configpage.h"
|
#include "configpage.h"
|
||||||
#include "ui_ServerPage.h"
|
#include "ui_ServerPage.h"
|
||||||
|
|
||||||
@ -49,11 +47,7 @@ private slots:
|
|||||||
void toggleIpDetermination(bool) ;
|
void toggleIpDetermination(bool) ;
|
||||||
void toggleTunnelConnection(bool) ;
|
void toggleTunnelConnection(bool) ;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
Ui::ServerPage ui;
|
Ui::ServerPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -80,10 +80,3 @@ void TransferPage::updateQueueSize(int s)
|
|||||||
{
|
{
|
||||||
rsFiles->setQueueSize(s) ;
|
rsFiles->setQueueSize(s) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferPage::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,8 +47,6 @@ class TransferPage: public ConfigPage
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
|
|
||||||
Ui::TransferPage ui;
|
Ui::TransferPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
44
retroshare-gui/src/gui/settings/configpage.cpp
Normal file
44
retroshare-gui/src/gui/settings/configpage.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2006 - 2010 RetroShare Team
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
|
* Boston, MA 02110-1301, USA.
|
||||||
|
****************************************************************/
|
||||||
|
|
||||||
|
#include "configpage.h"
|
||||||
|
|
||||||
|
ConfigPage::ConfigPage(QWidget *parent, Qt::WFlags flags) : QWidget(parent, flags)
|
||||||
|
{
|
||||||
|
loaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigPage::showEvent(QShowEvent *event)
|
||||||
|
{
|
||||||
|
if (loaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
loaded = true;
|
||||||
|
|
||||||
|
/* Load the settings */
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ConfigPage::wasLoaded()
|
||||||
|
{
|
||||||
|
return loaded;
|
||||||
|
}
|
@ -30,13 +30,20 @@ class ConfigPage : public QWidget
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
ConfigPage(QWidget *parent = 0, Qt::WFlags flags = 0) : QWidget(parent, flags) {}
|
ConfigPage(QWidget *parent = 0, Qt::WFlags flags = 0);
|
||||||
|
|
||||||
/** Pure virtual method. Subclassed pages load their config settings here. */
|
/** Pure virtual method. Subclassed pages load their config settings here. */
|
||||||
virtual void load() = 0;
|
virtual void load() = 0;
|
||||||
/** Pure virtual method. Subclassed pages save their config settings here
|
/** Pure virtual method. Subclassed pages save their config settings here
|
||||||
* and return true if everything was saved successfully. */
|
* and return true if everything was saved successfully. */
|
||||||
virtual bool save(QString &errmsg) = 0;
|
virtual bool save(QString &errmsg) = 0;
|
||||||
|
|
||||||
|
bool wasLoaded();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void showEvent(QShowEvent * event);
|
||||||
|
|
||||||
|
bool loaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,12 +62,6 @@ RSettingsWin::~RSettingsWin()
|
|||||||
_instance = NULL;
|
_instance = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RSettingsWin::closeEvent (QCloseEvent * event)
|
|
||||||
{
|
|
||||||
QWidget::closeEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void RSettingsWin::showYourself(QWidget *parent, PageType page /*= LastPage*/)
|
/*static*/ void RSettingsWin::showYourself(QWidget *parent, PageType page /*= LastPage*/)
|
||||||
{
|
{
|
||||||
if(_instance == NULL) {
|
if(_instance == NULL) {
|
||||||
@ -121,8 +115,6 @@ RSettingsWin::initStackedWidget()
|
|||||||
stackedWidget->addWidget(new AppearancePage());
|
stackedWidget->addWidget(new AppearancePage());
|
||||||
stackedWidget->addWidget(new SoundPage() );
|
stackedWidget->addWidget(new SoundPage() );
|
||||||
|
|
||||||
loadSettings(); /* load saved settings */
|
|
||||||
|
|
||||||
setNewPage(General);
|
setNewPage(General);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,19 +184,6 @@ RSettingsWin::setNewPage(int page)
|
|||||||
listWidget->setCurrentRow(page);
|
listWidget->setCurrentRow(page);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
RSettingsWin::loadSettings()
|
|
||||||
{
|
|
||||||
/* Call each config page's load() method to load its data */
|
|
||||||
int i, count = stackedWidget->count();
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
ConfigPage *page = dynamic_cast<ConfigPage *> (stackedWidget->widget(i));
|
|
||||||
if (page) {
|
|
||||||
page->load();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Saves changes made to settings. */
|
/** Saves changes made to settings. */
|
||||||
void
|
void
|
||||||
RSettingsWin::saveChanges()
|
RSettingsWin::saveChanges()
|
||||||
@ -216,8 +195,8 @@ RSettingsWin::saveChanges()
|
|||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
|
ConfigPage *page = dynamic_cast<ConfigPage *>(stackedWidget->widget(i));
|
||||||
|
if (page && page->wasLoaded()) {
|
||||||
if(page && !page->save(errmsg))
|
if (!page->save(errmsg))
|
||||||
{
|
{
|
||||||
/* Display the offending page */
|
/* Display the offending page */
|
||||||
stackedWidget->setCurrentWidget(page);
|
stackedWidget->setCurrentWidget(page);
|
||||||
@ -231,10 +210,10 @@ RSettingsWin::saveChanges()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* call to RsIface save function.... */
|
/* call to RsIface save function.... */
|
||||||
//rsicontrol -> ConfigSave();
|
//rsicontrol -> ConfigSave();
|
||||||
|
|
||||||
QDialog::close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,6 @@ class RSettingsWin: public QDialog, private Ui::Settings
|
|||||||
void saveChanges();
|
void saveChanges();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadSettings();
|
|
||||||
void closeEvent (QCloseEvent * event);
|
|
||||||
void initStackedWidget();
|
void initStackedWidget();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user