Another work on feedsmodel.

This commit is contained in:
Martin Rotter 2013-12-19 08:54:31 +01:00
parent a01de7b37d
commit 17d4122a72
6 changed files with 56 additions and 42 deletions

View File

@ -174,25 +174,26 @@ FeedsModelRootItem *FeedsModel::itemForIndex(const QModelIndex &index) {
}
void FeedsModel::changeLayout(QModelIndexList list) {
// TODO: Udělat analyzu pres cachegrind
// esli je lepsi tohle, nebo zakomentovana cast
// zakomentovana cast udela to ze view se dopta na všecky
// polozky
while (!list.isEmpty()) {
QModelIndex ix = list.takeLast();
// Underlying data are changed.
emit dataChanged(index(ix.row(), 0, ix.parent()),
index(ix.row(), FDS_MODEL_COUNTS_INDEX, ix.parent()));
if (ix.parent().isValid()) {
// Make sure that data of parent are changed too.
list.append(ix.parent());
}
}
/*
// NOTE: Take a look at docs about this.
// I have tested that this is LITTLE slower than code above,
// but it is really SIMPLER, so if code above will be buggy, then
// we can use this.
emit layoutAboutToBeChanged();
// TODO: kouknout do dokumentace na signal layoutChanged,
// protoze ten signal layoutAboutToBeChanged by se měl volat PRED
// zmenou dat v modelu
emit layoutChanged();
*/
}

View File

@ -50,7 +50,7 @@ class FeedsModel : public QAbstractItemModel {
FeedsModelRootItem *itemForIndex(const QModelIndex &index);
public slots:
// Signals that ALL data of this model need
// Signals that SOME data of this model need
// to be reloaded by ALL attached views.
void changeLayout(QModelIndexList list);

View File

@ -53,14 +53,11 @@ QString FeedsModelFeed::typeToString(FeedsModelFeed::Type type) {
return QObject::tr("RDF 1.0");
case StandardRss0X:
return QObject::tr("RSS 0.X");
case StandardRss1X:
return QObject::tr("RSS 1.X");
return QObject::tr("RSS 0.90/0.91/0.92");
case StandardRss2X:
default:
return QObject::tr("RSS 2.X");
return QObject::tr("RSS 2.0/2.0.1");
}
}

View File

@ -13,8 +13,7 @@ class ParsingFactory {
public:
// Parses inpute textual data into Message objects.
// NOTE: Input is correctly encoded in Unicode.
QList<Message> parseAsRSS20(const QString &data);
static QList<Message> parseAsRSS20(const QString &data);
};
#endif // PARSINGFACTORY_H

View File

@ -121,6 +121,7 @@ void FormSettings::changeBrowserProgressColor() {
QColorDialog color_dialog(m_initialSettings.m_webBrowserProgress, this);
color_dialog.setWindowTitle(tr("Select color for web browser progress bar"));
color_dialog.setOption(QColorDialog::ShowAlphaChannel);
if (color_dialog.exec() == QDialog::Accepted) {
m_initialSettings.m_webBrowserProgress = color_dialog.selectedColor();
loadWebBrowserColor(m_initialSettings.m_webBrowserProgress);
@ -178,9 +179,9 @@ bool FormSettings::doSaveCheck() {
if (!m_ui->m_shortcuts->areShortcutsUnique()) {
everything_ok = false;
#if QT_VERSION >= 0x050000
resulting_information.append(tr(" some keyboard shortcuts are not unique"));
resulting_information.append(tr(" \u2022 some keyboard shortcuts are not unique"));
#else
resulting_information.append(trUtf8(" some keyboard shortcuts are not unique"));
resulting_information.append(trUtf8(" \u2022 some keyboard shortcuts are not unique"));
#endif
}
@ -188,9 +189,9 @@ bool FormSettings::doSaveCheck() {
m_ui->m_txtExternalBrowserArguments->text().isEmpty()) {
everything_ok = false;
#if QT_VERSION >= 0x050000
resulting_information.append(tr(" external browser is not set"));
resulting_information.append(tr(" \u2022 external browser is not set"));
#else
resulting_information.append(trUtf8(" external browser is not set"));
resulting_information.append(trUtf8(" \u2022 external browser is not set"));
#endif
}
@ -393,9 +394,9 @@ void FormSettings::saveLanguage() {
// Save prompt for restart if language has changed.
if (new_lang != actual_lang) {
#if QT_VERSION >= 0x050000
m_changedDataTexts.append(tr(" language changed"));
m_changedDataTexts.append(tr(" \u2022 language changed"));
#else
m_changedDataTexts.append(trUtf8(" language changed"));
m_changedDataTexts.append(trUtf8(" \u2022 language changed"));
#endif
settings->setValue(APP_CFG_GEN, "language", new_lang);
}
@ -566,9 +567,9 @@ void FormSettings::saveInterface() {
// Check if icon theme was changed.
if (selected_icon_theme != original_icon_theme) {
#if QT_VERSION >= 0x050000
m_changedDataTexts.append(tr(" icon theme changed"));
m_changedDataTexts.append(tr(" \u2022 icon theme changed"));
#else
m_changedDataTexts.append(trUtf8(" icon theme changed"));
m_changedDataTexts.append(trUtf8(" \u2022 icon theme changed"));
#endif
}
@ -579,9 +580,9 @@ void FormSettings::saveInterface() {
if (SkinFactory::getInstance()->getSelectedSkinName() != active_skin.m_baseName) {
SkinFactory::getInstance()->setCurrentSkinName(active_skin.m_baseName);
#if QT_VERSION >= 0x050000
m_changedDataTexts.append(tr(" skin changed"));
m_changedDataTexts.append(tr(" \u2022 skin changed"));
#else
m_changedDataTexts.append(trUtf8(" skin changed"));
m_changedDataTexts.append(trUtf8(" \u2022 skin changed"));
#endif
}
}

View File

@ -863,8 +863,8 @@
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>325</x>
<y>404</y>
<x>334</x>
<y>400</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
@ -895,12 +895,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>261</x>
<y>37</y>
<x>508</x>
<y>102</y>
</hint>
<hint type="destinationlabel">
<x>261</x>
<y>37</y>
<x>419</x>
<y>128</y>
</hint>
</hints>
</connection>
@ -911,12 +911,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>261</x>
<y>37</y>
<x>508</x>
<y>102</y>
</hint>
<hint type="destinationlabel">
<x>261</x>
<y>37</y>
<x>678</x>
<y>128</y>
</hint>
</hints>
</connection>
@ -927,12 +927,12 @@
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>261</x>
<y>37</y>
<x>508</x>
<y>102</y>
</hint>
<hint type="destinationlabel">
<x>261</x>
<y>37</y>
<x>508</x>
<y>151</y>
</hint>
</hints>
</connection>
@ -947,8 +947,24 @@
<y>48</y>
</hint>
<hint type="destinationlabel">
<x>667</x>
<y>54</y>
<x>577</x>
<y>63</y>
</hint>
</hints>
</connection>
<connection>
<sender>m_checkBrowserProgressColor</sender>
<signal>toggled(bool)</signal>
<receiver>m_btnWebBrowserColorSample</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>468</x>
<y>52</y>
</hint>
<hint type="destinationlabel">
<x>664</x>
<y>52</y>
</hint>
</hints>
</connection>