- 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:
Christophe Dumez 2007-03-28 08:05:37 +00:00
parent e0a0a0beb1
commit 92f840519c
58 changed files with 11121 additions and 4519 deletions

View file

@ -2,6 +2,7 @@
- FEATURE: Added UPnP port forwarding support
- FEATURE: Display more infos about the torrent in its properties
- FEATURE: Allow the user to edit torrents' trackers
- FEATURE: Allow user to change qBT's style (Plastique, Cleanlooks, Motif, CDE, MacOSX, WinXP)
- COSMETIC: Redesigned torrent properties a little
- COSMETIC: Redesigned options a little

18
TODO
View file

@ -28,19 +28,19 @@
- Option to shutdown computer when downloads are finished
- Add a torrent scheduler
// in v0.10 (partial)
- Download from RSS feeds (WIP by gtsoul in RSS_SUPPORT branch)
- Move finished torrent to another tab and keep on seeding them even after restart
// in v0.10 (partial) - WIP
- Download from RSS feeds (WIP by gtsoul in RSS_SUPPORT branch, clean & finish rss.h, merge with trunk, add a tab in mainWindow, debug)
- Move finished torrent to another tab and keep on seeding them even after restart (better for sharing)
- Improve torrent creation dialog (look & features) :
- Add Private combobox (allow to share on DHT or not)
- Use a QListWidget to allow multiple input paths
- Possibility to add url seeds
- Add IPv6 support (at least start working on it)
- UPnP support (debug, sync with aMule CVS)
- Allow user to change application style? (WinXP, MacOS, CleanLooks...) : app.setStyle(new QCleanlooksStyle());
- Add IPv6 support (at least start working on it, libtorrent seems to support it, we should limit our code to IPv4 anymore)
- UPnP support (debug, sync with next aMule release (or CVS)) : seems to be working!
- Update v0.9.0 changelog after its release
- Display Url seeds in torrent properties and allow to edit them
- Improve Ipfilter.dat parser (move to a thread ?)
- Improve Ipfilter.dat parser (move to a thread ? - too slow to load qBT and more importantly options)
- Use tooltips to explain options
- Exit confirmation only if there are active downloads
- Support UPnP port edition
- Exit confirmation only if there are active downloads (display number of downloads) - SMARTER
- Make use of QNetworkInterface (could be useful ?)
- Display more info in log (PeX, UPnP, DHT w/ ports...)

View file

@ -988,6 +988,7 @@ void GUI::configureSession(bool deleteOptions){
// Upnp
if(options->isDHTEnabled()){
BTSession.enableUPnP(options->getUPnPPort());
BTSession.setUPnPPort(options->getUPnPPort());
}else{
BTSession.disableUPnP();
}

View file

@ -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;

View file

@ -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; }

View file

@ -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");

View file

@ -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

View file

@ -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()){

View file

@ -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" >

View file

@ -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

View file

@ -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);

View file

@ -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