Browse Source

Merge pull request #5928 from Chocobo1/rss-view

Change RSS view layout to horizontal
adaptive-webui-19844
sledgehammer999 8 years ago committed by GitHub
parent
commit
49ed0765e1
  1. 16
      src/base/preferences.cpp
  2. 8
      src/base/preferences.h
  3. 18
      src/gui/rss/rss.ui
  4. 24
      src/gui/rss/rss_imp.cpp

16
src/base/preferences.cpp

@ -1284,7 +1284,7 @@ void Preferences::setRssOpenFolders(const QStringList &folders) @@ -1284,7 +1284,7 @@ void Preferences::setRssOpenFolders(const QStringList &folders)
setValue("Rss/open_folders", folders);
}
QByteArray Preferences::getRssHSplitterState() const
QByteArray Preferences::getRssSideSplitterState() const
{
#ifdef QBT_USES_QT5
return value("Rss/qt5/splitter_h").toByteArray();
@ -1293,7 +1293,7 @@ QByteArray Preferences::getRssHSplitterState() const @@ -1293,7 +1293,7 @@ QByteArray Preferences::getRssHSplitterState() const
#endif
}
void Preferences::setRssHSplitterState(const QByteArray &state)
void Preferences::setRssSideSplitterState(const QByteArray &state)
{
#ifdef QBT_USES_QT5
setValue("Rss/qt5/splitter_h", state);
@ -1302,21 +1302,21 @@ void Preferences::setRssHSplitterState(const QByteArray &state) @@ -1302,21 +1302,21 @@ void Preferences::setRssHSplitterState(const QByteArray &state)
#endif
}
QByteArray Preferences::getRssVSplitterState() const
QByteArray Preferences::getRssMainSplitterState() const
{
#ifdef QBT_USES_QT5
return value("Rss/qt5/splitter_v").toByteArray();
return value("Rss/qt5/splitterMain").toByteArray();
#else
return value("Rss/splitter_v").toByteArray();
return value("Rss/splitterMain").toByteArray();
#endif
}
void Preferences::setRssVSplitterState(const QByteArray &state)
void Preferences::setRssMainSplitterState(const QByteArray &state)
{
#ifdef QBT_USES_QT5
setValue("Rss/qt5/splitter_v", state);
setValue("Rss/qt5/splitterMain", state);
#else
setValue("Rss/splitter_v", state);
setValue("Rss/splitterMain", state);
#endif
}

8
src/base/preferences.h

@ -300,10 +300,10 @@ public: @@ -300,10 +300,10 @@ public:
void setRssHSplitterSizes(const QByteArray &sizes);
QStringList getRssOpenFolders() const;
void setRssOpenFolders(const QStringList &folders);
QByteArray getRssHSplitterState() const;
void setRssHSplitterState(const QByteArray &state);
QByteArray getRssVSplitterState() const;
void setRssVSplitterState(const QByteArray &state);
QByteArray getRssSideSplitterState() const;
void setRssSideSplitterState(const QByteArray &state);
QByteArray getRssMainSplitterState() const;
void setRssMainSplitterState(const QByteArray &state);
QString getSearchColsWidth() const;
void setSearchColsWidth(const QString &width);
QStringList getSearchEngDisabled() const;

18
src/gui/rss/rss.ui

@ -73,7 +73,13 @@ @@ -73,7 +73,13 @@
</layout>
</item>
<item>
<widget class="QSplitter" name="splitter_h">
<widget class="QSplitter" name="splitterSide">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
@ -93,9 +99,15 @@ @@ -93,9 +99,15 @@
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter_v">
<widget class="QSplitter" name="splitterMain">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
<enum>Qt::Horizontal</enum>
</property>
<widget class="QListWidget" name="listArticles">
<property name="contextMenuPolicy">

24
src/gui/rss/rss_imp.cpp

@ -603,20 +603,20 @@ void RSSImp::saveSlidersPosition() @@ -603,20 +603,20 @@ void RSSImp::saveSlidersPosition()
{
// Remember sliders positions
Preferences* const pref = Preferences::instance();
pref->setRssHSplitterState(splitter_h->saveState());
pref->setRssVSplitterState(splitter_v->saveState());
pref->setRssSideSplitterState(splitterSide->saveState());
pref->setRssMainSplitterState(splitterMain->saveState());
qDebug("Splitters position saved");
}
void RSSImp::restoreSlidersPosition()
{
const Preferences* const pref = Preferences::instance();
const QByteArray pos_h = pref->getRssHSplitterState();
if (!pos_h.isEmpty())
splitter_h->restoreState(pos_h);
const QByteArray pos_v = pref->getRssVSplitterState();
if (!pos_v.isEmpty())
splitter_v->restoreState(pos_v);
const QByteArray stateSide = pref->getRssSideSplitterState();
if (!stateSide.isEmpty())
splitterSide->restoreState(stateSide);
const QByteArray stateMain = pref->getRssMainSplitterState();
if (!stateMain.isEmpty())
splitterMain->restoreState(stateMain);
}
void RSSImp::updateItemsInfos(const QList<QTreeWidgetItem*>& items)
@ -704,8 +704,8 @@ RSSImp::RSSImp(QWidget *parent): @@ -704,8 +704,8 @@ RSSImp::RSSImp(QWidget *parent):
rssDownloaderBtn->setIcon(GuiIconProvider::instance()->getIcon("download"));
settingsButton->setIcon(GuiIconProvider::instance()->getIcon("preferences-system"));
m_feedList = new FeedListWidget(splitter_h, m_rssManager);
splitter_h->insertWidget(0, m_feedList);
m_feedList = new FeedListWidget(splitterSide, m_rssManager);
splitterSide->insertWidget(0, m_feedList);
editHotkey = new QShortcut(QKeySequence("F2"), m_feedList, 0, 0, Qt::WidgetShortcut);
connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedRssFile()));
connect(m_feedList, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedRssFile()));
@ -747,8 +747,8 @@ RSSImp::RSSImp(QWidget *parent): @@ -747,8 +747,8 @@ RSSImp::RSSImp(QWidget *parent):
// 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()));
connect(splitterMain, SIGNAL(splitterMoved(int, int)), this, SLOT(saveSlidersPosition()));
connect(splitterSide, SIGNAL(splitterMoved(int, int)), this, SLOT(saveSlidersPosition()));
qDebug("RSSImp constructed");
}

Loading…
Cancel
Save