move info label to own class, move dialog to own class as well

This commit is contained in:
Evgenii Alekseev 2016-10-17 23:12:03 +03:00
parent 9d5864aa62
commit 63d19f038c
6 changed files with 48 additions and 17 deletions

View File

@ -8,6 +8,7 @@ singleton general 1.0 file:///usr/share/awesomewidgets/qml/general.qml
# custom QML UI classes # custom QML UI classes
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml
BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml

View File

@ -17,7 +17,6 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.2 as QtDialogs
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
import "." import "."
@ -53,14 +52,7 @@ Item {
id: pageColumn id: pageColumn
anchors.fill: parent anchors.fill: parent
QtControls.Label { AWInfoLabel {}
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
text: i18n("Detailed information may be found on <a href=\"https://arcanis.me/projects/awesome-widgets/\">project homepage</a>")
onLinkActivated: Qt.openUrlExternally(link)
}
HtmlDefaultFunctionsBar { HtmlDefaultFunctionsBar {
textArea: textPattern textArea: textPattern
@ -74,6 +66,7 @@ Item {
} }
AWExtensions { AWExtensions {
id: extensions
backend: awKeys backend: awKeys
textArea: textPattern textArea: textPattern
onUnlock: lock = false onUnlock: lock = false
@ -88,12 +81,6 @@ Item {
} }
} }
QtDialogs.MessageDialog {
id: compiledText
modality: Qt.NonModal
title: i18n("Preview")
}
Component.onCompleted: { Component.onCompleted: {
if (debug) console.debug() if (debug) console.debug()
@ -114,8 +101,7 @@ Item {
if (lock) return if (lock) return
if (debug) console.debug() if (debug) console.debug()
compiledText.text = newText.replace("&nbsp;", " ") extensions.showMessage(newText)
compiledText.open()
lock = true lock = true
} }
} }

View File

@ -8,6 +8,7 @@ singleton general 1.0 file:///usr/share/awesomewidgets/qml/general.qml
# custom QML UI classes # custom QML UI classes
AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml AboutTab file:///usr/share/awesomewidgets/qml/AboutTab.qml
AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml AWExtensions file:///usr/share/awesomewidgets/qml/AWExtensions.qml
AWInfoLabel file:///usr/share/awesomewidgets/qml/AWInfoLabel.qml
AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml AWTagSelector file:///usr/share/awesomewidgets/qml/AWTagSelector.qml
BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml BugReport file:///usr/share/awesomewidgets/qml/BugReport.qml
ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml ButtonSelector file:///usr/share/awesomewidgets/qml/ButtonSelector.qml

View File

@ -17,6 +17,7 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls import QtQuick.Controls 1.3 as QtControls
import QtQuick.Dialogs 1.2 as QtDialogs
import org.kde.plasma.private.awesomewidget 1.0 import org.kde.plasma.private.awesomewidget 1.0
@ -34,6 +35,7 @@ Row {
property var textArea property var textArea
signal unlock signal unlock
signal showMessage(string message)
QtControls.Button { QtControls.Button {
width: parent.width * 3 / 10 width: parent.width * 3 / 10
@ -73,4 +75,15 @@ Row {
} }
} }
} }
QtDialogs.MessageDialog {
id: compiledText
modality: Qt.NonModal
title: i18n("Preview")
}
onShowMessage: {
compiledText.text = message.replace("&nbsp;", " ")
compiledText.open()
}
} }

View File

@ -0,0 +1,29 @@
/***************************************************************************
* This file is part of awesome-widgets *
* *
* awesome-widgets is free software: you can redistribute it and/or *
* modify it under the terms of the GNU General Public License as *
* published by the Free Software Foundation, either version 3 of the *
* License, or (at your option) any later version. *
* *
* awesome-widgets is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
***************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.3 as QtControls
QtControls.Label {
width: parent.width
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
text: i18n("Detailed information may be found on <a href=\"https://arcanis.me/projects/awesome-widgets/\">project homepage</a>")
onLinkActivated: Qt.openUrlExternally(link)
}

View File

@ -8,6 +8,7 @@ singleton general 1.0 file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_
# custom QML UI classes # custom QML UI classes
AboutTab file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AboutTab.qml AboutTab file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AboutTab.qml
AWExtensions file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWExtensions.qml AWExtensions file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWExtensions.qml
AWInfoLabel file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWInfoLabel.qml
AWTagSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWTagSelector.qml AWTagSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/AWTagSelector.qml
BugReport file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/BugReport.qml BugReport file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/BugReport.qml
ButtonSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ButtonSelector.qml ButtonSelector file://@CMAKE_INSTALL_PREFIX@/@DATA_INSTALL_DIR@/@PROJECT_NAME@/qml/ButtonSelector.qml