mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-14 16:57:55 +00:00
- Save spitters position to remember them on restart (RSS)
This commit is contained in:
parent
981d7fd5ce
commit
f22c2f8c7b
@ -14,7 +14,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter_2" >
|
<widget class="QSplitter" name="splitter_h" >
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -155,7 +155,7 @@
|
|||||||
<zorder>listStreams</zorder>
|
<zorder>listStreams</zorder>
|
||||||
<zorder></zorder>
|
<zorder></zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="" >
|
<widget class="QWidget" name="layoutWidget" >
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="news_lbl" >
|
<widget class="QLabel" name="news_lbl" >
|
||||||
@ -171,7 +171,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSplitter" name="splitter" >
|
<widget class="QSplitter" name="splitter_v" >
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
@ -180,7 +180,6 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
<zorder>splitter</zorder>
|
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -239,6 +239,26 @@
|
|||||||
item->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/sphere.png")));
|
item->setData(Qt::DecorationRole, QVariant(QIcon(":/Icons/sphere.png")));
|
||||||
updateFeedNbNews(selectedFeedUrl);
|
updateFeedNbNews(selectedFeedUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RSSImp::saveSlidersPosition() {
|
||||||
|
// Remember sliders positions
|
||||||
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
|
settings.setValue("rss/splitter_h", splitter_h->saveState());
|
||||||
|
settings.setValue("rss/splitter_v", splitter_v->saveState());
|
||||||
|
qDebug("Splitters position saved");
|
||||||
|
}
|
||||||
|
|
||||||
|
void RSSImp::restoreSlidersPosition() {
|
||||||
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
|
QByteArray pos_h = settings.value("rss/splitter_h", QByteArray()).toByteArray();
|
||||||
|
if(!pos_h.isNull()) {
|
||||||
|
splitter_h->restoreState(pos_h);
|
||||||
|
}
|
||||||
|
QByteArray pos_v = settings.value("rss/splitter_v", QByteArray()).toByteArray();
|
||||||
|
if(!pos_v.isNull()) {
|
||||||
|
splitter_v->restoreState(pos_v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QTreeWidgetItem* RSSImp::getTreeItemFromUrl(QString url) const{
|
QTreeWidgetItem* RSSImp::getTreeItemFromUrl(QString url) const{
|
||||||
unsigned int nbItems = listStreams->topLevelItemCount();
|
unsigned int nbItems = listStreams->topLevelItemCount();
|
||||||
@ -313,6 +333,11 @@
|
|||||||
selectFirstFeed();
|
selectFirstFeed();
|
||||||
// Refresh all feeds
|
// Refresh all feeds
|
||||||
rssmanager->refreshAll();
|
rssmanager->refreshAll();
|
||||||
|
// Restore sliders position
|
||||||
|
restoreSlidersPosition();
|
||||||
|
// Bind saveSliders slots
|
||||||
|
connect(splitter_v, SIGNAL(splitterMoved(int, int)), this, SLOT(saveSlidersPosition()));
|
||||||
|
connect(splitter_h, SIGNAL(splitterMoved(int, int)), this, SLOT(saveSlidersPosition()));
|
||||||
qDebug("RSSImp constructed");
|
qDebug("RSSImp constructed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ class RSSImp : public QWidget, public Ui::RSS{
|
|||||||
void selectFirstNews();
|
void selectFirstNews();
|
||||||
void updateFeedNbNews(QString url);
|
void updateFeedNbNews(QString url);
|
||||||
void on_actionMark_all_as_read_triggered();
|
void on_actionMark_all_as_read_triggered();
|
||||||
|
void saveSlidersPosition();
|
||||||
|
void restoreSlidersPosition();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RSSImp();
|
RSSImp();
|
||||||
|
Loading…
Reference in New Issue
Block a user