mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
- Made properties window a bit larger
- Remember properties window size and position on startup
This commit is contained in:
parent
dc651ffed3
commit
54225cd42f
3 changed files with 39 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>538</width>
|
<width>594</width>
|
||||||
<height>567</height>
|
<height>567</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QStandardItemModel>
|
#include <QStandardItemModel>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h): QDialog(parent), h(h), BTSession(BTSession), changedFilteredfiles(false), hash(h.hash()) {
|
properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h): QDialog(parent), h(h), BTSession(BTSession), changedFilteredfiles(false), hash(h.hash()) {
|
||||||
|
@ -118,6 +120,7 @@ properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h
|
||||||
updateInfosTimer = new QTimer(this);
|
updateInfosTimer = new QTimer(this);
|
||||||
connect(updateInfosTimer, SIGNAL(timeout()), this, SLOT(updateInfos()));
|
connect(updateInfosTimer, SIGNAL(timeout()), this, SLOT(updateInfos()));
|
||||||
updateInfosTimer->start(3000);
|
updateInfosTimer->start(3000);
|
||||||
|
loadSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
properties::~properties(){
|
properties::~properties(){
|
||||||
|
@ -155,6 +158,36 @@ void properties::addFilesToTree(file *root, QStandardItem *parent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void properties::writeSettings() {
|
||||||
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
|
settings.beginGroup(QString::fromUtf8("PropWindow"));
|
||||||
|
settings.setValue(QString::fromUtf8("size"), size());
|
||||||
|
settings.setValue(QString::fromUtf8("pos"), pos());
|
||||||
|
settings.endGroup();
|
||||||
|
}
|
||||||
|
|
||||||
|
void properties::loadSettings() {
|
||||||
|
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
|
resize(settings.value(QString::fromUtf8("PropWindow/size"), size()).toSize());
|
||||||
|
move(settings.value(QString::fromUtf8("PropWindow/pos"), screenCenter()).toPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Center window
|
||||||
|
QPoint properties::screenCenter() const{
|
||||||
|
int scrn = 0;
|
||||||
|
QWidget *w = this->topLevelWidget();
|
||||||
|
|
||||||
|
if(w)
|
||||||
|
scrn = QApplication::desktop()->screenNumber(w);
|
||||||
|
else if(QApplication::desktop()->isVirtualDesktop())
|
||||||
|
scrn = QApplication::desktop()->screenNumber(QCursor::pos());
|
||||||
|
else
|
||||||
|
scrn = QApplication::desktop()->screenNumber(this);
|
||||||
|
|
||||||
|
QRect desk(QApplication::desktop()->availableGeometry(scrn));
|
||||||
|
return QPoint((desk.width() - this->frameGeometry().width()) / 2, (desk.height() - this->frameGeometry().height()) / 2);
|
||||||
|
}
|
||||||
|
|
||||||
// priority is the new priority of given item
|
// priority is the new priority of given item
|
||||||
void properties::updateParentsPriority(QStandardItem *item, int priority) {
|
void properties::updateParentsPriority(QStandardItem *item, int priority) {
|
||||||
QStandardItem *parent = item->parent();
|
QStandardItem *parent = item->parent();
|
||||||
|
|
|
@ -74,6 +74,8 @@ class properties : public QDialog, private Ui::properties{
|
||||||
void updateParentsPriority(QStandardItem *item, int priority);
|
void updateParentsPriority(QStandardItem *item, int priority);
|
||||||
void updatePriorities(QStandardItem *item);
|
void updatePriorities(QStandardItem *item);
|
||||||
void getPriorities(QStandardItem *parent, int *priorities);
|
void getPriorities(QStandardItem *parent, int *priorities);
|
||||||
|
void writeSettings();
|
||||||
|
void loadSettings();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void filteredFilesChanged(QString hash);
|
void filteredFilesChanged(QString hash);
|
||||||
|
@ -86,6 +88,9 @@ class properties : public QDialog, private Ui::properties{
|
||||||
bool allFiltered() const;
|
bool allFiltered() const;
|
||||||
bool savePiecesPriorities();
|
bool savePiecesPriorities();
|
||||||
int* loadPiecesPriorities();
|
int* loadPiecesPriorities();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QPoint screenCenter() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue