mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
- Do not refresh lists when window is not visible (save cpu)
- Force list refresh on show Event to avoid lag before next UpdateList() timer call
This commit is contained in:
parent
941b8c8d2a
commit
8ed40cc856
16
src/GUI.cpp
16
src/GUI.cpp
@ -205,9 +205,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
checkConnect->start(5000);
|
checkConnect->start(5000);
|
||||||
// Accept drag 'n drops
|
// Accept drag 'n drops
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) {
|
|
||||||
show();
|
|
||||||
}
|
|
||||||
createKeyboardShortcuts();
|
createKeyboardShortcuts();
|
||||||
connecStatusLblIcon = new QLabel();
|
connecStatusLblIcon = new QLabel();
|
||||||
connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
|
connecStatusLblIcon->setFrameShape(QFrame::NoFrame);
|
||||||
@ -238,6 +235,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
QMainWindow::statusBar()->addPermanentWidget(upSpeedLbl);
|
QMainWindow::statusBar()->addPermanentWidget(upSpeedLbl);
|
||||||
QMainWindow::statusBar()->addPermanentWidget(statusSep4);
|
QMainWindow::statusBar()->addPermanentWidget(statusSep4);
|
||||||
QMainWindow::statusBar()->addPermanentWidget(ratioLbl);
|
QMainWindow::statusBar()->addPermanentWidget(ratioLbl);
|
||||||
|
if(!settings.value(QString::fromUtf8("Preferences/General/StartMinimized"), false).toBool()) {
|
||||||
|
show();
|
||||||
|
}
|
||||||
qDebug("GUI Built");
|
qDebug("GUI Built");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -621,6 +621,12 @@ void GUI::on_actionAbout_triggered() {
|
|||||||
new about(this);
|
new about(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::showEvent(QShowEvent *e) {
|
||||||
|
qDebug("** Show Event **");
|
||||||
|
updateLists(true);
|
||||||
|
e->accept();
|
||||||
|
}
|
||||||
|
|
||||||
// Called when we close the program
|
// Called when we close the program
|
||||||
void GUI::closeEvent(QCloseEvent *e) {
|
void GUI::closeEvent(QCloseEvent *e) {
|
||||||
|
|
||||||
@ -1338,7 +1344,8 @@ void GUI::on_actionTorrent_Properties_triggered() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::updateLists() {
|
void GUI::updateLists(bool force) {
|
||||||
|
if(isVisible() || force) {
|
||||||
// update global informations
|
// update global informations
|
||||||
dlSpeedLbl->setText(tr("DL: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1))));
|
dlSpeedLbl->setText(tr("DL: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1))));
|
||||||
upSpeedLbl->setText(tr("UP: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadUploadRate()/1024., 'f', 1))));
|
upSpeedLbl->setText(tr("UP: %1 KiB/s").arg(QString(QByteArray::number(BTSession->getPayloadUploadRate()/1024., 'f', 1))));
|
||||||
@ -1362,6 +1369,7 @@ void GUI::updateLists() {
|
|||||||
downloadingTorrentTab->updateTorrent(h);
|
downloadingTorrentTab->updateTorrent(h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(displaySpeedInTitle) {
|
if(displaySpeedInTitle) {
|
||||||
QString dl_rate = QByteArray::number(BTSession->getSessionStatus().payload_download_rate/1024, 'f', 1);
|
QString dl_rate = QByteArray::number(BTSession->getSessionStatus().payload_download_rate/1024, 'f', 1);
|
||||||
QString up_rate = QByteArray::number(BTSession->getSessionStatus().payload_upload_rate/1024, 'f', 1);
|
QString up_rate = QByteArray::number(BTSession->getSessionStatus().payload_upload_rate/1024, 'f', 1);
|
||||||
|
@ -160,7 +160,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
void finishedTorrent(QTorrentHandle& h) const;
|
void finishedTorrent(QTorrentHandle& h) const;
|
||||||
void addedTorrent(QTorrentHandle& h) const;
|
void addedTorrent(QTorrentHandle& h) const;
|
||||||
void checkedTorrent(QTorrentHandle& h) const;
|
void checkedTorrent(QTorrentHandle& h) const;
|
||||||
void updateLists();
|
void updateLists(bool force=false);
|
||||||
bool initWebUi(QString username, QString password, int port);
|
bool initWebUi(QString username, QString password, int port);
|
||||||
void pauseTorrent(QString hash);
|
void pauseTorrent(QString hash);
|
||||||
void on_actionIncreasePriority_triggered();
|
void on_actionIncreasePriority_triggered();
|
||||||
@ -181,6 +181,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
void showEvent(QShowEvent *);
|
||||||
bool event(QEvent * event);
|
bool event(QEvent * event);
|
||||||
void displayRSSTab(bool enable);
|
void displayRSSTab(bool enable);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user