Browse Source

- Allow to change UPnP port while it is enabled

- Allow to change qBT style! (GTK people should like Cleanlooks style)
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
92f840519c
  1. 1
      Changelog
  2. 18
      TODO
  3. 1
      src/GUI.cpp
  4. 3
      src/UPnP.cpp
  5. 4
      src/UPnP.h
  6. 16
      src/bittorrent.cpp
  7. 1
      src/bittorrent.h
  8. BIN
      src/lang/qbittorrent_bg.qm
  9. 665
      src/lang/qbittorrent_bg.ts
  10. BIN
      src/lang/qbittorrent_ca.qm
  11. 671
      src/lang/qbittorrent_ca.ts
  12. BIN
      src/lang/qbittorrent_da.qm
  13. 662
      src/lang/qbittorrent_da.ts
  14. BIN
      src/lang/qbittorrent_de.qm
  15. 668
      src/lang/qbittorrent_de.ts
  16. BIN
      src/lang/qbittorrent_el.qm
  17. 662
      src/lang/qbittorrent_el.ts
  18. BIN
      src/lang/qbittorrent_en.qm
  19. 694
      src/lang/qbittorrent_en.ts
  20. BIN
      src/lang/qbittorrent_es.qm
  21. 662
      src/lang/qbittorrent_es.ts
  22. BIN
      src/lang/qbittorrent_fi.qm
  23. 671
      src/lang/qbittorrent_fi.ts
  24. BIN
      src/lang/qbittorrent_fr.qm
  25. 662
      src/lang/qbittorrent_fr.ts
  26. BIN
      src/lang/qbittorrent_it.qm
  27. 670
      src/lang/qbittorrent_it.ts
  28. BIN
      src/lang/qbittorrent_ko.qm
  29. 662
      src/lang/qbittorrent_ko.ts
  30. BIN
      src/lang/qbittorrent_nb.qm
  31. 661
      src/lang/qbittorrent_nb.ts
  32. BIN
      src/lang/qbittorrent_nl.qm
  33. 671
      src/lang/qbittorrent_nl.ts
  34. BIN
      src/lang/qbittorrent_pl.qm
  35. 659
      src/lang/qbittorrent_pl.ts
  36. BIN
      src/lang/qbittorrent_pt.qm
  37. 661
      src/lang/qbittorrent_pt.ts
  38. BIN
      src/lang/qbittorrent_ro.qm
  39. 675
      src/lang/qbittorrent_ro.ts
  40. BIN
      src/lang/qbittorrent_ru.qm
  41. 662
      src/lang/qbittorrent_ru.ts
  42. BIN
      src/lang/qbittorrent_sk.qm
  43. 661
      src/lang/qbittorrent_sk.ts
  44. BIN
      src/lang/qbittorrent_sv.qm
  45. 661
      src/lang/qbittorrent_sv.ts
  46. BIN
      src/lang/qbittorrent_tr.qm
  47. 671
      src/lang/qbittorrent_tr.ts
  48. BIN
      src/lang/qbittorrent_uk.qm
  49. 662
      src/lang/qbittorrent_uk.ts
  50. BIN
      src/lang/qbittorrent_zh.qm
  51. 661
      src/lang/qbittorrent_zh.ts
  52. BIN
      src/lang/qbittorrent_zh_HK.qm
  53. 674
      src/lang/qbittorrent_zh_HK.ts
  54. 47
      src/main.cpp
  55. 66
      src/options.ui
  56. 77
      src/options_imp.cpp
  57. 6
      src/options_imp.h
  58. 2
      src/src.pro

1
Changelog

@ -2,6 +2,7 @@ @@ -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

@ -28,19 +28,19 @@ @@ -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...)

1
src/GUI.cpp

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

3
src/UPnP.cpp

@ -979,7 +979,8 @@ m_RootDeviceMap(), @@ -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;

4
src/UPnP.h

@ -640,6 +640,7 @@ private: @@ -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: @@ -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; }

16
src/bittorrent.cpp

@ -90,6 +90,22 @@ void bittorrent::enableUPnP(int port){ @@ -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");

1
src/bittorrent.h

@ -121,6 +121,7 @@ class bittorrent : public QObject{ @@ -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:

BIN
src/lang/qbittorrent_bg.qm

Binary file not shown.

665
src/lang/qbittorrent_bg.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_ca.qm

Binary file not shown.

671
src/lang/qbittorrent_ca.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_da.qm

Binary file not shown.

662
src/lang/qbittorrent_da.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_de.qm

Binary file not shown.

668
src/lang/qbittorrent_de.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_el.qm

Binary file not shown.

662
src/lang/qbittorrent_el.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_en.qm

Binary file not shown.

694
src/lang/qbittorrent_en.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_es.qm

Binary file not shown.

662
src/lang/qbittorrent_es.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_fi.qm

Binary file not shown.

671
src/lang/qbittorrent_fi.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_fr.qm

Binary file not shown.

662
src/lang/qbittorrent_fr.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_it.qm

Binary file not shown.

670
src/lang/qbittorrent_it.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_ko.qm

Binary file not shown.

662
src/lang/qbittorrent_ko.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_nb.qm

Binary file not shown.

661
src/lang/qbittorrent_nb.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_nl.qm

Binary file not shown.

671
src/lang/qbittorrent_nl.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_pl.qm

Binary file not shown.

659
src/lang/qbittorrent_pl.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_pt.qm

Binary file not shown.

661
src/lang/qbittorrent_pt.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_ro.qm

Binary file not shown.

675
src/lang/qbittorrent_ro.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_ru.qm

Binary file not shown.

662
src/lang/qbittorrent_ru.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_sk.qm

Binary file not shown.

661
src/lang/qbittorrent_sk.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_sv.qm

Binary file not shown.

661
src/lang/qbittorrent_sv.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_tr.qm

Binary file not shown.

671
src/lang/qbittorrent_tr.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_uk.qm

Binary file not shown.

662
src/lang/qbittorrent_uk.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_zh.qm

Binary file not shown.

661
src/lang/qbittorrent_zh.ts

File diff suppressed because it is too large Load Diff

BIN
src/lang/qbittorrent_zh_HK.qm

Binary file not shown.

674
src/lang/qbittorrent_zh_HK.ts

File diff suppressed because it is too large Load Diff

47
src/main.cpp

@ -28,7 +28,10 @@ @@ -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 @@ @@ -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[]){ @@ -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()){

66
src/options.ui

@ -1532,6 +1532,72 @@ @@ -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" >

77
src/options_imp.cpp

@ -49,6 +49,12 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -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){ @@ -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){ @@ -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(){ @@ -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(){ @@ -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{ @@ -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(){ @@ -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(){ @@ -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){ @@ -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

6
src/options_imp.h

@ -79,7 +79,8 @@ class options_imp : public QDialog, private Ui::Dialog{ @@ -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{ @@ -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);

2
src/src.pro

@ -11,7 +11,7 @@ TARGET = qbittorrent @@ -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…
Cancel
Save