Browse Source

- Kept on working on bandwidth allocation per torrent

- Fixed a crash in search engine when systray integration was disabled
adaptive-webui-19844
Christophe Dumez 18 years ago
parent
commit
30aa59f582
  1. 3
      TODO
  2. 11
      src/GUI.cpp
  3. 10
      src/MainWindow.ui
  4. 10
      src/allocationDlg.h
  5. 18
      src/bandwidth_limit.ui
  6. 4
      src/searchEngine.cpp
  7. 3
      src/searchEngine.h

3
TODO

@ -44,4 +44,5 @@
- Use its UPnP/NAT-PMP built-in support instead of ours - Use its UPnP/NAT-PMP built-in support instead of ours
- Use its piece prioritization support - Use its piece prioritization support
- Improve ratio display / calculation / saving / per torrent... - Improve ratio display / calculation / saving / per torrent...
- Allow to set upload / download limit per torrent (right click menu) - Allow to set upload / download limit per torrent (right click menu)
- Use buttonboxes when possible

11
src/GUI.cpp

@ -54,12 +54,14 @@
GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
setupUi(this); setupUi(this);
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(VERSION)); setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(VERSION));
QSettings settings("qBittorrent", "qBittorrent");
systrayIntegration = settings.value("Options/Misc/Behaviour/SystrayIntegration", true).toBool();
// Finished torrents tab // Finished torrents tab
finishedTorrentTab = new FinishedTorrents(this, &BTSession); finishedTorrentTab = new FinishedTorrents(this, &BTSession);
tabs->addTab(finishedTorrentTab, tr("Finished")); tabs->addTab(finishedTorrentTab, tr("Finished"));
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png"))); tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
// Search engine tab // Search engine tab
searchEngine = new SearchEngine(&BTSession, myTrayIcon); searchEngine = new SearchEngine(&BTSession, myTrayIcon, systrayIntegration);
tabs->addTab(searchEngine, tr("Search")); tabs->addTab(searchEngine, tr("Search"));
tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/skin/search.png"))); tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/skin/search.png")));
// RSS tab // RSS tab
@ -87,6 +89,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
actionStart_All->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play_all.png"))); actionStart_All->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play_all.png")));
actionClearLog->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.png"))); actionClearLog->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.png")));
actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png"))); actionPreview_file->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/preview.png")));
//TODO: set icons for Upload/Download limit actions
// actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/help.png"))); // actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/help.png")));
connecStatusLblIcon = new QLabel(); connecStatusLblIcon = new QLabel();
connecStatusLblIcon->setFrameShape(QFrame::NoFrame); connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
@ -157,8 +160,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&))); connect(infoBar, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayInfoBarMenu(const QPoint&)));
// Create tray icon // Create tray icon
if (QSystemTrayIcon::isSystemTrayAvailable()){ if (QSystemTrayIcon::isSystemTrayAvailable()){
QSettings settings("qBittorrent", "qBittorrent");
systrayIntegration = settings.value("Options/Misc/Behaviour/SystrayIntegration", true).toBool();
if(systrayIntegration){ if(systrayIntegration){
createTrayIcon(); createTrayIcon();
} }
@ -295,6 +296,10 @@ void GUI::togglePausedState(const QModelIndex& index){
} }
} }
// void GUI::on_actionSet_download_limit_triggered(){
// new BandwidthAllocationDialog(this,
// }
void GUI::on_actionPreview_file_triggered(){ void GUI::on_actionPreview_file_triggered(){
if(tabs->currentIndex() > 1) return; if(tabs->currentIndex() > 1) return;
bool inDownloadList = true; bool inDownloadList = true;

10
src/MainWindow.ui

@ -530,6 +530,16 @@
<string>Report a bug</string> <string>Report a bug</string>
</property> </property>
</action> </action>
<action name="actionSet_upload_limit" >
<property name="text" >
<string>Set upload limit</string>
</property>
</action>
<action name="actionSet_download_limit" >
<property name="text" >
<string>Set download limit</string>
</property>
</action>
</widget> </widget>
<resources/> <resources/>
<connections/> <connections/>

10
src/allocationDlg.h

@ -58,6 +58,7 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
// val = -1; // val = -1;
// bandwidthSlider->setValue(val); // bandwidthSlider->setValue(val);
// } // }
connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth()));
} }
~BandwidthAllocationDialog(){ ~BandwidthAllocationDialog(){
@ -75,6 +76,15 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
} }
} }
void setBandwidth(){
int val = bandwidthSlider->value();
if(uploadMode)
h.set_upload_limit(val);
else
h.set_download_limit(val);
close();
}
private: private:
bool uploadMode; bool uploadMode;
bittorrent *BTSession; bittorrent *BTSession;

18
src/bandwidth_limit.ui

@ -6,7 +6,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>222</width> <width>222</width>
<height>99</height> <height>129</height>
</rect> </rect>
</property> </property>
<property name="windowTitle" > <property name="windowTitle" >
@ -93,22 +93,6 @@
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>bandwidth_dlg</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>212</x>
<y>77</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>98</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>

4
src/searchEngine.cpp

@ -42,7 +42,7 @@
#define SEARCHHISTORY_MAXSIZE 50 #define SEARCHHISTORY_MAXSIZE 50
SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon) : QWidget(){ SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration) : QWidget(), systrayIntegration(systrayIntegration){
setupUi(this); setupUi(this);
this->BTSession = BTSession; this->BTSession = BTSession;
this->myTrayIcon = myTrayIcon; this->myTrayIcon = myTrayIcon;
@ -526,7 +526,7 @@ void SearchEngine::on_update_nova_button_clicked(){
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
int useOSD = settings.value("Options/OSDEnabled", 1).toInt(); int useOSD = settings.value("Options/OSDEnabled", 1).toInt();
if(useOSD == 1 || (useOSD == 2 && (isMinimized() || isHidden()))) { if(systrayIntegration && (useOSD == 1 || (useOSD == 2 && (isMinimized() || isHidden())))) {
myTrayIcon->showMessage(tr("Search Engine"), tr("Search has finished"), QSystemTrayIcon::Information, TIME_TRAY_BALLOON); myTrayIcon->showMessage(tr("Search Engine"), tr("Search has finished"), QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
} }
if(exitcode){ if(exitcode){

3
src/searchEngine.h

@ -49,9 +49,10 @@ class SearchEngine : public QWidget, public Ui::search_engine{
SearchListDelegate *SearchDelegate; SearchListDelegate *SearchDelegate;
bittorrent *BTSession; bittorrent *BTSession;
QSystemTrayIcon *myTrayIcon; QSystemTrayIcon *myTrayIcon;
bool systrayIntegration;
public: public:
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon); SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration);
~SearchEngine(); ~SearchEngine();
float getNovaVersion(const QString& novaPath) const; float getNovaVersion(const QString& novaPath) const;
QByteArray getNovaChangelog(const QString& novaPath) const; QByteArray getNovaChangelog(const QString& novaPath) const;

Loading…
Cancel
Save