mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-15 08:01:05 +08:00
- Kept on working on bandwidth allocation per torrent
- Fixed a crash in search engine when systray integration was disabled
This commit is contained in:
parent
3933d78da2
commit
30aa59f582
3
TODO
3
TODO
@ -44,4 +44,5 @@
|
||||
- Use its UPnP/NAT-PMP built-in support instead of ours
|
||||
- Use its piece prioritization support
|
||||
- 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
11
src/GUI.cpp
@ -54,12 +54,14 @@
|
||||
GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
||||
setupUi(this);
|
||||
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
|
||||
finishedTorrentTab = new FinishedTorrents(this, &BTSession);
|
||||
tabs->addTab(finishedTorrentTab, tr("Finished"));
|
||||
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
||||
// Search engine tab
|
||||
searchEngine = new SearchEngine(&BTSession, myTrayIcon);
|
||||
searchEngine = new SearchEngine(&BTSession, myTrayIcon, systrayIntegration);
|
||||
tabs->addTab(searchEngine, tr("Search"));
|
||||
tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/skin/search.png")));
|
||||
// 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")));
|
||||
actionClearLog->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/delete.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")));
|
||||
connecStatusLblIcon = new QLabel();
|
||||
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&)));
|
||||
// Create tray icon
|
||||
if (QSystemTrayIcon::isSystemTrayAvailable()){
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
systrayIntegration = settings.value("Options/Misc/Behaviour/SystrayIntegration", true).toBool();
|
||||
if(systrayIntegration){
|
||||
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(){
|
||||
if(tabs->currentIndex() > 1) return;
|
||||
bool inDownloadList = true;
|
||||
|
@ -530,6 +530,16 @@
|
||||
<string>Report a bug</string>
|
||||
</property>
|
||||
</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>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -58,6 +58,7 @@ class BandwidthAllocationDialog : public QDialog, private Ui_bandwidth_dlg {
|
||||
// val = -1;
|
||||
// bandwidthSlider->setValue(val);
|
||||
// }
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(setBandwidth()));
|
||||
}
|
||||
|
||||
~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:
|
||||
bool uploadMode;
|
||||
bittorrent *BTSession;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>222</width>
|
||||
<height>99</height>
|
||||
<height>129</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
@ -93,22 +93,6 @@
|
||||
</widget>
|
||||
<resources/>
|
||||
<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>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
#define SEARCHHISTORY_MAXSIZE 50
|
||||
|
||||
SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon) : QWidget(){
|
||||
SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration) : QWidget(), systrayIntegration(systrayIntegration){
|
||||
setupUi(this);
|
||||
this->BTSession = BTSession;
|
||||
this->myTrayIcon = myTrayIcon;
|
||||
@ -526,7 +526,7 @@ void SearchEngine::on_update_nova_button_clicked(){
|
||||
void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){
|
||||
QSettings settings("qBittorrent", "qBittorrent");
|
||||
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);
|
||||
}
|
||||
if(exitcode){
|
||||
|
@ -49,9 +49,10 @@ class SearchEngine : public QWidget, public Ui::search_engine{
|
||||
SearchListDelegate *SearchDelegate;
|
||||
bittorrent *BTSession;
|
||||
QSystemTrayIcon *myTrayIcon;
|
||||
bool systrayIntegration;
|
||||
|
||||
public:
|
||||
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon);
|
||||
SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration);
|
||||
~SearchEngine();
|
||||
float getNovaVersion(const QString& novaPath) const;
|
||||
QByteArray getNovaChangelog(const QString& novaPath) const;
|
||||
|
Loading…
Reference in New Issue
Block a user