mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-06 21:58:57 -04:00
Ported patch from thunder2 (http://sourceforge.net/tracker/index.php?func=detail&aid=2991827&group_id=178712&atid=886241)
- Bug fix: Checkbox for automatic share of the incoming directory doesn't correctly set with setDown, use setChecked - ShareManager and RSettingsWin doesn't need to be created all the time - RSettingsWin: Save the last active page for the current runtime - ShareManager and DirectoryPage: Show changed shared directories direct after the change git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2777 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
900ae2332f
commit
0773e92f85
9 changed files with 136 additions and 46 deletions
|
@ -35,11 +35,6 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
|||
|
||||
//load();
|
||||
|
||||
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
|
||||
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
||||
connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int)));
|
||||
connect(ui.editButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
||||
|
||||
#ifdef TO_REMOVE
|
||||
ui.addButton->setToolTip(tr("Add a Share Directory"));
|
||||
ui.removeButton->setToolTip(tr("Remove Shared Directory"));
|
||||
|
@ -50,13 +45,18 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags)
|
|||
|
||||
if (rsFiles->getShareDownloadDirectory())
|
||||
{
|
||||
ui.checkBox->setDown(true); /* signal not emitted */
|
||||
ui.checkBox->setChecked(true); /* signal not emitted */
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.checkBox->setDown(false); /* signal not emitted */
|
||||
ui.checkBox->setChecked(false); /* signal not emitted */
|
||||
}
|
||||
|
||||
connect(ui.incomingButton, SIGNAL(clicked( bool ) ), this , SLOT( setIncomingDirectory() ) );
|
||||
connect(ui.partialButton, SIGNAL(clicked( bool ) ), this , SLOT( setPartialsDirectory() ) );
|
||||
connect(ui.checkBox, SIGNAL(stateChanged(int)), this, SLOT(shareDownloadDirectory(int)));
|
||||
connect(ui.editButton, SIGNAL(clicked()), this, SLOT(editDirectories()));
|
||||
|
||||
/* Hide platform specific features */
|
||||
#ifdef Q_WS_WIN
|
||||
|
||||
|
@ -118,6 +118,9 @@ void DirectoriesPage::load()
|
|||
/* get a link to the table */
|
||||
QListWidget *listWidget = ui.dirList;
|
||||
|
||||
/* save current index */
|
||||
QModelIndex rootIndex = listWidget->rootIndex();
|
||||
|
||||
/* remove old items ??? */
|
||||
listWidget->clear();
|
||||
|
||||
|
@ -127,6 +130,9 @@ void DirectoriesPage::load()
|
|||
listWidget->addItem(QString::fromStdString((*it).filename));
|
||||
}
|
||||
|
||||
/* set saved index */
|
||||
listWidget->setCurrentIndex(rootIndex);
|
||||
|
||||
ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory()));
|
||||
ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory()));
|
||||
|
||||
|
|
|
@ -35,11 +35,14 @@
|
|||
|
||||
#include "rsettingswin.h"
|
||||
|
||||
RSettingsWin *RSettingsWin::_instance = NULL;
|
||||
int RSettingsWin::lastPage = 0;
|
||||
|
||||
RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags)
|
||||
: QDialog(parent, flags)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute(Qt::WA_QuitOnClose, false);
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
setModal(false);
|
||||
|
||||
initStackedWidget();
|
||||
|
@ -48,12 +51,47 @@ RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags)
|
|||
connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) );
|
||||
}
|
||||
|
||||
RSettingsWin::~RSettingsWin()
|
||||
{
|
||||
lastPage = stackedWidget->currentIndex ();
|
||||
_instance = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
RSettingsWin::closeEvent (QCloseEvent * event)
|
||||
{
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
/*static*/ void RSettingsWin::showYourself(QWidget *parent)
|
||||
{
|
||||
if(_instance == NULL) {
|
||||
_instance = new RSettingsWin(parent);
|
||||
}
|
||||
|
||||
if (_instance->isHidden()) {
|
||||
_instance->setNewPage(lastPage);
|
||||
}
|
||||
_instance->show();
|
||||
_instance->activateWindow();
|
||||
}
|
||||
|
||||
/*static*/ void RSettingsWin::postModDirectories(bool update_local)
|
||||
{
|
||||
if (_instance == NULL || _instance->isHidden() || _instance->stackedWidget == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (update_local) {
|
||||
if (_instance->stackedWidget->currentIndex() == Directories) {
|
||||
ConfigPage *Page = (ConfigPage*) _instance->stackedWidget->currentWidget();
|
||||
if (Page) {
|
||||
Page->load();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RSettingsWin::initStackedWidget()
|
||||
{
|
||||
|
|
|
@ -34,8 +34,12 @@ class RSettingsWin: public QDialog, private Ui::Settings
|
|||
enum PageType { General = 0, Server, Transfer,
|
||||
Directories, Notify, Security, Appearance, Fileassociations, Sound };
|
||||
|
||||
static void showYourself(QWidget *parent);
|
||||
static void postModDirectories(bool update_local);
|
||||
|
||||
protected:
|
||||
RSettingsWin(QWidget * parent = 0, Qt::WFlags flags = 0);
|
||||
~RSettingsWin() {}
|
||||
~RSettingsWin();
|
||||
|
||||
public slots:
|
||||
//! Go to a specific part of the control panel.
|
||||
|
@ -49,6 +53,10 @@ class RSettingsWin: public QDialog, private Ui::Settings
|
|||
void loadSettings();
|
||||
void closeEvent (QCloseEvent * event);
|
||||
void initStackedWidget();
|
||||
|
||||
private:
|
||||
static RSettingsWin *_instance;
|
||||
static int lastPage;
|
||||
};
|
||||
|
||||
#endif // !RSETTINGSWIN_HPP_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue