aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2013-10-11 00:08:31 +0000
committerubbo <ubbo@34ebc366-c3a9-4b3c-9f84-69acf7962910>2013-10-11 00:08:31 +0000
commit78a63f1eedec71e1fb6a2f353eac33c474e81924 (patch)
tree393599de07b0a57c624d90c2e8954e18def4efec
parentadded QT_NO_DEBUG_OUTPUT and QT_NO_WARNING to gpg4usb.pro and set wizardstyle... (diff)
downloadgpg4usb-78a63f1eedec71e1fb6a2f353eac33c474e81924.tar.gz
gpg4usb-78a63f1eedec71e1fb6a2f353eac33c474e81924.zip
add qmlpage for keydetails, just a test now
git-svn-id: http://cpunk.de/svn/src/gpg4usb/trunk@1043 34ebc366-c3a9-4b3c-9f84-69acf7962910
-rw-r--r--gpg4usb.pro20
-rw-r--r--mainwindow.cpp4
-rw-r--r--qml/keydetails.qml19
-rw-r--r--qmlpage.cpp25
-rw-r--r--qmlpage.h16
-rw-r--r--textedit.cpp7
-rw-r--r--textedit.h2
7 files changed, 91 insertions, 2 deletions
diff --git a/gpg4usb.pro b/gpg4usb.pro
index 63ff7a9..dd0937c 100644
--- a/gpg4usb.pro
+++ b/gpg4usb.pro
@@ -18,6 +18,8 @@ CONFIG += release static
#CONFIG += debug
QT += network
+QT += declarative
+
# Input
include(kgpg/kgpg.pri)
@@ -45,7 +47,8 @@ HEADERS += attachments.h \
wizard.h \
helppage.h \
gpgconstants.h \
- findwidget.h
+ findwidget.h \
+ qmlpage.h
SOURCES += attachments.cpp \
gpgcontext.cpp \
@@ -71,7 +74,8 @@ SOURCES += attachments.cpp \
wizard.cpp \
helppage.cpp \
gpgconstants.cpp \
- findwidget.cpp
+ findwidget.cpp \
+ qmlpage.cpp
RC_FILE = gpg4usb.rc
@@ -95,3 +99,15 @@ TRANSLATIONS = release/ts/gpg4usb_en.ts \
contains(DEFINES, GPG4USB_NON_PORTABLE) {
message(Building non portable version...)
}
+
+OTHER_FILES += \
+ qml/keydetails.qml
+
+# http://stackoverflow.com/questions/3984104/qmake-how-to-copy-a-file-to-the-output
+#unix {
+ for(FILE, OTHER_FILES){
+# QMAKE_POST_LINK += $$quote(cp $${PWD}/$${FILE} $${DESTDIR}$$escape_expand(\\n\\t))
+ QMAKE_POST_LINK += $$QMAKE_COPY $$quote($$FILE) $$quote($$DESTDIR) $$escape_expand(\\n\\t)
+# INSTALLS += $$QMAKE_COPY $$quote($$FILE) $$quote($$DESTDIR) $$escape_expand(\\n\\t)
+}
+
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 9eacc91..674be9f 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1255,10 +1255,14 @@ void MainWindow::slotShowKeyDetails()
return;
}
+ // TODO: get qml working here ;-)
+ edit->slotNewQMLTab("KeyDetailsQML", "TODO");
+
KgpgCore::KgpgKey key = mCtx->getKeyDetails(mKeyList->getSelected()->first());
if (key.id() != "") {
new KeyDetailsDialog(mCtx, key, this);
}
+
}
void MainWindow::slotRefreshKeysFromKeyserver()
diff --git a/qml/keydetails.qml b/qml/keydetails.qml
new file mode 100644
index 0000000..f250ba0
--- /dev/null
+++ b/qml/keydetails.qml
@@ -0,0 +1,19 @@
+import QtQuick 1.1
+
+Rectangle {
+ width: 400 //these are the only explicit sizes set
+ height: 400 //all others are relative
+
+ anchors.fill: parent
+
+ //color: "red"
+ Text {
+ // qsTr() for internationalisation, like tr()
+ text: qsTr("var1:")
+ }
+ Text {
+ x: 54
+ y: 0
+ text: var1
+ }
+}
diff --git a/qmlpage.cpp b/qmlpage.cpp
new file mode 100644
index 0000000..eafb0af
--- /dev/null
+++ b/qmlpage.cpp
@@ -0,0 +1,25 @@
+#include "qmlpage.h"
+#include <QtDeclarative/QDeclarativeView>
+#include <QVBoxLayout>
+#include <QDebug>
+#include <QDeclarativeContext>
+
+
+QMLPage::QMLPage(const QString qmlfile, QWidget *parent) :
+ QWidget(parent)
+{
+
+ // http://harmattan-dev.nokia.com/docs/library/html/qt4/qml-integration.html
+ QDeclarativeView *qmlView = new QDeclarativeView;
+ qmlView->setSource(QUrl::fromLocalFile("keydetails.qml"));
+
+ QDeclarativeContext *context = qmlView->rootContext();
+ context->setContextProperty("var1", "derText");
+
+ qDebug() << "qml:::::" << QUrl::fromLocalFile("keydetails.qml");
+
+
+ //QWidget *widget = myExistingWidget();
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->addWidget(qmlView);
+}
diff --git a/qmlpage.h b/qmlpage.h
new file mode 100644
index 0000000..578f79d
--- /dev/null
+++ b/qmlpage.h
@@ -0,0 +1,16 @@
+#ifndef QMLPAGE_H
+#define QMLPAGE_H
+
+#include <QWidget>
+
+class QMLPage : public QWidget
+{
+
+ Q_OBJECT
+
+public:
+ QMLPage(const QString qmlfile, QWidget *parent = 0);
+
+};
+
+#endif // QMLPAGE_H
diff --git a/textedit.cpp b/textedit.cpp
index 98d974f..e40a4af 100644
--- a/textedit.cpp
+++ b/textedit.cpp
@@ -20,6 +20,7 @@
*/
#include "textedit.h"
+#include "qmlpage.h"
TextEdit::TextEdit()
{
@@ -65,6 +66,12 @@ void TextEdit::slotNewHelpTab(QString title, QString path)
}
+void TextEdit::slotNewQMLTab(QString title, QString qmlfile) {
+ QMLPage *page = new QMLPage(qmlfile);
+ tabWidget->addTab(page, title);
+ tabWidget->setCurrentIndex(tabWidget->count() - 1);
+}
+
void TextEdit::slotOpen()
{
QStringList fileNames = QFileDialog::getOpenFileNames(this, tr("Open file"),
diff --git a/textedit.h b/textedit.h
index 8fa2b33..b5afb07 100644
--- a/textedit.h
+++ b/textedit.h
@@ -147,6 +147,8 @@ public slots:
*/
void slotNewHelpTab(QString title, QString path);
+ void slotNewQMLTab(QString title, QString qmlfile);
+
/**
* @details put a * in front of current tabs title, if current textedit is modified
*/