mirror of
				https://github.com/RetroShare/RetroShare.git
				synced 2025-10-30 22:29:00 -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
				
			
		|  | @ -788,16 +788,16 @@ void    FileIndexMonitor::getSharedDirectories(std::list<SharedDirInfo> &dirs) | ||||||
| 	RsStackMutex stack(fiMutex) ; /* LOCKED DIRS */ | 	RsStackMutex stack(fiMutex) ; /* LOCKED DIRS */ | ||||||
| 
 | 
 | ||||||
| 	/* must provide pendingDirs, as other parts depend on instanteous response */ | 	/* must provide pendingDirs, as other parts depend on instanteous response */ | ||||||
| //	if (pendingDirs)
 |         if (pendingDirs) | ||||||
| //		dirs = pendingDirList;
 |                 dirs = pendingDirList; | ||||||
| //	else
 |         else | ||||||
| //	{
 |         { | ||||||
| 		/* get actual list (not pending stuff) */ | 		/* get actual list (not pending stuff) */ | ||||||
| 		std::map<std::string, SharedDirInfo>::const_iterator it; | 		std::map<std::string, SharedDirInfo>::const_iterator it; | ||||||
| 
 | 
 | ||||||
| 		for(it = directoryMap.begin(); it != directoryMap.end(); it++) | 		for(it = directoryMap.begin(); it != directoryMap.end(); it++) | ||||||
| 			dirs.push_back(it->second) ; | 			dirs.push_back(it->second) ; | ||||||
| //	}
 |         } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -402,6 +402,14 @@ void MainWindow::updateHashingInfo(const QString& s) | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | void MainWindow::postModDirectories(bool update_local) | ||||||
|  | { | ||||||
|  |     RSettingsWin::postModDirectories(update_local); | ||||||
|  |     ShareManager::postModDirectories(update_local); | ||||||
|  | 
 | ||||||
|  |     QCoreApplication::flush(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /** Creates a new action associated with a config page. */ | /** Creates a new action associated with a config page. */ | ||||||
| QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *group) | QAction* MainWindow::createPageAction(QIcon img, QString text, QActionGroup *group) | ||||||
| { | { | ||||||
|  | @ -466,11 +474,7 @@ MainWindow::showMess(MainWindow::Page page) | ||||||
| /** Shows Options */ | /** Shows Options */ | ||||||
| void MainWindow::showSettings() | void MainWindow::showSettings() | ||||||
| { | { | ||||||
|     static RSettingsWin *win = new RSettingsWin(this); |     RSettingsWin::showYourself(this); | ||||||
|     if (win->isHidden()) |  | ||||||
|         win->setNewPage(0); |  | ||||||
|     win->show(); |  | ||||||
|     win->activateWindow(); |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Shows Messenger window */ | /** Shows Messenger window */ | ||||||
|  | @ -624,8 +628,8 @@ void MainWindow::loadStyleSheet(const QString &sheetName) | ||||||
| 
 | 
 | ||||||
| void MainWindow::showabout() | void MainWindow::showabout() | ||||||
| { | { | ||||||
|     static AboutDialog *adlg = new AboutDialog(this); |     AboutDialog adlg(this); | ||||||
|     adlg->exec(); |     adlg.exec(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Displays the help browser and displays the most recently viewed help
 | /** Displays the help browser and displays the most recently viewed help
 | ||||||
|  | @ -647,8 +651,8 @@ void MainWindow::showHelpDialog(const QString &topic) | ||||||
| 
 | 
 | ||||||
| void MainWindow::on_actionQuick_Start_Wizard_activated() | void MainWindow::on_actionQuick_Start_Wizard_activated() | ||||||
| { | { | ||||||
|     QuickStartWizard *qstartwizard = new QuickStartWizard(this); |     QuickStartWizard qstartwizard(this); | ||||||
|     qstartwizard->exec(); |     qstartwizard.exec(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** Called when the user changes the UI translation. */ | /** Called when the user changes the UI translation. */ | ||||||
|  |  | ||||||
|  | @ -104,6 +104,7 @@ public slots: | ||||||
| 
 | 
 | ||||||
|     void updateHashingInfo(const QString&) ; |     void updateHashingInfo(const QString&) ; | ||||||
|     void displayErrorMessage(int,int,const QString&) ; |     void displayErrorMessage(int,int,const QString&) ; | ||||||
|  |     void postModDirectories(bool update_local); | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|     void closeEvent(QCloseEvent *); |     void closeEvent(QCloseEvent *); | ||||||
|  |  | ||||||
|  | @ -47,6 +47,8 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags) | ||||||
|   /* Invoke Qt Designer generated QObject setup routine */ |   /* Invoke Qt Designer generated QObject setup routine */ | ||||||
|   ui.setupUi(this); |   ui.setupUi(this); | ||||||
| 
 | 
 | ||||||
|  |   isLoading = false; | ||||||
|  | 	load(); | ||||||
| 
 | 
 | ||||||
|   connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( showShareDialog() ) ); |   connect(ui.addButton, SIGNAL(clicked( bool ) ), this , SLOT( showShareDialog() ) ); | ||||||
|   connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) ); |   connect(ui.removeButton, SIGNAL(clicked( bool ) ), this , SLOT( removeShareDirectory() ) ); | ||||||
|  | @ -57,20 +59,23 @@ ShareManager::ShareManager(QWidget *parent, Qt::WFlags flags) | ||||||
| 	ui.addButton->setToolTip(tr("Add a Share Directory")); | 	ui.addButton->setToolTip(tr("Add a Share Directory")); | ||||||
| 	ui.removeButton->setToolTip(tr("Stop sharing selected Directory")); | 	ui.removeButton->setToolTip(tr("Stop sharing selected Directory")); | ||||||
| 
 | 
 | ||||||
| 	load(); |  | ||||||
| 
 |  | ||||||
|   ui.shareddirList->horizontalHeader()->setResizeMode( 0,QHeaderView::Stretch); |   ui.shareddirList->horizontalHeader()->setResizeMode( 0,QHeaderView::Stretch); | ||||||
|   ui.shareddirList->horizontalHeader()->setResizeMode( 2,QHeaderView::Interactive);  |   ui.shareddirList->horizontalHeader()->setResizeMode( 2,QHeaderView::Interactive);  | ||||||
|   |   | ||||||
|   ui.shareddirList->horizontalHeader()->resizeSection( 0, 360 ); |   ui.shareddirList->horizontalHeader()->resizeSection( 0, 360 ); | ||||||
|   ui.shareddirList->horizontalHeader()->setStretchLastSection(false); |   ui.shareddirList->horizontalHeader()->setStretchLastSection(false); | ||||||
| 
 | 
 | ||||||
|  |   setAttribute(Qt::WA_DeleteOnClose, true); | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | ShareManager::~ShareManager() | ||||||
|  | { | ||||||
|  | 	_instance = NULL; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void ShareManager::shareddirListCostumPopupMenu( QPoint point ) | void ShareManager::shareddirListCostumPopupMenu( QPoint point ) | ||||||
| { | { | ||||||
| 
 |  | ||||||
|       QMenu contextMnu( this ); |       QMenu contextMnu( this ); | ||||||
|       QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); |       QMouseEvent *mevent = new QMouseEvent( QEvent::MouseButtonPress, point, Qt::RightButton, Qt::RightButton, Qt::NoModifier ); | ||||||
| 
 | 
 | ||||||
|  | @ -86,6 +91,7 @@ void ShareManager::shareddirListCostumPopupMenu( QPoint point ) | ||||||
| /** Loads the settings for this page */ | /** Loads the settings for this page */ | ||||||
| void ShareManager::load() | void ShareManager::load() | ||||||
| { | { | ||||||
|  | 	isLoading = true; | ||||||
| 	std::cerr << "ShareManager:: In load !!!!!" << std::endl ; | 	std::cerr << "ShareManager:: In load !!!!!" << std::endl ; | ||||||
| 
 | 
 | ||||||
| 	std::list<SharedDirInfo>::const_iterator it; | 	std::list<SharedDirInfo>::const_iterator it; | ||||||
|  | @ -95,16 +101,21 @@ void ShareManager::load() | ||||||
| 	/* get a link to the table */ | 	/* get a link to the table */ | ||||||
| 	QTableWidget *listWidget = ui.shareddirList; | 	QTableWidget *listWidget = ui.shareddirList; | ||||||
| 
 | 
 | ||||||
| 	/* remove old items ??? */ | 	/* set new row count */ | ||||||
| 	listWidget->clearContents() ; | 	listWidget->setRowCount(dirs.size()); | ||||||
| 	listWidget->setRowCount(0) ; |  | ||||||
| 
 | 
 | ||||||
| 	connect(this,SIGNAL(itemClicked(QTableWidgetItem*)),this,SLOT(updateFlags(QTableWidgetItem*))) ; | 	connect(this,SIGNAL(itemClicked(QTableWidgetItem*)),this,SLOT(updateFlags(QTableWidgetItem*))) ; | ||||||
| 
 | 
 | ||||||
|  | #ifndef USE_COMBOBOX | ||||||
|  | 	QString ToolTips [2] = { QString("If checked, the share is anonymously shared to anybody."), | ||||||
|  |                                  QString("If checked, the share is browsable by your friends.") }; | ||||||
|  | 	int Flags [2] = { RS_FILE_HINTS_NETWORK_WIDE, RS_FILE_HINTS_BROWSABLE }; | ||||||
|  | #endif | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| 	int row=0 ; | 	int row=0 ; | ||||||
| 	for(it = dirs.begin(); it != dirs.end(); it++,++row) | 	for(it = dirs.begin(); it != dirs.end(); it++,++row) | ||||||
| 	{ | 	{ | ||||||
| 		listWidget->insertRow(row) ; |  | ||||||
| 		listWidget->setItem(row,0,new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str()))); | 		listWidget->setItem(row,0,new QTableWidgetItem(QString::fromUtf8((*it).filename.c_str()))); | ||||||
| #ifdef USE_COMBOBOX | #ifdef USE_COMBOBOX | ||||||
| 		QComboBox *cb = new QComboBox ; | 		QComboBox *cb = new QComboBox ; | ||||||
|  | @ -136,20 +147,19 @@ void ShareManager::load() | ||||||
| 
 | 
 | ||||||
| 		cb->setCurrentIndex(index) ; | 		cb->setCurrentIndex(index) ; | ||||||
| #else | #else | ||||||
| 		QCheckBox *cb1 = new QCheckBox ; | 		int col; | ||||||
| 		QCheckBox *cb2 = new QCheckBox ; | 		for (col = 1; col <= 2; col++) { | ||||||
|  | 			QModelIndex index = listWidget->model()->index(row, col, QModelIndex()); | ||||||
|  | 			QCheckBox *cb = (QCheckBox*) listWidget->indexWidget(index); | ||||||
|  | 			if (cb == NULL) { | ||||||
|  | 				cb = new QCheckBox; | ||||||
|  | 				cb->setToolTip(ToolTips [col - 1]); | ||||||
|  | 				listWidget->setCellWidget(row, col, cb); | ||||||
| 
 | 
 | ||||||
| 		cb1->setChecked( (*it).shareflags & RS_FILE_HINTS_NETWORK_WIDE ) ; | 				QObject::connect(cb, SIGNAL(toggled(bool)), this, SLOT(updateFlags(bool))) ; | ||||||
| 		cb2->setChecked( (*it).shareflags & RS_FILE_HINTS_BROWSABLE ) ; | 			} | ||||||
| 
 | 			cb->setChecked((*it).shareflags & Flags [col - 1]); | ||||||
| 		cb1->setToolTip(QString("If checked, the share is anonymously shared to anybody.")) ; | 		} | ||||||
| 		cb2->setToolTip(QString("If checked, the share is browsable by your friends.")) ; |  | ||||||
| 
 |  | ||||||
| 		listWidget->setCellWidget(row,1,cb1); |  | ||||||
| 		listWidget->setCellWidget(row,2,cb2); |  | ||||||
| 
 |  | ||||||
| 		QObject::connect(cb1,SIGNAL(toggled(bool)),this,SLOT(updateFlags(bool))) ; |  | ||||||
| 		QObject::connect(cb2,SIGNAL(toggled(bool)),this,SLOT(updateFlags(bool))) ; |  | ||||||
| #endif | #endif | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -157,6 +167,8 @@ void ShareManager::load() | ||||||
| 
 | 
 | ||||||
| 	listWidget->update(); /* update display */ | 	listWidget->update(); /* update display */ | ||||||
| 	update(); | 	update(); | ||||||
|  | 
 | ||||||
|  | 	isLoading = false ; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ShareManager::showYourself() | void ShareManager::showYourself() | ||||||
|  | @ -165,8 +177,22 @@ void ShareManager::showYourself() | ||||||
| 		_instance = new ShareManager(NULL,0) ; | 		_instance = new ShareManager(NULL,0) ; | ||||||
| 
 | 
 | ||||||
| 	_instance->show() ; | 	_instance->show() ; | ||||||
|  | 	_instance->activateWindow(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | /*static*/ void ShareManager::postModDirectories(bool update_local) | ||||||
|  | { | ||||||
|  | 	if (_instance == NULL || _instance->isHidden()) { | ||||||
|  | 		return; | ||||||
|  | 	} | ||||||
|  | 	 | ||||||
|  | 	if (update_local) { | ||||||
|  | 		_instance->load(); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| void ShareManager::addShareDirectory() | void ShareManager::addShareDirectory() | ||||||
| { | { | ||||||
| 
 | 
 | ||||||
|  | @ -193,6 +219,9 @@ void ShareManager::addShareDirectory() | ||||||
| 
 | 
 | ||||||
| void ShareManager::updateFlags(bool b) | void ShareManager::updateFlags(bool b) | ||||||
| { | { | ||||||
|  | 	if(isLoading) | ||||||
|  | 		return ; | ||||||
|  | 
 | ||||||
| 	std::cerr << "Updating flags (b=" << b << ") !!!" << std::endl ; | 	std::cerr << "Updating flags (b=" << b << ") !!!" << std::endl ; | ||||||
| 
 | 
 | ||||||
| 	std::list<SharedDirInfo>::iterator it; | 	std::list<SharedDirInfo>::iterator it; | ||||||
|  |  | ||||||
|  | @ -34,11 +34,13 @@ class ShareManager : public QDialog | ||||||
| 
 | 
 | ||||||
| 	public: | 	public: | ||||||
| 	  static void showYourself() ; | 	  static void showYourself() ; | ||||||
|  | 	  static void postModDirectories(bool update_local); | ||||||
| 
 | 
 | ||||||
| private: | private: | ||||||
|   /** Default constructor */ |   /** Default constructor */ | ||||||
|   ShareManager( QWidget *parent = 0, Qt::WFlags flags = 0); |   ShareManager( QWidget *parent = 0, Qt::WFlags flags = 0); | ||||||
|   /** Default destructor */ |   /** Default destructor */ | ||||||
|  |   ~ShareManager(); | ||||||
| 
 | 
 | ||||||
|   /** Loads the settings for this page */ |   /** Loads the settings for this page */ | ||||||
|   void load(); |   void load(); | ||||||
|  | @ -66,6 +68,7 @@ private: | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|   static ShareManager *_instance; |   static ShareManager *_instance; | ||||||
|  |   bool isLoading; | ||||||
| 
 | 
 | ||||||
|   /** Define the popup menus for the Context menu */ |   /** Define the popup menus for the Context menu */ | ||||||
|   QMenu* contextMnu; |   QMenu* contextMnu; | ||||||
|  |  | ||||||
|  | @ -35,11 +35,6 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags) | ||||||
| 
 | 
 | ||||||
|     //load();
 |     //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 | #ifdef TO_REMOVE | ||||||
| 	ui.addButton->setToolTip(tr("Add a Share Directory")); | 	ui.addButton->setToolTip(tr("Add a Share Directory")); | ||||||
| 	ui.removeButton->setToolTip(tr("Remove Shared Directory")); | 	ui.removeButton->setToolTip(tr("Remove Shared Directory")); | ||||||
|  | @ -50,13 +45,18 @@ DirectoriesPage::DirectoriesPage(QWidget * parent, Qt::WFlags flags) | ||||||
| 
 | 
 | ||||||
|     if (rsFiles->getShareDownloadDirectory()) |     if (rsFiles->getShareDownloadDirectory()) | ||||||
|     { |     { | ||||||
|     	ui.checkBox->setDown(true);		/* signal not emitted */ |         ui.checkBox->setChecked(true);		/* signal not emitted */ | ||||||
|     } |     } | ||||||
|     else |     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 */ |   /* Hide platform specific features */ | ||||||
| #ifdef Q_WS_WIN | #ifdef Q_WS_WIN | ||||||
| 
 | 
 | ||||||
|  | @ -118,6 +118,9 @@ void DirectoriesPage::load() | ||||||
| 	/* get a link to the table */ | 	/* get a link to the table */ | ||||||
| 	QListWidget *listWidget = ui.dirList; | 	QListWidget *listWidget = ui.dirList; | ||||||
| 
 | 
 | ||||||
|  | 	/* save current index */ | ||||||
|  | 	QModelIndex rootIndex = listWidget->rootIndex(); | ||||||
|  | 
 | ||||||
| 	/* remove old items ??? */ | 	/* remove old items ??? */ | ||||||
| 	listWidget->clear(); | 	listWidget->clear(); | ||||||
| 
 | 
 | ||||||
|  | @ -127,6 +130,9 @@ void DirectoriesPage::load() | ||||||
| 		listWidget->addItem(QString::fromStdString((*it).filename)); | 		listWidget->addItem(QString::fromStdString((*it).filename)); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	/* set saved index */ | ||||||
|  | 	listWidget->setCurrentIndex(rootIndex); | ||||||
|  | 
 | ||||||
| 	ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); | 	ui.incomingDir->setText(QString::fromStdString(rsFiles->getDownloadDirectory())); | ||||||
| 	ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory())); | 	ui.partialsDir->setText(QString::fromStdString(rsFiles->getPartialsDirectory())); | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -35,11 +35,14 @@ | ||||||
| 
 | 
 | ||||||
| #include "rsettingswin.h" | #include "rsettingswin.h" | ||||||
| 
 | 
 | ||||||
|  | RSettingsWin *RSettingsWin::_instance = NULL; | ||||||
|  | int RSettingsWin::lastPage = 0; | ||||||
|  | 
 | ||||||
| RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags) | RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags) | ||||||
|                             : QDialog(parent, flags) |                             : QDialog(parent, flags) | ||||||
| { | { | ||||||
|     setupUi(this); |     setupUi(this); | ||||||
|     setAttribute(Qt::WA_QuitOnClose, false); |     setAttribute(Qt::WA_DeleteOnClose, true); | ||||||
|     setModal(false); |     setModal(false); | ||||||
| 
 | 
 | ||||||
|     initStackedWidget(); |     initStackedWidget(); | ||||||
|  | @ -48,12 +51,47 @@ RSettingsWin::RSettingsWin(QWidget * parent, Qt::WFlags flags) | ||||||
|     connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) ); |     connect(okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | RSettingsWin::~RSettingsWin() | ||||||
|  | { | ||||||
|  |     lastPage = stackedWidget->currentIndex (); | ||||||
|  |     _instance = NULL; | ||||||
|  | } | ||||||
|  | 
 | ||||||
| void | void | ||||||
| RSettingsWin::closeEvent (QCloseEvent * event) | RSettingsWin::closeEvent (QCloseEvent * event) | ||||||
| { | { | ||||||
|     QWidget::closeEvent(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 | void | ||||||
| RSettingsWin::initStackedWidget() | RSettingsWin::initStackedWidget() | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -34,8 +34,12 @@ class RSettingsWin: public QDialog, private Ui::Settings | ||||||
|         enum PageType { General = 0, Server, Transfer, |         enum PageType { General = 0, Server, Transfer, | ||||||
|                         Directories, Notify, Security, Appearance, Fileassociations, Sound }; |                         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(QWidget * parent = 0, Qt::WFlags flags = 0); | ||||||
|         ~RSettingsWin() {} |         ~RSettingsWin(); | ||||||
| 
 | 
 | ||||||
|     public slots: |     public slots: | ||||||
|         //! Go to a specific part of the control panel.
 |         //! Go to a specific part of the control panel.
 | ||||||
|  | @ -49,6 +53,10 @@ class RSettingsWin: public QDialog, private Ui::Settings | ||||||
|     	void loadSettings(); |     	void loadSettings(); | ||||||
|         void closeEvent (QCloseEvent * event); |         void closeEvent (QCloseEvent * event); | ||||||
|         void initStackedWidget(); |         void initStackedWidget(); | ||||||
|  | 
 | ||||||
|  |     private: | ||||||
|  |         static RSettingsWin *_instance; | ||||||
|  |         static int lastPage; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #endif // !RSETTINGSWIN_HPP_
 | #endif // !RSETTINGSWIN_HPP_
 | ||||||
|  |  | ||||||
|  | @ -145,6 +145,7 @@ int main(int argc, char *argv[]) | ||||||
| 	QObject::connect(notify,SIGNAL(hashingInfoChanged(const QString&)),w                   		,SLOT(updateHashingInfo(const QString&))) ; | 	QObject::connect(notify,SIGNAL(hashingInfoChanged(const QString&)),w                   		,SLOT(updateHashingInfo(const QString&))) ; | ||||||
| 	QObject::connect(notify,SIGNAL(filesPreModChanged(bool))          ,w->sharedfilesDialog		,SLOT(preModDirectories(bool)          )) ; | 	QObject::connect(notify,SIGNAL(filesPreModChanged(bool))          ,w->sharedfilesDialog		,SLOT(preModDirectories(bool)          )) ; | ||||||
| 	QObject::connect(notify,SIGNAL(filesPostModChanged(bool))         ,w->sharedfilesDialog		,SLOT(postModDirectories(bool)         )) ; | 	QObject::connect(notify,SIGNAL(filesPostModChanged(bool))         ,w->sharedfilesDialog		,SLOT(postModDirectories(bool)         )) ; | ||||||
|  | 	QObject::connect(notify,SIGNAL(filesPostModChanged(bool))         ,w                            ,SLOT(postModDirectories(bool)         )) ; | ||||||
| 	QObject::connect(notify,SIGNAL(transfersChanged())                ,w->transfersDialog  		,SLOT(insertTransfers()                )) ; | 	QObject::connect(notify,SIGNAL(transfersChanged())                ,w->transfersDialog  		,SLOT(insertTransfers()                )) ; | ||||||
|         QObject::connect(notify,SIGNAL(friendsChanged())                  ,w->messengerWindow 		,SLOT(insertPeers()                    )) ; |         QObject::connect(notify,SIGNAL(friendsChanged())                  ,w->messengerWindow 		,SLOT(insertPeers()                    )) ; | ||||||
| 	QObject::connect(notify,SIGNAL(friendsChanged())                  ,w->peersDialog      		,SLOT(insertPeers()                    )) ; | 	QObject::connect(notify,SIGNAL(friendsChanged())                  ,w->peersDialog      		,SLOT(insertPeers()                    )) ; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 csoler
						csoler