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 @@ -193,6 +193,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
createKeyboardShortcuts();
// Create status bar
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()));
#ifdef Q_WS_MAC
@ -1254,5 +1255,11 @@ void GUI::handleUpdateInstalled(QString error_msg) @@ -1254,5 +1255,11 @@ void GUI::handleUpdateInstalled(QString error_msg)
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: @@ -105,6 +105,7 @@ protected slots:
void defineUILockPassword();
bool unlockUI();
void notifyOfUpdate(QString);
void showConnectionSettings();
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayTransferTab() const;

5
src/options_imp.cpp

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

1
src/options_imp.h

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

18
src/statusbar.h

@ -56,10 +56,10 @@ public: @@ -56,10 +56,10 @@ public:
layout->setContentsMargins(0,0,0,0);
container->setLayout(layout);
connecStatusLblIcon = new QLabel();
connecStatusLblIcon = new QPushButton();
connecStatusLblIcon->setFlat(true);
connecStatusLblIcon->setFixedWidth(22);
connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/firewalled.png")));
connecStatusLblIcon->setIcon(QIcon(":/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>"));
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);
@ -145,6 +145,10 @@ public: @@ -145,6 +145,10 @@ public:
delete container;
}
QPushButton* connectionStatusButton() const {
return connecStatusLblIcon;
}
public slots:
void showRestartRequired() {
// Restart required notification
@ -169,15 +173,15 @@ public slots: @@ -169,15 +173,15 @@ public slots:
// Update connection status
const session_status sessionStatus = BTSession->getSessionStatus();
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."));
} else {
if(sessionStatus.has_incoming_connections) {
// 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"));
}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>"));
}
}
@ -254,7 +258,7 @@ private: @@ -254,7 +258,7 @@ private:
QFrame *statusSep2;
QFrame *statusSep3;
QFrame *statusSep4;
QLabel *connecStatusLblIcon;
QPushButton *connecStatusLblIcon;
QPushButton *altSpeedsBtn;
QTimer *refreshTimer;
QWidget *container;

Loading…
Cancel
Save