Browse Source

Hide tabs when only one is visible

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
9e575e45b7
  1. 1
      Changelog
  2. 15
      src/GUI.cpp
  3. 3
      src/GUI.h
  4. 44
      src/HidableTabWidget.h
  5. 5
      src/src.pro

1
Changelog

@ -10,6 +10,7 @@
- FEATURE: Added error state for torrents (error is displayed in a tooltip) - FEATURE: Added error state for torrents (error is displayed in a tooltip)
- FEATURE: Added filter for paused/error torrents - FEATURE: Added filter for paused/error torrents
- FEATURE: Add Check/Uncheck all feature in Web UI - FEATURE: Add Check/Uncheck all feature in Web UI
- FEATURE: Search engine can now be disabled
- BUGFIX: Hide seeding torrents files priorities in Web UI - BUGFIX: Hide seeding torrents files priorities in Web UI
- BUGFIX: The user can disable permanently recursive torrent download - BUGFIX: The user can disable permanently recursive torrent download
- COSMETIC: Display peers country name in tooltip - COSMETIC: Display peers country name in tooltip

15
src/GUI.cpp

@ -63,6 +63,7 @@
#include "transferlistfilterswidget.h" #include "transferlistfilterswidget.h"
#include "propertieswidget.h" #include "propertieswidget.h"
#include "statusbar.h" #include "statusbar.h"
#include "HidableTabWidget.h"
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
#include "qmacapplication.h" #include "qmacapplication.h"
void qt_mac_set_dock_menu(QMenu *menu); void qt_mac_set_dock_menu(QMenu *menu);
@ -125,7 +126,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
#endif #endif
qDebug("create tabWidget"); qDebug("create tabWidget");
tabs = new QTabWidget(); tabs = new HidableTabWidget();
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int))); connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
vSplitter = new QSplitter(Qt::Horizontal); vSplitter = new QSplitter(Qt::Horizontal);
//vSplitter->setChildrenCollapsible(false); //vSplitter->setChildrenCollapsible(false);
@ -182,10 +183,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
actionSpeed_in_title_bar->setChecked(Preferences::speedInTitleBar()); actionSpeed_in_title_bar->setChecked(Preferences::speedInTitleBar());
actionRSS_Reader->setChecked(Preferences::isRSSEnabled()); actionRSS_Reader->setChecked(Preferences::isRSSEnabled());
actionSearch_engine->setChecked(Preferences::isSearchEnabled()); actionSearch_engine->setChecked(Preferences::isSearchEnabled());
if(actionSearch_engine->isChecked()) displaySearchTab(actionSearch_engine->isChecked());
displaySearchTab(true); displayRSSTab(actionRSS_Reader->isChecked());
if(actionRSS_Reader->isChecked())
displayRSSTab(true);
show(); show();
@ -297,10 +296,13 @@ void GUI::displayRSSTab(bool enable) {
int index_tab = tabs->addTab(rssWidget, tr("RSS")); int index_tab = tabs->addTab(rssWidget, tr("RSS"));
tabs->setTabIcon(index_tab, QIcon(QString::fromUtf8(":/Icons/rss32.png"))); tabs->setTabIcon(index_tab, QIcon(QString::fromUtf8(":/Icons/rss32.png")));
} }
tabs->showTabBar(true);
} else { } else {
if(rssWidget) { if(rssWidget) {
delete rssWidget; delete rssWidget;
} }
if(!searchEngine)
tabs->showTabBar(false);
} }
} }
@ -311,10 +313,13 @@ void GUI::displaySearchTab(bool enable) {
searchEngine = new SearchEngine(this, BTSession); searchEngine = new SearchEngine(this, BTSession);
tabs->insertTab(1, searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search")); tabs->insertTab(1, searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
} }
tabs->showTabBar(true);
} else { } else {
if(searchEngine) { if(searchEngine) {
delete searchEngine; delete searchEngine;
} }
if(!rssWidget)
tabs->showTabBar(false);
} }
} }

3
src/GUI.h

@ -58,6 +58,7 @@ class consoleDlg;
class about; class about;
class createtorrent; class createtorrent;
class downloadFromURL; class downloadFromURL;
class HidableTabWidget;
class GUI : public QMainWindow, private Ui::MainWindow{ class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT Q_OBJECT
@ -136,7 +137,7 @@ private:
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed? QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
// GUI related // GUI related
QTimer *guiUpdater; QTimer *guiUpdater;
QTabWidget *tabs; HidableTabWidget *tabs;
StatusBar *status_bar; StatusBar *status_bar;
QPointer<options_imp> options; QPointer<options_imp> options;
QPointer<consoleDlg> console; QPointer<consoleDlg> console;

44
src/HidableTabWidget.h

@ -0,0 +1,44 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef HIDABLETABWIDGET_H
#define HIDABLETABWIDGET_H
#include <QTabWidget>
#include <QTabBar>
class HidableTabWidget : public QTabWidget {
public:
void showTabBar(bool show) {
tabBar()->setVisible(show);
}
};
#endif // HIDABLETABWIDGET_H

5
src/src.pro

@ -329,7 +329,9 @@ contains(DEFINES, DISABLE_GUI) {
pieceavailabilitybar.h \ pieceavailabilitybar.h \
advancedsettings.h \ advancedsettings.h \
cookiesdlg.h \ cookiesdlg.h \
rsssettings.h rsssettings.h \
HidableTabWidget.h
macx { macx {
HEADERS += qmacapplication.h HEADERS += qmacapplication.h
} }
@ -401,4 +403,3 @@ SOURCES += main.cpp \
} }
DESTDIR = . DESTDIR = .

Loading…
Cancel
Save