mirror of https://github.com/KDE/kasts.git
Implement InlineMessage displaying download/update errors
This commit is contained in:
parent
506a419aff
commit
a7bac204ad
|
@ -73,6 +73,9 @@ void ErrorLogModel::monitorErrorMessages(const QString &url, const QString &id,
|
|||
query.bindValue(QStringLiteral(":message"), error->message);
|
||||
query.bindValue(QStringLiteral(":date"), error->date.toSecsSinceEpoch());
|
||||
Database::instance().execute(query);
|
||||
|
||||
// Send signal to display inline error message
|
||||
Q_EMIT newErrorLogged(error);
|
||||
}
|
||||
|
||||
void ErrorLogModel::clearAll()
|
||||
|
|
|
@ -34,6 +34,9 @@ public:
|
|||
public:
|
||||
void monitorErrorMessages(const QString &url, const QString &id, const int errorCode, const QString &errorString);
|
||||
|
||||
Q_SIGNALS:
|
||||
void newErrorLogged(Error *error);
|
||||
|
||||
private:
|
||||
explicit ErrorLogModel();
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ Kirigami.ScrollablePage {
|
|||
Layout.fillWidth: true
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Controls.Label {
|
||||
text: ( (error.id) ? i18n("Media download") : i18n("Feed update error") ) + " · " + error.date.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + " · " + error.date.toLocaleTimeString(Qt.locale(), Locale.NarrowFormat)
|
||||
text: ( (error.id) ? i18n("Media download error") : i18n("Feed update error") ) + " · " + error.date.toLocaleDateString(Qt.locale(), Locale.NarrowFormat) + " · " + error.date.toLocaleTimeString(Qt.locale(), Locale.NarrowFormat)
|
||||
Layout.fillWidth: true
|
||||
elide: Text.ElideRight
|
||||
font: Kirigami.Theme.smallFont
|
||||
|
|
|
@ -21,6 +21,7 @@ Kirigami.ApplicationWindow {
|
|||
|
||||
property var miniplayerSize: Kirigami.Units.gridUnit * 3 + Kirigami.Units.gridUnit / 6
|
||||
property int tabBarHeight: Kirigami.Units.gridUnit * 2
|
||||
property int bottomMessageSpacing: Kirigami.Units.largeSpacing * 9 + ( audio.entry ? ( footerLoader.item.contentY == 0 ? miniplayerSize : 0 ) : 0 ) + tabBarActive * tabBarHeight
|
||||
property int tabBarActive: 0
|
||||
|
||||
Kirigami.PagePool {
|
||||
|
@ -153,6 +154,7 @@ Kirigami.ApplicationWindow {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
UpdateNotification {
|
||||
z: 2
|
||||
id: updateNotification
|
||||
|
@ -160,7 +162,29 @@ Kirigami.ApplicationWindow {
|
|||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
bottomMargin: Kirigami.Units.largeSpacing * 9 + ( audio.entry ? ( footerLoader.item.contentY == 0 ? miniplayerSize : 0 ) : 0 ) + tabBarActive * tabBarHeight
|
||||
bottomMargin: bottomMessageSpacing
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.InlineMessage {
|
||||
id: inlineMessage
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
right: parent.right
|
||||
left: parent.left
|
||||
margins: Kirigami.Units.gridUnit
|
||||
bottomMargin: bottomMessageSpacing + ( updateNotification.visible ? updateNotification.height + Kirigami.Units.largeSpacing : 0 )
|
||||
}
|
||||
type: Kirigami.MessageType.Error
|
||||
showCloseButton: true
|
||||
|
||||
Connections {
|
||||
target: ErrorLogModel
|
||||
function onNewErrorLogged(error) {
|
||||
inlineMessage.text = error.id ? i18n("Media download error") : i18n("Feed update error") + "\n" + i18n("Check Error Log tab (under Downloads) for more details.");
|
||||
inlineMessage.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue