fixed auto-raise of pages that are not in the top level

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6141 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2013-02-23 14:29:36 +00:00
parent 718314af75
commit 6e9d1beda9
6 changed files with 69 additions and 29 deletions

View File

@ -228,6 +228,19 @@ FriendsDialog::~FriendsDialog ()
}
}
void FriendsDialog::activatePage(FriendsDialog::Page page)
{
switch(page)
{
case FriendsDialog::NetworkTab: ui.tabWidget->setCurrentWidget(networkDialog) ;
break ;
case FriendsDialog::BroadcastTab: ui.tabWidget->setCurrentWidget(networkDialog) ;
break ;
case FriendsDialog::NetworkViewTab: ui.tabWidget->setCurrentWidget(networkView) ;
break ;
}
}
UserNotify *FriendsDialog::getUserNotify(QObject *parent)
{
return new ChatUserNotify(parent);

View File

@ -40,6 +40,13 @@ class FriendsDialog : public RsAutoUpdatePage
Q_OBJECT
public:
enum Page {
/* Fixed numbers for load and save the last page */
NetworkTab = 0, /** Network page. */
NetworkViewTab = 1, /** Network new graph. */
BroadcastTab = 2 /** Old group chat page. */
};
/** Default Constructor */
FriendsDialog(QWidget *parent = 0);
/** Default Destructor */
@ -52,6 +59,8 @@ public:
static bool isGroupChatActive();
static void groupChatActivate();
void activatePage(FriendsDialog::Page page) ;
NetworkDialog *networkDialog ;
NetworkView *networkView ;
public slots:

View File

@ -786,49 +786,47 @@ void SetForegroundWindowInternal(HWND hWnd)
return false;
}
MainPage *Page = NULL;
switch (page) {
// case Network:
// Page = _instance->networkDialog;
// break;
case Search:
_instance->ui->stackPages->setCurrentPage( _instance->transfersDialog );
_instance->transfersDialog->activatePage(TransfersDialog::SearchTab) ;
break ;
case Network:
_instance->ui->stackPages->setCurrentPage( _instance->friendsDialog );
_instance->friendsDialog->activatePage(FriendsDialog::NetworkTab) ;
break;
case Friends:
Page = _instance->friendsDialog;
_instance->ui->stackPages->setCurrentPage( _instance->friendsDialog );
break;
case ChatLobby:
Page = _instance->chatLobbyDialog;
_instance->ui->stackPages->setCurrentPage( _instance->chatLobbyDialog );
break;
case Transfers:
Page = _instance->transfersDialog;
_instance->ui->stackPages->setCurrentPage( _instance->transfersDialog );
break;
// case SharedDirectories:
// Page = _instance->sharedfilesDialog;
case SharedDirectories:
_instance->ui->stackPages->setCurrentPage( _instance->transfersDialog );
_instance->transfersDialog->activatePage(TransfersDialog::LocalSharedFilesTab) ;
break;
case Messages:
Page = _instance->messagesDialog;
_instance->ui->stackPages->setCurrentPage( _instance->messagesDialog );
break;
case Channels:
Page = _instance->channelFeed;
break;
_instance->ui->stackPages->setCurrentPage( _instance->channelFeed );
return true ;
case Forums:
Page = _instance->forumsDialog;
break;
_instance->ui->stackPages->setCurrentPage( _instance->forumsDialog );
return true ;
#ifdef BLOGS
case Blogs:
Page = _instance->blogsFeed;
break;
return true ;
#endif
default:
std::cerr << "Show page called on value that is not handled yet. Please code it! (value = " << Page << ")" << std::endl;
std::cerr << "Show page called on value that is not handled yet. Please code it! (value = " << page << ")" << std::endl;
}
if (Page) {
/* Set the focus to the specified page. */
_instance->ui->stackPages->setCurrentPage(Page);
return true;
}
return false;
return false ;
}
/** Get the active page. */

View File

@ -45,7 +45,7 @@
#include <retroshare/rsforums.h>
#include <retroshare/rschannels.h>
#define DEBUG_RSLINK 1
//#define DEBUG_RSLINK 1
#define HOST_FILE "file"
#define HOST_EXTRAFILE "extra"
@ -1212,8 +1212,6 @@ static void processList(const QStringList &list, const QString &textSingular, co
#ifdef DEBUG_RSLINK
std::cerr << " RetroShareLink::process SearchRequest : string : " << link.name().toStdString() << std::endl;
#endif
MainWindow::showWindow(MainWindow::Search);
SearchDialog *searchDialog = dynamic_cast<SearchDialog*>(MainWindow::getPage(MainWindow::Search));
if (!searchDialog)
{
@ -1221,6 +1219,7 @@ static void processList(const QStringList &list, const QString &textSingular, co
break;
}
MainWindow::showWindow(MainWindow::Search);
searchDialog->searchKeywords(link.name());
searchStarted.append(link.name());
break;

View File

@ -408,6 +408,19 @@ TransfersDialog::~TransfersDialog()
processSettings(false);
}
void TransfersDialog::activatePage(TransfersDialog::Page page)
{
switch(page)
{
case TransfersDialog::SearchTab: ui.tabWidget->setCurrentWidget(searchDialog) ;
break ;
case TransfersDialog::LocalSharedFilesTab: ui.tabWidget->setCurrentWidget(localSharedFiles) ;
break ;
case TransfersDialog::RemoteSharedFilesTab: ui.tabWidget->setCurrentWidget(remoteSharedFiles) ;
break ;
}
}
UserNotify *TransfersDialog::getUserNotify(QObject *parent)
{
return new TransferUserNotify(parent);

View File

@ -45,14 +45,22 @@ class TransfersDialog : public RsAutoUpdatePage
Q_OBJECT
public:
enum Page {
/* Fixed numbers for load and save the last page */
SearchTab = 0, /** Network page. */
LocalSharedFilesTab = 1, /** Network new graph. */
RemoteSharedFilesTab = 2 /** Old group chat page. */
};
/** Default Constructor */
TransfersDialog(QWidget *parent = 0);
~TransfersDialog();
virtual UserNotify *getUserNotify(QObject *parent);
// replaced by shortcut
// virtual void keyPressEvent(QKeyEvent *) ;
void activatePage(TransfersDialog::Page page) ;
virtual void updateDisplay() ; // derived from RsAutoUpdateWidget
static DetailsDialog *detailsDialog() ;