@ -87,11 +87,11 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
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 ) )
# if defined(Q_WS_WIN)
# if defined(Q_WS_WIN)
+ " [Windows] "
+ " [Windows] "
# elif defined(Q_WS_MAC)
# elif defined(Q_WS_MAC)
+ " [Mac OS X] "
+ " [Mac OS X] "
# endif
# endif
) ;
) ;
// Setting icons
// Setting icons
this - > setWindowIcon ( QIcon ( QString : : fromUtf8 ( " :/Icons/skin/qbittorrent32.png " ) ) ) ;
this - > setWindowIcon ( QIcon ( QString : : fromUtf8 ( " :/Icons/skin/qbittorrent32.png " ) ) ) ;
actionOpen - > setIcon ( QIcon ( QString : : fromUtf8 ( " :/Icons/skin/open.png " ) ) ) ;
actionOpen - > setIcon ( QIcon ( QString : : fromUtf8 ( " :/Icons/skin/open.png " ) ) ) ;
@ -180,7 +180,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
if ( ! GetUserNameA ( buffer , & buffer_len ) )
if ( ! GetUserNameA ( buffer , & buffer_len ) )
uid = QString ( buffer ) ;
uid = QString ( buffer ) ;
# else
# else
uid = QString : : number ( getuid ( ) ) ;
uid = QString : : number ( getuid ( ) ) ;
# endif
# endif
# ifdef Q_WS_X11
# ifdef Q_WS_X11
if ( QFile : : exists ( QDir : : tempPath ( ) + QDir : : separator ( ) + QString ( " qBittorrent- " ) + uid ) ) {
if ( QFile : : exists ( QDir : : tempPath ( ) + QDir : : separator ( ) + QString ( " qBittorrent- " ) + uid ) ) {
@ -220,19 +220,19 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
transferListFilters - > getStatusFilters ( ) - > setVerticalScrollBarPolicy ( Qt : : ScrollBarAlwaysOff ) ;
transferListFilters - > getStatusFilters ( ) - > setVerticalScrollBarPolicy ( Qt : : ScrollBarAlwaysOff ) ;
if ( Preferences : : startMinimized ( ) ) {
if ( Preferences : : startMinimized ( ) ) {
setWindowState ( Qt : : WindowMinimized ) ;
showMinimized ( ) ;
}
}
qDebug ( " GUI Built " ) ;
qDebug ( " GUI Built " ) ;
# ifdef Q_WS_WIN
# ifdef Q_WS_WIN
if ( ! Preferences : : neverCheckFileAssoc ( ) & & ! Preferences : : isFileAssocOk ( ) ) {
if ( ! Preferences : : neverCheckFileAssoc ( ) & & ! Preferences : : isFileAssocOk ( ) ) {
if ( QMessageBox : : question ( 0 , tr ( " Torrent file association " ) ,
if ( QMessageBox : : question ( 0 , tr ( " Torrent file association " ) ,
tr ( " qBittorrent is not the default application to open torrent files or Magnet links. \n Do you want to associate qBittorrent to torrent files and Magnet links? " ) ,
tr ( " qBittorrent is not the default application to open torrent files or Magnet links. \n Do you want to associate qBittorrent to torrent files and Magnet links? " ) ,
QMessageBox : : Yes | QMessageBox : : No , QMessageBox : : Yes ) = = QMessageBox : : Yes ) {
QMessageBox : : Yes | QMessageBox : : No , QMessageBox : : Yes ) = = QMessageBox : : Yes ) {
Preferences : : setFileAssoc ( ) ;
Preferences : : setFileAssoc ( ) ;
} else {
} else {
Preferences : : setNeverCheckFileAssoc ( ) ;
Preferences : : setNeverCheckFileAssoc ( ) ;
}
}
}
}
# endif
# endif
}
}
@ -342,6 +342,7 @@ void GUI::tab_changed(int new_tab) {
void GUI : : writeSettings ( ) {
void GUI : : writeSettings ( ) {
QSettings settings ( QString : : fromUtf8 ( " qBittorrent " ) , QString : : fromUtf8 ( " qBittorrent " ) ) ;
QSettings settings ( QString : : fromUtf8 ( " qBittorrent " ) , QString : : fromUtf8 ( " qBittorrent " ) ) ;
settings . beginGroup ( QString : : fromUtf8 ( " MainWindow " ) ) ;
settings . beginGroup ( QString : : fromUtf8 ( " MainWindow " ) ) ;
settings . setValue ( " IsMaximized " , isMaximized ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " size " ) , size ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " size " ) , size ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " pos " ) , pos ( ) ) ;
settings . setValue ( QString : : fromUtf8 ( " pos " ) , pos ( ) ) ;
// Splitter size
// Splitter size
@ -407,6 +408,8 @@ void GUI::readSettings() {
settings . beginGroup ( QString : : fromUtf8 ( " MainWindow " ) ) ;
settings . beginGroup ( QString : : fromUtf8 ( " MainWindow " ) ) ;
resize ( settings . value ( QString : : fromUtf8 ( " size " ) , size ( ) ) . toSize ( ) ) ;
resize ( settings . value ( QString : : fromUtf8 ( " size " ) , size ( ) ) . toSize ( ) ) ;
move ( settings . value ( QString : : fromUtf8 ( " pos " ) , misc : : screenCenter ( this ) ) . toPoint ( ) ) ;
move ( settings . value ( QString : : fromUtf8 ( " pos " ) , misc : : screenCenter ( this ) ) . toPoint ( ) ) ;
if ( settings . value ( " IsMaximized " , false ) . toBool ( ) )
showMaximized ( ) ;
const QStringList & sizes_str = settings . value ( " vSplitterSizes " , QStringList ( ) ) . toStringList ( ) ;
const QStringList & sizes_str = settings . value ( " vSplitterSizes " , QStringList ( ) ) . toStringList ( ) ;
// Splitter size
// Splitter size
QList < int > sizes ;
QList < int > sizes ;
@ -606,12 +609,16 @@ void GUI::on_actionCreate_torrent_triggered() {
bool GUI : : event ( QEvent * e ) {
bool GUI : : event ( QEvent * e ) {
if ( e - > type ( ) = = QEvent : : WindowStateChange ) {
if ( e - > type ( ) = = QEvent : : WindowStateChange ) {
qDebug ( " Window change event " ) ;
//Now check to see if the window is minimised
//Now check to see if the window is minimised
if ( isMinimized ( ) ) {
if ( isMinimized ( ) ) {
qDebug ( " minimisation " ) ;
qDebug ( " minimisation " ) ;
QSettings settings ( QString : : fromUtf8 ( " qBittorrent " ) , QString : : fromUtf8 ( " qBittorrent " ) ) ;
QSettings settings ( QString : : fromUtf8 ( " qBittorrent " ) , QString : : fromUtf8 ( " qBittorrent " ) ) ;
if ( systrayIcon & & settings . value ( QString : : fromUtf8 ( " Preferences/General/MinimizeToTray " ) , false ) . toBool ( ) ) {
if ( systrayIcon & & settings . value ( QString : : fromUtf8 ( " Preferences/General/MinimizeToTray " ) , false ) . toBool ( ) ) {
hide ( ) ;
qDebug ( " Minimize to Tray enabled, hiding! " ) ;
e - > accept ( ) ;
QTimer : : singleShot ( 0 , this , SLOT ( hide ( ) ) ) ;
return true ;
}
}
}
}
}
}