mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-14 18:47:37 -07:00
- Allow to change UPnP port while it is enabled
- Allow to change qBT style! (GTK people should like Cleanlooks style)
This commit is contained in:
parent
e0a0a0beb1
commit
92f840519c
58 changed files with 11121 additions and 4519 deletions
|
@ -988,6 +988,7 @@ void GUI::configureSession(bool deleteOptions){
|
|||
// Upnp
|
||||
if(options->isDHTEnabled()){
|
||||
BTSession.enableUPnP(options->getUPnPPort());
|
||||
BTSession.setUPnPPort(options->getUPnPPort());
|
||||
}else{
|
||||
BTSession.disableUPnP();
|
||||
}
|
||||
|
|
|
@ -979,7 +979,8 @@ m_RootDeviceMap(),
|
|||
m_ServiceMap(),
|
||||
m_ActivePortMappingsMap(),
|
||||
m_IGWDeviceDetected(false),
|
||||
m_WanService(NULL)
|
||||
m_WanService(NULL),
|
||||
m_UPnPPort(udpPort)
|
||||
{
|
||||
// Pointer to self
|
||||
s_CtrlPoint = this;
|
||||
|
|
|
@ -640,6 +640,7 @@ private:
|
|||
bool m_IGWDeviceDetected;
|
||||
CUPnPService *m_WanService;
|
||||
QMutex m_WaitForSearchTimeout;
|
||||
unsigned short m_UPnPPort;
|
||||
|
||||
public:
|
||||
CUPnPControlPoint(unsigned short udpPort);
|
||||
|
@ -650,6 +651,9 @@ public:
|
|||
std::vector<CUPnPPortMapping> &upnpPortMapping);
|
||||
bool DeletePortMappings(
|
||||
std::vector<CUPnPPortMapping> &upnpPortMapping);
|
||||
unsigned short getUPnPPort() const{
|
||||
return m_UPnPPort;
|
||||
}
|
||||
|
||||
UpnpClient_Handle GetUPnPClientHandle() const
|
||||
{ return m_UPnPClientHandle; }
|
||||
|
|
|
@ -90,6 +90,22 @@ void bittorrent::enableUPnP(int port){
|
|||
}
|
||||
}
|
||||
|
||||
// Set UPnP port (>= 1000)
|
||||
void bittorrent::setUPnPPort(int upnp_port){
|
||||
if(!UPnPEnabled){
|
||||
qDebug("Cannot set UPnP port because it is disabled");
|
||||
return;
|
||||
}
|
||||
if(m_upnp->getUPnPPort() != upnp_port){
|
||||
qDebug("Changing UPnP port to %d", upnp_port);
|
||||
delete m_upnp;
|
||||
m_upnp = new CUPnPControlPoint(upnp_port);
|
||||
m_upnp->AddPortMappings(m_upnpMappings);
|
||||
}else{
|
||||
qDebug("UPnP: No need to set the port, it is already listening on this port");
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::disableUPnP(){
|
||||
if(UPnPEnabled){
|
||||
qDebug("Disabling UPnP");
|
||||
|
|
|
@ -121,6 +121,7 @@ class bittorrent : public QObject{
|
|||
#ifndef NO_UPNP
|
||||
void enableUPnP(int port=50000);
|
||||
void disableUPnP();
|
||||
void setUPnPPort(int upnp_port);
|
||||
#endif
|
||||
|
||||
protected slots:
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
Binary file not shown.
File diff suppressed because it is too large
Load diff
47
src/main.cpp
47
src/main.cpp
|
@ -28,7 +28,10 @@
|
|||
#include <QSettings>
|
||||
#include <QTcpSocket>
|
||||
#include <QTcpServer>
|
||||
|
||||
#include <QPlastiqueStyle>
|
||||
#include <QCleanlooksStyle>
|
||||
#include <QMotifStyle>
|
||||
#include <QCDEStyle>
|
||||
#ifdef Q_WS_WIN
|
||||
#include <QWindowsXPStyle>
|
||||
#endif
|
||||
|
@ -42,6 +45,35 @@
|
|||
#include "GUI.h"
|
||||
#include "misc.h"
|
||||
|
||||
void useStyle(QApplication *app, QString style){
|
||||
std::cout << "* Style: Using " << style.toStdString() << " style\n";
|
||||
if(style == "Cleanlooks"){
|
||||
app->setStyle(new QCleanlooksStyle());
|
||||
return;
|
||||
}
|
||||
if(style == "Motif"){
|
||||
app->setStyle(new QMotifStyle());
|
||||
return;
|
||||
}
|
||||
if(style == "CDE"){
|
||||
app->setStyle(new QCDEStyle());
|
||||
return;
|
||||
}
|
||||
#ifdef Q_WS_MAC
|
||||
if(style == "MacOS"){
|
||||
app->setStyle(new QMacStyle());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
if(style == "WinXP"){
|
||||
app->setStyle(new QWindowsXPStyle());
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
app->setStyle(new QPlastiqueStyle());
|
||||
}
|
||||
|
||||
// Main
|
||||
int main(int argc, char *argv[]){
|
||||
QFile file;
|
||||
|
@ -91,16 +123,23 @@ int main(int argc, char *argv[]){
|
|||
return 0;
|
||||
}
|
||||
QApplication app(argc, argv);
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
QString style;
|
||||
#ifdef Q_WS_WIN
|
||||
app.setStyle(new QWindowsXPStyle());
|
||||
style = settings.value("Options/Style", "WinXP").toString();
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
app.setStyle(new QMacStyle());
|
||||
style = settings.value("Options/Style", "MacOS").toString();
|
||||
#endif
|
||||
#ifndef Q_WS_WIN
|
||||
#ifndef Q_WS_MAC
|
||||
style = settings.value("Options/Style", "Plastique").toString();
|
||||
#endif
|
||||
#endif
|
||||
useStyle(&app, style);
|
||||
QSplashScreen *splash = new QSplashScreen(QPixmap(":/Icons/splash.jpg"));
|
||||
splash->show();
|
||||
// Open options file to read locale
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
locale = settings.value("Options/Language/Locale", QString()).toString();
|
||||
QTranslator translator;
|
||||
if(locale.isEmpty()){
|
||||
|
|
|
@ -1532,6 +1532,72 @@
|
|||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupStyle" >
|
||||
<property name="title" >
|
||||
<string>Style (Look 'n Feel)</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioPlastiqueStyle" >
|
||||
<property name="text" >
|
||||
<string>Plastique style (KDE like)</string>
|
||||
</property>
|
||||
<property name="checked" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioCleanlooksStyle" >
|
||||
<property name="text" >
|
||||
<string>Cleanlooks style (GNOME like)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioMotifStyle" >
|
||||
<property name="text" >
|
||||
<string>Motif style (default Qt style on Unix systems)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioCDEStyle" >
|
||||
<property name="text" >
|
||||
<string>CDE style (Common Desktop Environment like)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioMacOSStyle" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>MacOS style (MacOSX only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioWinXPStyle" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>WindowsXP style (WIndows XP only)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
|
|
|
@ -49,6 +49,12 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
#ifdef NO_UPNP
|
||||
groupMainUPnP->setEnabled(false);
|
||||
disableUPnP->setChecked(true);
|
||||
#endif
|
||||
#ifdef Q_WS_WIN
|
||||
radioWinXPStyle->setEnabled(true);
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
radioMacOSStyle->setEnabled(true);
|
||||
#endif
|
||||
// Languages supported
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/united_kingdom.png"))), QString::fromUtf8("English"));
|
||||
|
@ -110,6 +116,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
connect(disableUPLimit, SIGNAL(stateChanged(int)), this, SLOT(disableUpload(int)));
|
||||
connect(disableDLLimit, SIGNAL(stateChanged(int)), this, SLOT(disableDownload(int)));
|
||||
connect(disableDHT, SIGNAL(stateChanged(int)), this, SLOT(disableDHTGroup(int)));
|
||||
#ifndef NO_UPNP
|
||||
connect(disableUPnP, SIGNAL(stateChanged(int)), this, SLOT(disableUPnPGroup(int)));
|
||||
#endif
|
||||
connect(disableRatio, SIGNAL(stateChanged(int)), this, SLOT(disableShareRatio(int)));
|
||||
connect(activateFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int)));
|
||||
connect(enableProxy_checkBox, SIGNAL(stateChanged(int)), this, SLOT(enableProxy(int)));
|
||||
|
@ -158,6 +167,16 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
|||
connect(alwaysOSD, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(someOSD, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(neverOSD, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioPlastiqueStyle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioCleanlooksStyle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioMotifStyle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(radioCDEStyle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
#ifdef Q_WS_WIN
|
||||
connect(radioWinXPStyle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
connect(radioMacOSStyle, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
#endif
|
||||
// Disable apply Button
|
||||
applyButton->setEnabled(false);
|
||||
if(!QSystemTrayIcon::supportsMessages()){
|
||||
|
@ -238,6 +257,7 @@ void options_imp::saveOptions(){
|
|||
settings.setValue("ConfirmOnExit", getConfirmOnExit());
|
||||
settings.setValue("GoToSystray", getGoToSysTrayOnMinimizingWindow());
|
||||
settings.setValue("GoToSystrayOnExit", getGoToSysTrayOnExitingWindow());
|
||||
// End Behaviour group
|
||||
settings.endGroup();
|
||||
settings.setValue("PreviewProgram", getPreviewProgram());
|
||||
// End Misc options
|
||||
|
@ -251,6 +271,8 @@ void options_imp::saveOptions(){
|
|||
settings.setValue("OSDEnabled", 0);
|
||||
}
|
||||
}
|
||||
settings.setValue("Style", getStyle());
|
||||
// End Options group
|
||||
settings.endGroup();
|
||||
// Disable apply Button
|
||||
applyButton->setEnabled(false);
|
||||
|
@ -260,6 +282,46 @@ bool options_imp::isFilteringEnabled() const{
|
|||
return activateFilter->isChecked();
|
||||
}
|
||||
|
||||
QString options_imp::getStyle() const{
|
||||
if(radioPlastiqueStyle->isChecked()) return "Plastique";
|
||||
if(radioCleanlooksStyle->isChecked()) return "Cleanlooks";
|
||||
if(radioMotifStyle->isChecked()) return "Motif";
|
||||
if(radioCDEStyle->isChecked()) return "CDE";
|
||||
if(radioMacOSStyle->isChecked()) return "MacOS";
|
||||
if(radioWinXPStyle->isChecked()) return "WinXP";
|
||||
#ifdef Q_WS_WIN
|
||||
return "WinXP";
|
||||
#endif
|
||||
#ifdef Q_WS_MAC
|
||||
return "MacOS";
|
||||
#endif
|
||||
return "Plastique";
|
||||
}
|
||||
|
||||
void options_imp::setStyle(QString style){
|
||||
if(style == "Cleanlooks"){
|
||||
radioCleanlooksStyle->setChecked(true);
|
||||
return;
|
||||
}
|
||||
if(style == "Motif"){
|
||||
radioMotifStyle->setChecked(true);
|
||||
return;
|
||||
}
|
||||
if(style == "CDE"){
|
||||
radioCDEStyle->setChecked(true);
|
||||
return;
|
||||
}
|
||||
if(style == "MacOS"){
|
||||
radioMacOSStyle->setChecked(true);
|
||||
return;
|
||||
}
|
||||
if(style == "WinXP"){
|
||||
radioWinXPStyle->setChecked(true);
|
||||
return;
|
||||
}
|
||||
radioPlastiqueStyle->setChecked(true);
|
||||
}
|
||||
|
||||
void options_imp::loadOptions(){
|
||||
int value;
|
||||
float floatValue;
|
||||
|
@ -429,9 +491,10 @@ void options_imp::loadOptions(){
|
|||
confirmExit_checkBox->setChecked(settings.value("ConfirmOnExit", true).toBool());
|
||||
check_goToSysTray->setChecked(settings.value("GoToSystray", true).toBool());
|
||||
check_closeToSysTray->setChecked(settings.value("GoToSystrayOnExit", false).toBool());
|
||||
// End Behaviour group
|
||||
settings.endGroup();
|
||||
preview_program->setText(settings.value("PreviewProgram", QString()).toString());
|
||||
// End Misc options
|
||||
// End Misc group
|
||||
settings.endGroup();
|
||||
value = settings.value("OSDEnabled", 1).toInt();
|
||||
if(value == 0){
|
||||
|
@ -443,6 +506,8 @@ void options_imp::loadOptions(){
|
|||
alwaysOSD->setChecked(true);
|
||||
}
|
||||
}
|
||||
setStyle(settings.value("Style", QString()).toString());
|
||||
// End Options group
|
||||
settings.endGroup();
|
||||
// Disable apply Button
|
||||
applyButton->setEnabled(false);
|
||||
|
@ -609,6 +674,16 @@ void options_imp::disableDHTGroup(int checkBoxValue){
|
|||
}
|
||||
}
|
||||
|
||||
void options_imp::disableUPnPGroup(int checkBoxValue){
|
||||
if(checkBoxValue==2){
|
||||
//Disable
|
||||
groupUPnP->setEnabled(false);
|
||||
}else{
|
||||
//enable
|
||||
groupUPnP->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
void options_imp::enableSavePath(int checkBoxValue){
|
||||
if(checkBoxValue==2){
|
||||
//enable
|
||||
|
|
|
@ -79,7 +79,8 @@ class options_imp : public QDialog, private Ui::Dialog{
|
|||
QString getPreviewProgram() const;
|
||||
bool getUseOSDAlways() const;
|
||||
bool getUseOSDWhenHiddenOnly() const;
|
||||
|
||||
QString getStyle() const;
|
||||
void setStyle(QString style);
|
||||
|
||||
protected slots:
|
||||
void on_okButton_clicked();
|
||||
|
@ -93,6 +94,9 @@ class options_imp : public QDialog, private Ui::Dialog{
|
|||
void on_filterBrowse_clicked();
|
||||
void disableDownload(int checkBoxValue);
|
||||
void disableDHTGroup(int checkBoxValue);
|
||||
#ifndef NO_UPNP
|
||||
void disableUPnPGroup(int checkBoxValue);
|
||||
#endif
|
||||
void disableMaxConnecLimit(int);
|
||||
void enableFilter(int checkBoxValue);
|
||||
void disableUpload(int checkBoxValue);
|
||||
|
|
|
@ -11,7 +11,7 @@ TARGET = qbittorrent
|
|||
CONFIG += qt thread x11 network
|
||||
|
||||
# Update this VERSION for each release
|
||||
DEFINES += VERSION=\\\"v0.10.0alpha3\\\"
|
||||
DEFINES += VERSION=\\\"v0.10.0alpha4\\\"
|
||||
DEFINES += VERSION_MAJOR=0
|
||||
DEFINES += VERSION_MINOR=10
|
||||
DEFINES += VERSION_BUGFIX=0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue