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(":message"), error->message);
|
||||||
query.bindValue(QStringLiteral(":date"), error->date.toSecsSinceEpoch());
|
query.bindValue(QStringLiteral(":date"), error->date.toSecsSinceEpoch());
|
||||||
Database::instance().execute(query);
|
Database::instance().execute(query);
|
||||||
|
|
||||||
|
// Send signal to display inline error message
|
||||||
|
Q_EMIT newErrorLogged(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ErrorLogModel::clearAll()
|
void ErrorLogModel::clearAll()
|
||||||
|
|
|
@ -34,6 +34,9 @@ public:
|
||||||
public:
|
public:
|
||||||
void monitorErrorMessages(const QString &url, const QString &id, const int errorCode, const QString &errorString);
|
void monitorErrorMessages(const QString &url, const QString &id, const int errorCode, const QString &errorString);
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void newErrorLogged(Error *error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit ErrorLogModel();
|
explicit ErrorLogModel();
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ Kirigami.ScrollablePage {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
Controls.Label {
|
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
|
Layout.fillWidth: true
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font: Kirigami.Theme.smallFont
|
font: Kirigami.Theme.smallFont
|
||||||
|
|
|
@ -21,6 +21,7 @@ Kirigami.ApplicationWindow {
|
||||||
|
|
||||||
property var miniplayerSize: Kirigami.Units.gridUnit * 3 + Kirigami.Units.gridUnit / 6
|
property var miniplayerSize: Kirigami.Units.gridUnit * 3 + Kirigami.Units.gridUnit / 6
|
||||||
property int tabBarHeight: Kirigami.Units.gridUnit * 2
|
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
|
property int tabBarActive: 0
|
||||||
|
|
||||||
Kirigami.PagePool {
|
Kirigami.PagePool {
|
||||||
|
@ -153,6 +154,7 @@ Kirigami.ApplicationWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateNotification {
|
UpdateNotification {
|
||||||
z: 2
|
z: 2
|
||||||
id: updateNotification
|
id: updateNotification
|
||||||
|
@ -160,7 +162,29 @@ Kirigami.ApplicationWindow {
|
||||||
anchors {
|
anchors {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
bottom: parent.bottom
|
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