@ -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 Q TabWidget( ) ;
tabs = new Hidable TabWidget( ) ;
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 ) ;
}
}
}
}
@ -447,17 +452,17 @@ void GUI::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
QMessageBox confirmBox ( QMessageBox : : Question , tr ( " Recursive download confirmation " ) , tr ( " The torrent %1 contains torrent files, do you want to proceed with their download? " ) . arg ( h . name ( ) ) ) ;
QMessageBox confirmBox ( QMessageBox : : Question , tr ( " Recursive download confirmation " ) , tr ( " The torrent %1 contains torrent files, do you want to proceed with their download? " ) . arg ( h . name ( ) ) ) ;
QPushButton * yes = confirmBox . addButton ( tr ( " Yes " ) , QMessageBox : : YesRole ) ;
QPushButton * yes = confirmBox . addButton ( tr ( " Yes " ) , QMessageBox : : YesRole ) ;
/*QPushButton *no = */ confirmBox . addButton ( tr ( " No " ) , QMessageBox : : NoRole ) ;
/*QPushButton *no = */ confirmBox . addButton ( tr ( " No " ) , QMessageBox : : NoRole ) ;
QPushButton * never = confirmBox . addButton ( tr ( " Never " ) , QMessageBox : : NoRole ) ;
QPushButton * never = confirmBox . addButton ( tr ( " Never " ) , QMessageBox : : NoRole ) ;
confirmBox . exec ( ) ;
confirmBox . exec ( ) ;
if ( confirmBox . clickedButton ( ) = = 0 ) return ;
if ( confirmBox . clickedButton ( ) = = 0 ) return ;
if ( confirmBox . clickedButton ( ) = = yes ) {
if ( confirmBox . clickedButton ( ) = = yes ) {
BTSession - > recursiveTorrentDownload ( h ) ;
BTSession - > recursiveTorrentDownload ( h ) ;
return ;
return ;
}
}
if ( confirmBox . clickedButton ( ) = = never ) {
if ( confirmBox . clickedButton ( ) = = never ) {
Preferences : : disableRecursiveDownload ( ) ;
Preferences : : disableRecursiveDownload ( ) ;
}
}
}
}
void GUI : : handleDownloadFromUrlFailure ( QString url , QString reason ) const {
void GUI : : handleDownloadFromUrlFailure ( QString url , QString reason ) const {
// Display a message box
// Display a message box
@ -884,20 +889,20 @@ void GUI::updateGUI() {
void GUI : : showNotificationBaloon ( QString title , QString msg ) const {
void GUI : : showNotificationBaloon ( QString title , QString msg ) const {
# ifdef WITH_LIBNOTIFY
# ifdef WITH_LIBNOTIFY
if ( notify_init ( " summary-body " ) ) {
if ( notify_init ( " summary-body " ) ) {
NotifyNotification * notification ;
NotifyNotification * notification ;
notification = notify_notification_new ( qPrintable ( title ) , qPrintable ( msg ) , " qbittorrent " , 0 ) ;
notification = notify_notification_new ( qPrintable ( title ) , qPrintable ( msg ) , " qbittorrent " , 0 ) ;
gboolean success = notify_notification_show ( notification , NULL ) ;
gboolean success = notify_notification_show ( notification , NULL ) ;
g_object_unref ( G_OBJECT ( notification ) ) ;
g_object_unref ( G_OBJECT ( notification ) ) ;
notify_uninit ( ) ;
notify_uninit ( ) ;
if ( success ) {
if ( success ) {
return ;
return ;
}
}
}
}
# endif
# endif
# ifndef Q_WS_MAC
# ifndef Q_WS_MAC
if ( systrayIcon & & QSystemTrayIcon : : supportsMessages ( ) )
if ( systrayIcon & & QSystemTrayIcon : : supportsMessages ( ) )
systrayIcon - > showMessage ( title , msg , QSystemTrayIcon : : Information , TIME_TRAY_BALLOON ) ;
systrayIcon - > showMessage ( title , msg , QSystemTrayIcon : : Information , TIME_TRAY_BALLOON ) ;
# endif
# endif
}
}
@ -956,7 +961,7 @@ void GUI::createSystrayDelayed() {
}
}
void GUI : : updateAltSpeedsBtn ( bool alternative ) {
void GUI : : updateAltSpeedsBtn ( bool alternative ) {
actionUse_alternative_speed_limits - > setChecked ( alternative ) ;
actionUse_alternative_speed_limits - > setChecked ( alternative ) ;
}
}
QMenu * GUI : : getTrayIconMenu ( ) {
QMenu * GUI : : getTrayIconMenu ( ) {
@ -1007,18 +1012,18 @@ void GUI::on_actionOptions_triggered() {
}
}
void GUI : : on_actionTop_tool_bar_triggered ( ) {
void GUI : : on_actionTop_tool_bar_triggered ( ) {
bool is_visible = static_cast < QAction * > ( sender ( ) ) - > isChecked ( ) ;
bool is_visible = static_cast < QAction * > ( sender ( ) ) - > isChecked ( ) ;
toolBar - > setVisible ( is_visible ) ;
toolBar - > setVisible ( is_visible ) ;
Preferences : : setToolbarDisplayed ( is_visible ) ;
Preferences : : setToolbarDisplayed ( is_visible ) ;
}
}
void GUI : : on_actionSpeed_in_title_bar_triggered ( ) {
void GUI : : on_actionSpeed_in_title_bar_triggered ( ) {
displaySpeedInTitle = static_cast < QAction * > ( sender ( ) ) - > isChecked ( ) ;
displaySpeedInTitle = static_cast < QAction * > ( sender ( ) ) - > isChecked ( ) ;
Preferences : : showSpeedInTitleBar ( displaySpeedInTitle ) ;
Preferences : : showSpeedInTitleBar ( displaySpeedInTitle ) ;
if ( displaySpeedInTitle )
if ( displaySpeedInTitle )
updateGUI ( ) ;
updateGUI ( ) ;
else
else
setWindowTitle ( tr ( " qBittorrent %1 " , " e.g: qBittorrent v0.x " ) . arg ( QString : : fromUtf8 ( VERSION ) ) ) ;
setWindowTitle ( tr ( " qBittorrent %1 " , " e.g: qBittorrent v0.x " ) . arg ( QString : : fromUtf8 ( VERSION ) ) ) ;
}
}
void GUI : : on_actionRSS_Reader_triggered ( ) {
void GUI : : on_actionRSS_Reader_triggered ( ) {