Browse Source

Improve top toolbar layout

adaptive-webui-19844
Christophe Dumez 14 years ago
parent
commit
ef84e95ec0
  1. 17
      src/mainwindow.cpp

17
src/mainwindow.cpp

@ -83,6 +83,7 @@ void qt_mac_set_dock_menu(QMenu *menu);
using namespace libtorrent; using namespace libtorrent;
#define TIME_TRAY_BALLOON 5000 #define TIME_TRAY_BALLOON 5000
#define TOOLBAR_SPACING 10
/***************************************************** /*****************************************************
* * * *
@ -140,7 +141,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
prioSeparator->setVisible(false); prioSeparator->setVisible(false);
prioSeparator2->setVisible(false); prioSeparator2->setVisible(false);
// Fix Tool bar layout // Fix Tool bar layout
toolBar->layout()->setSpacing(7); toolBar->layout()->setSpacing(TOOLBAR_SPACING);
// Creating Bittorrent session // Creating Bittorrent session
connect(QBtSession::instance(), SIGNAL(fullDiskError(QTorrentHandle, QString)), this, SLOT(fullDiskError(QTorrentHandle, QString))); connect(QBtSession::instance(), SIGNAL(fullDiskError(QTorrentHandle, QString)), this, SLOT(fullDiskError(QTorrentHandle, QString)));
connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), this, SLOT(finishedTorrent(QTorrentHandle))); connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), this, SLOT(finishedTorrent(QTorrentHandle)));
@ -176,14 +177,16 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
connect(transferList->getSourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(updateNbTorrents())); connect(transferList->getSourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(updateNbTorrents()));
vboxLayout->addWidget(tabs); vboxLayout->addWidget(tabs);
// Name filter // Name filter
search_filter = new LineEdit(); search_filter = new LineEdit();
QAction *separatorBFSearch = toolBar->insertSeparator(actionLock_qBittorrent); toolBar->insertWidget(actionLock_qBittorrent, search_filter);
toolBar->insertWidget(separatorBFSearch, search_filter);
search_filter->setFixedWidth(200); search_filter->setFixedWidth(200);
connect(search_filter, SIGNAL(textChanged(QString)), transferList, SLOT(applyNameFilter(QString))); connect(search_filter, SIGNAL(textChanged(QString)), transferList, SLOT(applyNameFilter(QString)));
QWidget *spacer = new QWidget(this);
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
toolBar->insertWidget(actionLock_qBittorrent, spacer);
// Transfer list slots // Transfer list slots
connect(actionStart, SIGNAL(triggered()), transferList, SLOT(startSelectedTorrents())); connect(actionStart, SIGNAL(triggered()), transferList, SLOT(startSelectedTorrents()));
connect(actionStart_All, SIGNAL(triggered()), QBtSession::instance(), SLOT(resumeAllTorrents())); connect(actionStart_All, SIGNAL(triggered()), QBtSession::instance(), SLOT(resumeAllTorrents()));
@ -946,7 +949,7 @@ void MainWindow::loadPreferences(bool configure_session) {
// General // General
if(pref.isToolbarDisplayed()) { if(pref.isToolbarDisplayed()) {
toolBar->setVisible(true); toolBar->setVisible(true);
toolBar->layout()->setSpacing(7); toolBar->layout()->setSpacing(TOOLBAR_SPACING);
} else { } else {
// Clear search filter before hiding the top toolbar // Clear search filter before hiding the top toolbar
search_filter->clear(); search_filter->clear();
@ -966,7 +969,7 @@ void MainWindow::loadPreferences(bool configure_session) {
actionIncreasePriority->setVisible(true); actionIncreasePriority->setVisible(true);
prioSeparator->setVisible(true); prioSeparator->setVisible(true);
prioSeparator2->setVisible(true); prioSeparator2->setVisible(true);
toolBar->layout()->setSpacing(7); toolBar->layout()->setSpacing(TOOLBAR_SPACING);
} }
} else { } else {
if(actionDecreasePriority->isVisible()) { if(actionDecreasePriority->isVisible()) {
@ -975,7 +978,7 @@ void MainWindow::loadPreferences(bool configure_session) {
actionIncreasePriority->setVisible(false); actionIncreasePriority->setVisible(false);
prioSeparator->setVisible(false); prioSeparator->setVisible(false);
prioSeparator2->setVisible(false); prioSeparator2->setVisible(false);
toolBar->layout()->setSpacing(7); toolBar->layout()->setSpacing(TOOLBAR_SPACING);
} }
} }

Loading…
Cancel
Save