fix build
This commit is contained in:
parent
d7574afa0e
commit
41139cd905
4 changed files with 39 additions and 31 deletions
|
@ -10,20 +10,28 @@ ArticleListNotificationModel::ArticleListNotificationModel(QObject* parent)
|
||||||
ArticleListNotificationModel::~ArticleListNotificationModel() {}
|
ArticleListNotificationModel::~ArticleListNotificationModel() {}
|
||||||
|
|
||||||
void ArticleListNotificationModel::setArticles(const QList<Message>& msgs) {
|
void ArticleListNotificationModel::setArticles(const QList<Message>& msgs) {
|
||||||
m_articles = msgs;
|
|
||||||
m_currentPage = 0;
|
m_currentPage = 0;
|
||||||
|
m_articles = msgs;
|
||||||
|
|
||||||
reloadWholeLayout();
|
reloadWholeLayout();
|
||||||
|
emit nextPagePossibleChanged(nextPageAvailable());
|
||||||
|
emit previousPagePossibleChanged(previousPageAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleListNotificationModel::nextPage() {
|
void ArticleListNotificationModel::nextPage() {
|
||||||
emit nextPagePossibleChanged(true);
|
m_currentPage++;
|
||||||
emit previousPagePossibleChanged(true);
|
reloadWholeLayout();
|
||||||
|
|
||||||
|
emit nextPagePossibleChanged(nextPageAvailable());
|
||||||
|
emit previousPagePossibleChanged(previousPageAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ArticleListNotificationModel::previousPage() {
|
void ArticleListNotificationModel::previousPage() {
|
||||||
emit nextPagePossibleChanged(true);
|
m_currentPage--;
|
||||||
emit previousPagePossibleChanged(true);
|
reloadWholeLayout();
|
||||||
|
|
||||||
|
emit nextPagePossibleChanged(nextPageAvailable());
|
||||||
|
emit previousPagePossibleChanged(previousPageAvailable());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ArticleListNotificationModel::rowCount(const QModelIndex& parent) const {
|
int ArticleListNotificationModel::rowCount(const QModelIndex& parent) const {
|
||||||
|
@ -37,6 +45,7 @@ int ArticleListNotificationModel::columnCount(const QModelIndex& parent) const {
|
||||||
QVariant ArticleListNotificationModel::data(const QModelIndex& index, int role) const {
|
QVariant ArticleListNotificationModel::data(const QModelIndex& index, int role) const {
|
||||||
switch (role) {
|
switch (role) {
|
||||||
case Qt::ItemDataRole::DisplayRole:
|
case Qt::ItemDataRole::DisplayRole:
|
||||||
|
case Qt::ItemDataRole::ToolTipRole:
|
||||||
return m_articles.at((m_currentPage * NOTIFICATIONS_PAGE_SIZE) + index.row()).m_title;
|
return m_articles.at((m_currentPage * NOTIFICATIONS_PAGE_SIZE) + index.row()).m_title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,3 +56,11 @@ void ArticleListNotificationModel::reloadWholeLayout() {
|
||||||
emit layoutAboutToBeChanged();
|
emit layoutAboutToBeChanged();
|
||||||
emit layoutChanged();
|
emit layoutChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ArticleListNotificationModel::nextPageAvailable() const {
|
||||||
|
return m_articles.size() - (NOTIFICATIONS_PAGE_SIZE * (m_currentPage + 1)) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ArticleListNotificationModel::previousPageAvailable() const {
|
||||||
|
return m_currentPage > 0;
|
||||||
|
}
|
||||||
|
|
|
@ -29,6 +29,10 @@ class ArticleListNotificationModel : public QAbstractListModel {
|
||||||
void nextPagePossibleChanged(bool possible);
|
void nextPagePossibleChanged(bool possible);
|
||||||
void previousPagePossibleChanged(bool possible);
|
void previousPagePossibleChanged(bool possible);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool nextPageAvailable() const;
|
||||||
|
bool previousPageAvailable() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QList<Message> m_articles;
|
QList<Message> m_articles;
|
||||||
int m_currentPage;
|
int m_currentPage;
|
||||||
|
|
|
@ -75,18 +75,7 @@
|
||||||
<item row="2" column="0" colspan="2">
|
<item row="2" column="0" colspan="2">
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="PlainToolButton" name="m_btnPreviousPage">
|
<widget class="QComboBox" name="m_cmbFeeds"/>
|
||||||
<property name="toolTip">
|
|
||||||
<string>Go to previous page</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="PlainToolButton" name="m_btnNextPage">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Go to next page</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
|
@ -102,20 +91,18 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="m_cmbFeeds"/>
|
<widget class="PlainToolButton" name="m_btnPreviousPage">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Go to previous page</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="PlainToolButton" name="m_btnNextPage">
|
||||||
<property name="orientation">
|
<property name="toolTip">
|
||||||
<enum>Qt::Horizontal</enum>
|
<string>Go to next page</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
</widget>
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="PlainToolButton" name="m_btnOpenArticleList">
|
<widget class="PlainToolButton" name="m_btnOpenArticleList">
|
||||||
|
@ -145,9 +132,9 @@
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>m_btnClose</tabstop>
|
<tabstop>m_btnClose</tabstop>
|
||||||
<tabstop>m_treeArticles</tabstop>
|
<tabstop>m_treeArticles</tabstop>
|
||||||
|
<tabstop>m_cmbFeeds</tabstop>
|
||||||
<tabstop>m_btnPreviousPage</tabstop>
|
<tabstop>m_btnPreviousPage</tabstop>
|
||||||
<tabstop>m_btnNextPage</tabstop>
|
<tabstop>m_btnNextPage</tabstop>
|
||||||
<tabstop>m_cmbFeeds</tabstop>
|
|
||||||
<tabstop>m_btnOpenArticleList</tabstop>
|
<tabstop>m_btnOpenArticleList</tabstop>
|
||||||
<tabstop>m_btnOpenWebBrowser</tabstop>
|
<tabstop>m_btnOpenWebBrowser</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
|
|
|
@ -27,8 +27,8 @@ SettingsNotifications::SettingsNotifications(Settings* settings, QWidget* parent
|
||||||
connect(m_ui.m_rbNativeNotifications, &QRadioButton::toggled, this, &SettingsNotifications::dirtifySettings);
|
connect(m_ui.m_rbNativeNotifications, &QRadioButton::toggled, this, &SettingsNotifications::dirtifySettings);
|
||||||
connect(m_ui.m_rbNativeNotifications, &QRadioButton::toggled, this, &SettingsNotifications::requireRestart);
|
connect(m_ui.m_rbNativeNotifications, &QRadioButton::toggled, this, &SettingsNotifications::requireRestart);
|
||||||
|
|
||||||
connect(m_ui.m_sbScreen, &QSpinBox::valueChanged, this, &SettingsNotifications::dirtifySettings);
|
connect(m_ui.m_sbScreen, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsNotifications::dirtifySettings);
|
||||||
connect(m_ui.m_sbScreen, &QSpinBox::valueChanged, this, &SettingsNotifications::requireRestart);
|
connect(m_ui.m_sbScreen, QOverload<int>::of(&QSpinBox::valueChanged), this, &SettingsNotifications::requireRestart);
|
||||||
|
|
||||||
m_ui.m_sbScreen->setMinimum(-1);
|
m_ui.m_sbScreen->setMinimum(-1);
|
||||||
m_ui.m_sbScreen->setMaximum(QGuiApplication::screens().size() - 1);
|
m_ui.m_sbScreen->setMaximum(QGuiApplication::screens().size() - 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue