mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Added the name and location to the title of the MainWindow.
Get the name and location for the window tile and tray tooltip only once at start. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4182 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
60138e0137
commit
06bc6029f2
@ -171,7 +171,13 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
|||||||
trayActionChat = NULL;
|
trayActionChat = NULL;
|
||||||
trayActionTransfers = NULL;
|
trayActionTransfers = NULL;
|
||||||
|
|
||||||
setWindowTitle(tr("RetroShare %1 a secure decentralised communication platform").arg(retroshareVersion()));
|
/* Calculate only once */
|
||||||
|
RsPeerDetails pd;
|
||||||
|
if (rsPeers->getPeerDetails(rsPeers->getOwnId(), pd)) {
|
||||||
|
nameAndLocation = QString("%1 (%2)").arg(QString::fromUtf8(pd.name.c_str())).arg(QString::fromUtf8(pd.location.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
|
setWindowTitle(tr("RetroShare %1 a secure decentralised communication platform").arg(retroshareVersion()) + " - " + nameAndLocation);
|
||||||
|
|
||||||
/* add url handler for RetroShare links */
|
/* add url handler for RetroShare links */
|
||||||
QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "linkActivated");
|
QDesktopServices::setUrlHandler(RSLINK_SCHEME, this, "linkActivated");
|
||||||
@ -304,8 +310,6 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
|||||||
statusBar()->addPermanentWidget(ratesstatus);
|
statusBar()->addPermanentWidget(ratesstatus);
|
||||||
/** Status Bar end ******/
|
/** Status Bar end ******/
|
||||||
|
|
||||||
/* Create the actions that will go in the tray menu */
|
|
||||||
createActions();
|
|
||||||
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
|
/* Creates a tray icon with a context menu and adds it to the system's * notification area. */
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
|
|
||||||
@ -328,8 +332,6 @@ MainWindow::~MainWindow()
|
|||||||
{
|
{
|
||||||
Settings->setLastPageInMainWindow(getActivatePage());
|
Settings->setLastPageInMainWindow(getActivatePage());
|
||||||
|
|
||||||
delete _bandwidthGraph;
|
|
||||||
delete _messengerwindowAct;
|
|
||||||
delete peerstatus;
|
delete peerstatus;
|
||||||
delete natstatus;
|
delete natstatus;
|
||||||
delete dhtstatus;
|
delete dhtstatus;
|
||||||
@ -376,15 +378,15 @@ void MainWindow::createTrayIcon()
|
|||||||
initializeStatusObject(pStatusMenu, true);
|
initializeStatusObject(pStatusMenu, true);
|
||||||
|
|
||||||
trayMenu->addSeparator();
|
trayMenu->addSeparator();
|
||||||
trayMenu->addAction(_messengerwindowAct);
|
trayMenu->addAction(QIcon(IMAGE_RSM16), tr("Open Messenger"), this, SLOT(showMessengerWindow()));
|
||||||
trayMenu->addAction(_messagesAct);
|
trayMenu->addAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this, SLOT(showMess()));
|
||||||
trayMenu->addAction(_bandwidthAct);
|
trayMenu->addAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), _bandwidthGraph, SLOT(showWindow()));
|
||||||
|
|
||||||
#ifdef UNFINISHED
|
#ifdef UNFINISHED
|
||||||
trayMenu->addAction(_appAct);
|
trayMenu->addAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this, SLOT(showApplWindow()));
|
||||||
#endif
|
#endif
|
||||||
trayMenu->addAction(_settingsAct);
|
trayMenu->addAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this, SLOT(showSettings()));
|
||||||
trayMenu->addAction(_helpAct);
|
trayMenu->addAction(QIcon(IMG_HELP), tr("Help"), this, SLOT(showHelpDialog()));
|
||||||
trayMenu->addSeparator();
|
trayMenu->addSeparator();
|
||||||
trayMenu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
|
trayMenu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
|
||||||
trayMenu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized()));
|
trayMenu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized()));
|
||||||
@ -800,10 +802,7 @@ void MainWindow::updateStatus()
|
|||||||
tray += tr("%1 friends connected").arg(nOnlineCount);
|
tray += tr("%1 friends connected").arg(nOnlineCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
RsPeerDetails pd ;
|
tray += "\n" + nameAndLocation;
|
||||||
if (rsPeers->getPeerDetails(rsPeers->getOwnId(),pd)) {
|
|
||||||
tray += "\n" + QString::fromStdString(pd.name) + " (" + QString::fromStdString(pd.location) + ") " ;
|
|
||||||
}
|
|
||||||
|
|
||||||
trayIcon->setToolTip(tray);
|
trayIcon->setToolTip(tray);
|
||||||
}
|
}
|
||||||
@ -1071,29 +1070,6 @@ void MainWindow::showApplWindow()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Create and bind actions to events. Setup for initial
|
|
||||||
* tray menu configuration. */
|
|
||||||
void MainWindow::createActions()
|
|
||||||
{
|
|
||||||
_settingsAct = new QAction(QIcon(IMAGE_PREFERENCES), tr("Options"), this);
|
|
||||||
connect(_settingsAct, SIGNAL(triggered()), this, SLOT(showSettings()));
|
|
||||||
|
|
||||||
_bandwidthAct = new QAction(QIcon(IMAGE_BWGRAPH), tr("Bandwidth Graph"), this);
|
|
||||||
connect(_bandwidthAct, SIGNAL(triggered()), _bandwidthGraph, SLOT(showWindow()));
|
|
||||||
|
|
||||||
_messengerwindowAct = new QAction(QIcon(IMAGE_RSM16), tr("Open Messenger"), this);
|
|
||||||
connect(_messengerwindowAct, SIGNAL(triggered()),this, SLOT(showMessengerWindow()));
|
|
||||||
|
|
||||||
_messagesAct = new QAction(QIcon(IMAGE_MESSAGES), tr("Open Messages"), this);
|
|
||||||
connect(_messagesAct, SIGNAL(triggered()),this, SLOT(showMess()));
|
|
||||||
#ifdef UNFINISHED
|
|
||||||
_appAct = new QAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this);
|
|
||||||
connect(_appAct, SIGNAL(triggered()),this, SLOT(showApplWindow()));
|
|
||||||
#endif
|
|
||||||
_helpAct = new QAction(QIcon(IMG_HELP), tr("Help"), this);
|
|
||||||
connect(_helpAct, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If the user attempts to quit the app, a check-warning is issued. This warning can be
|
/** If the user attempts to quit the app, a check-warning is issued. This warning can be
|
||||||
turned off for future quit events.
|
turned off for future quit events.
|
||||||
*/
|
*/
|
||||||
|
@ -205,27 +205,12 @@ private slots:
|
|||||||
void on_actionQuick_Start_Wizard_activated();
|
void on_actionQuick_Start_Wizard_activated();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
/** Create the actions on the tray menu or menubar */
|
|
||||||
void createActions();
|
|
||||||
|
|
||||||
void createTrayIcon();
|
void createTrayIcon();
|
||||||
void createNotifyIcons();
|
void createNotifyIcons();
|
||||||
void updateTrayCombine();
|
void updateTrayCombine();
|
||||||
|
|
||||||
static MainWindow *_instance;
|
static MainWindow *_instance;
|
||||||
|
|
||||||
/** Defines the actions for the tray menu */
|
|
||||||
QAction* _settingsAct;
|
|
||||||
QAction* _bandwidthAct;
|
|
||||||
QAction* _messengerwindowAct;
|
|
||||||
QAction* _messagesAct;
|
|
||||||
QAction* _smplayerAct;
|
|
||||||
QAction* _helpAct;
|
|
||||||
#ifdef UNFINISHED
|
|
||||||
QAction* _appAct;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
|
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
|
||||||
BandwidthGraph* _bandwidthGraph;
|
BandwidthGraph* _bandwidthGraph;
|
||||||
|
|
||||||
@ -236,6 +221,8 @@ private:
|
|||||||
|
|
||||||
void loadStyleSheet(const QString &sheetName);
|
void loadStyleSheet(const QString &sheetName);
|
||||||
|
|
||||||
|
QString nameAndLocation;
|
||||||
|
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
QSystemTrayIcon *trayIconCombined;
|
QSystemTrayIcon *trayIconCombined;
|
||||||
QSystemTrayIcon *trayIconMessages;
|
QSystemTrayIcon *trayIconMessages;
|
||||||
|
Loading…
Reference in New Issue
Block a user