Skip to content
Permalink
Browse files
Display Nickname and ORPort in window title if running as a relay
  • Loading branch information
feroze committed Apr 10, 2012
1 parent ca90234 commit 5bc1bab418cca8c28c5d9797d89312eaefb86333
@@ -0,0 +1,3 @@
New features:
o Display the relay Nickname and ORPort in the window title when
Vidalia is running as a relay. Fixes bug 3634.
@@ -185,6 +185,7 @@ MainWindow::createGUI()
createMenuBar();
createToolBar();
createTrayIcon();
updateTitle();

// We need to create this tab at the beggining
// and we must specify the statusBar
@@ -497,6 +498,25 @@ MainWindow::createConnections()
this, SLOT(addTab(VidaliaTab *)));
}

/* Sets window title to "Nickname ORPort" if running as relay */
void
MainWindow::updateTitle()
{
ServerSettings settings(_torControl);

QString baseTitle = tr("Vidalia Control Panel");

if (settings.isServerEnabled()) {
QString Nickname = settings.getNickname();
QString ORPort = QString::number(settings.getORPort());
setWindowTitle(QString("%1 - %2 %3").arg(baseTitle)
.arg(Nickname)
.arg(ORPort));
} else {
setWindowTitle(baseTitle);
}
}

/** Called when the application is closing, by selecting "Exit" from the tray
* menu. If we're running a Tor server, then ask if we want to kill Tor now,
* or do a delayed shutdown. */
@@ -1778,6 +1798,8 @@ MainWindow::showConfigDialog(ConfigDialog::Page page)
this, SLOT(showHelpDialog(QString)));
connect(configDialog, SIGNAL(restartTor()),
this, SLOT(restart()));
connect(configDialog, SIGNAL(configChanged()),
this, SLOT(updateTitle()));
configDialog->showWindow(page);
}

@@ -171,6 +171,9 @@ private slots:
/** Called when the Panic! button is pressed */
void panic();

/** Called when server configuration is changed */
void updateTitle();

#if defined(USE_AUTOUPDATE)
/** Called when the user clicks the 'Check Now' button in the General
* settings page. */
@@ -66,6 +66,8 @@ ConfigDialog::ConfigDialog(QWidget* parent)

/* Used to connect restartTor signals */
AdvancedPage *advancedPage;
/* Used to connect configChanged signals */
ServerPage *serverPage;
/* Create the config pages and actions */
QActionGroup *grp = new QActionGroup(this);
GeneralPage *generalPage = new GeneralPage(ui.stackPages);
@@ -79,7 +81,7 @@ ConfigDialog::ConfigDialog(QWidget* parent)
createPageAction(QIcon(IMAGE_NETWORK),
tr("Network"), "Network", grp));

ui.stackPages->add(new ServerPage(ui.stackPages),
ui.stackPages->add(serverPage = new ServerPage(ui.stackPages),
createPageAction(QIcon(IMAGE_SERVER),
tr("Sharing"), "Sharing", grp));

@@ -92,6 +94,7 @@ ConfigDialog::ConfigDialog(QWidget* parent)
tr("Advanced"), "Advanced", grp));

connect(advancedPage, SIGNAL(restartTor()), this, SIGNAL(restartTor()));
connect(serverPage, SIGNAL(configChanged()), this, SIGNAL(configChanged()));

foreach (ConfigPage *page, ui.stackPages->pages()) {
connect(page, SIGNAL(helpRequested(QString)),
@@ -51,6 +51,8 @@ public slots:
void checkForUpdates();
/** Emitted when the user changes torrc file to restart Tor */
void restartTor();
/** Emitted when user changes server configuration */
void configChanged();

protected:
/** Called when the user changes the UI translation. */
@@ -65,6 +65,9 @@ class ConfigPage : public QWidget
/** Emitted when all the settings need to be reloaded */
void reloadAll();

/** Emitted when user changes server configuration */
void configChanged();

private:
QString _title; /**< Title of this configuration page. */
};
@@ -284,7 +284,13 @@ ServerPage::changedSinceLastApply()
bool
ServerPage::apply(QString &errmsg)
{
return _settings->apply(&errmsg);
if (_settings->apply(&errmsg)) {
/* Emits signal used to set Vidalia window title in MainWindow */
emit configChanged();
return true;
}

return false;
}

/** Returns true if the user has changed their server settings since the

0 comments on commit 5bc1bab

Please sign in to comment.