Browse Source

Show the connection settings when clicking on the connection status icon

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
34cb5efb72
  1. 9
      src/GUI.cpp
  2. 1
      src/GUI.h
  3. 5
      src/options_imp.cpp
  4. 1
      src/options_imp.h
  5. 18
      src/statusbar.h

9
src/GUI.cpp

@ -193,6 +193,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
createKeyboardShortcuts(); createKeyboardShortcuts();
// Create status bar // Create status bar
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession); status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
connect(status_bar->connectionStatusButton(), SIGNAL(clicked()), SLOT(showConnectionSettings()));
connect(actionUse_alternative_speed_limits, SIGNAL(triggered()), status_bar, SLOT(toggleAlternativeSpeeds())); connect(actionUse_alternative_speed_limits, SIGNAL(triggered()), status_bar, SLOT(toggleAlternativeSpeeds()));
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
@ -1254,5 +1255,11 @@ void GUI::handleUpdateInstalled(QString error_msg)
void GUI::on_actionDonate_money_triggered() void GUI::on_actionDonate_money_triggered()
{ {
QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=163414")); QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=163414"));
}
void GUI::showConnectionSettings()
{
on_actionOptions_triggered();
options->showConnectionTab();
} }

1
src/GUI.h

@ -105,6 +105,7 @@ protected slots:
void defineUILockPassword(); void defineUILockPassword();
bool unlockUI(); bool unlockUI();
void notifyOfUpdate(QString); void notifyOfUpdate(QString);
void showConnectionSettings();
// Keyboard shortcuts // Keyboard shortcuts
void createKeyboardShortcuts(); void createKeyboardShortcuts();
void displayTransferTab() const; void displayTransferTab() const;

5
src/options_imp.cpp

@ -1309,3 +1309,8 @@ QString options_imp::webUiPassword() const
{ {
return textWebUiPassword->text(); return textWebUiPassword->text();
} }
void options_imp::showConnectionTab()
{
tabSelection->setCurrentRow(2);
}

1
src/options_imp.h

@ -158,6 +158,7 @@ protected slots:
public slots: public slots:
void setLocale(QString locale); void setLocale(QString locale);
void useStyle(); void useStyle();
void showConnectionTab();
signals: signals:
void status_changed() const; void status_changed() const;

18
src/statusbar.h

@ -56,10 +56,10 @@ public:
layout->setContentsMargins(0,0,0,0); layout->setContentsMargins(0,0,0,0);
container->setLayout(layout); container->setLayout(layout);
connecStatusLblIcon = new QLabel(); connecStatusLblIcon = new QPushButton();
connecStatusLblIcon->setFlat(true);
connecStatusLblIcon->setFixedWidth(22); connecStatusLblIcon->setFixedWidth(22);
connecStatusLblIcon->setFrameShape(QFrame::NoFrame); connecStatusLblIcon->setIcon(QIcon(":/Icons/skin/firewalled.png"));
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/firewalled.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>")); connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>"));
dlSpeedLbl = new QPushButton(tr("D: %1 B/s - T: %2", "Download speed: x B/s - Transferred: x MiB").arg("0.0").arg(misc::friendlyUnit(0))); dlSpeedLbl = new QPushButton(tr("D: %1 B/s - T: %2", "Download speed: x B/s - Transferred: x MiB").arg("0.0").arg(misc::friendlyUnit(0)));
//dlSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); //dlSpeedLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
@ -145,6 +145,10 @@ public:
delete container; delete container;
} }
QPushButton* connectionStatusButton() const {
return connecStatusLblIcon;
}
public slots: public slots:
void showRestartRequired() { void showRestartRequired() {
// Restart required notification // Restart required notification
@ -169,15 +173,15 @@ public slots:
// Update connection status // Update connection status
const session_status sessionStatus = BTSession->getSessionStatus(); const session_status sessionStatus = BTSession->getSessionStatus();
if(!BTSession->getSession()->is_listening()) { if(!BTSession->getSession()->is_listening()) {
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/disconnected.png"))); connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/disconnected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections.")); connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));
} else { } else {
if(sessionStatus.has_incoming_connections) { if(sessionStatus.has_incoming_connections) {
// Connection OK // Connection OK
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/connected.png"))); connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/connected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online")); connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Online"));
}else{ }else{
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/firewalled.png"))); connecStatusLblIcon->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/firewalled.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>")); connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection status:")+QString::fromUtf8("</b><br>")+QString::fromUtf8("<i>")+tr("No direct connections. This may indicate network configuration problems.")+QString::fromUtf8("</i>"));
} }
} }
@ -254,7 +258,7 @@ private:
QFrame *statusSep2; QFrame *statusSep2;
QFrame *statusSep3; QFrame *statusSep3;
QFrame *statusSep4; QFrame *statusSep4;
QLabel *connecStatusLblIcon; QPushButton *connecStatusLblIcon;
QPushButton *altSpeedsBtn; QPushButton *altSpeedsBtn;
QTimer *refreshTimer; QTimer *refreshTimer;
QWidget *container; QWidget *container;

Loading…
Cancel
Save