mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Better Mac integration
This commit is contained in:
parent
ae7362706f
commit
0d4b55ca32
5 changed files with 327 additions and 186 deletions
|
@ -65,6 +65,9 @@
|
|||
#include "transferlistfilterswidget.h"
|
||||
#include "propertieswidget.h"
|
||||
#include "statusbar.h"
|
||||
#ifdef Q_WS_MAC
|
||||
#include "qmacapplication.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
|
@ -129,6 +132,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||
connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
|
||||
connect(BTSession, SIGNAL(alternativeSpeedsModeChanged(bool)), this, SLOT(updateAltSpeedsBtn(bool)));
|
||||
connect(BTSession, SIGNAL(recursiveTorrentDownloadPossible(QTorrentHandle&)), this, SLOT(askRecursiveTorrentDownloadConfirmation(QTorrentHandle&)));
|
||||
#ifdef Q_WS_MAC
|
||||
connect(static_cast<QMacApplication*>(qApp), SIGNAL(newFileOpenMacEvent(QStringList)), this, SLOT(processParams(QStringList)));
|
||||
#endif
|
||||
|
||||
qDebug("create tabWidget");
|
||||
tabs = new QTabWidget();
|
||||
|
|
11
src/main.cpp
11
src/main.cpp
|
@ -39,6 +39,9 @@
|
|||
#include <QStyle>
|
||||
#include <QSplashScreen>
|
||||
#include <QPushButton>
|
||||
#ifdef Q_WS_MAC
|
||||
#include "qmacapplication.h"
|
||||
#endif
|
||||
#include "GUI.h"
|
||||
#include "ico.h"
|
||||
#else
|
||||
|
@ -70,7 +73,11 @@ const int UNLEN = 256;
|
|||
#ifdef DISABLE_GUI
|
||||
QCoreApplication *app;
|
||||
#else
|
||||
#ifndef Q_WS_MAC
|
||||
QApplication *app;
|
||||
#else
|
||||
QMacApplication *app;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
class UsageDisplay: public QObject {
|
||||
|
@ -173,7 +180,11 @@ int main(int argc, char *argv[]){
|
|||
#ifdef DISABLE_GUI
|
||||
app = new QCoreApplication(argc, argv);
|
||||
#else
|
||||
#ifndef Q_WS_MAC
|
||||
app = new QApplication(argc, argv);
|
||||
#else
|
||||
app = new QMacApplication(argc, argv);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
QString locale;
|
||||
|
|
56
src/qmacapplication.cpp
Normal file
56
src/qmacapplication.cpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2010 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
|
||||
*/
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
|
||||
#include <QFileOpenEvent>
|
||||
#include "qmacapplication.h"
|
||||
|
||||
QMacApplication::QMacApplication(int &argc, char** argv) :
|
||||
QApplication(argc, argv)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool QMacApplication::event(QEvent * event) {
|
||||
switch (event->type()) {
|
||||
case QEvent::FileOpen:
|
||||
{
|
||||
QStringList paths;
|
||||
paths << static_cast<QFileOpenEvent *>(event)->file();
|
||||
emit newFileOpenMacEvent(paths);
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return QApplication::event(event);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
55
src/qmacapplication.h
Normal file
55
src/qmacapplication.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2010 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 QMACAPPLICATION_H
|
||||
#define QMACAPPLICATION_H
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStringList>
|
||||
|
||||
class QMacApplication : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit QMacApplication(int &argc, char** argv);
|
||||
|
||||
signals:
|
||||
void newFileOpenMacEvent(QStringList paths);
|
||||
|
||||
protected:
|
||||
bool event(QEvent *);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // QMACAPPLICATION_H
|
23
src/src.pro
23
src/src.pro
|
@ -270,8 +270,10 @@ HEADERS += misc.h \
|
|||
bandwidthscheduler.h \
|
||||
scannedfoldersmodel.h
|
||||
|
||||
contains(DEFINES, DISABLE_GUI):HEADERS += headlessloader.h
|
||||
else:HEADERS += GUI.h \
|
||||
contains(DEFINES, DISABLE_GUI) {
|
||||
HEADERS += headlessloader.h
|
||||
} else {
|
||||
HEADERS += GUI.h \
|
||||
feedList.h \
|
||||
supportedengines.h \
|
||||
transferlistwidget.h \
|
||||
|
@ -312,8 +314,13 @@ else:HEADERS += GUI.h \
|
|||
pieceavailabilitybar.h \
|
||||
advancedsettings.h \
|
||||
cookiesdlg.h
|
||||
macx {
|
||||
HEADERS += qmacapplication.h
|
||||
}
|
||||
}
|
||||
|
||||
!contains(DEFINES, DISABLE_GUI):FORMS += ui/mainwindow.ui \
|
||||
!contains(DEFINES, DISABLE_GUI) {
|
||||
FORMS += ui/mainwindow.ui \
|
||||
ui/options.ui \
|
||||
ui/about.ui \
|
||||
ui/createtorrent.ui \
|
||||
|
@ -333,6 +340,7 @@ else:HEADERS += GUI.h \
|
|||
ui/peer.ui \
|
||||
ui/confirmdeletiondlg.ui \
|
||||
ui/cookiesdlg.ui
|
||||
}
|
||||
|
||||
SOURCES += main.cpp \
|
||||
bittorrent.cpp \
|
||||
|
@ -346,7 +354,8 @@ SOURCES += main.cpp \
|
|||
scannedfoldersmodel.cpp \
|
||||
misc.cpp
|
||||
|
||||
!contains(DEFINES, DISABLE_GUI):SOURCES += GUI.cpp \
|
||||
!contains(DEFINES, DISABLE_GUI) {
|
||||
SOURCES += GUI.cpp \
|
||||
options_imp.cpp \
|
||||
createtorrent_imp.cpp \
|
||||
searchengine.cpp \
|
||||
|
@ -361,5 +370,9 @@ SOURCES += main.cpp \
|
|||
cookiesdlg.cpp \
|
||||
trackerlist.cpp
|
||||
|
||||
DESTDIR = .
|
||||
macx {
|
||||
HEADERS += qmacapplication.cpp
|
||||
}
|
||||
}
|
||||
|
||||
DESTDIR = .
|
||||
|
|
Loading…
Reference in a new issue