marcin 2014-07-16 14:40:09 +02:00
parent 855d5736c5
commit 2eddebe1c2
15 changed files with 98 additions and 27 deletions

View file

@ -34,15 +34,15 @@ Rectangle {
Image {
id: logo
anchors.horizontalCenter: parent.horizontalCenter
anchors.left: parent.left
anchors.leftMargin: 50
source: "images/moneroLogo.png"
}
Image {
anchors.right: logo.left
anchors.left: parent.left
anchors.verticalCenter: logo.verticalCenter
anchors.verticalCenterOffset: 5
anchors.rightMargin: 20
anchors.leftMargin: 19
source: appWindow.rightPanelExpanded ? "images/expandRightPanel.png" :
"images/collapseRightPanel.png"
}

View file

@ -3,7 +3,8 @@ TEMPLATE = app
QT += qml quick widgets
SOURCES += main.cpp \
filter.cpp
filter.cpp \
clipboardAdapter.cpp
RESOURCES += qml.qrc
@ -14,4 +15,5 @@ QML_IMPORT_PATH =
include(deployment.pri)
HEADERS += \
filter.h
filter.h \
clipboardAdapter.h

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.1.2, 2014-07-16T10:51:34. -->
<!-- Written by QtCreator 3.1.2, 2014-07-16T14:38:55. -->
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>

12
clipboardAdapter.cpp Normal file
View file

@ -0,0 +1,12 @@
#include "clipboardAdapter.h"
clipboardAdapter::clipboardAdapter(QObject *parent) :
QObject(parent)
{
m_pClipboard = QGuiApplication::clipboard();
}
void clipboardAdapter::setText(const QString &text) {
m_pClipboard->setText(text, QClipboard::Clipboard);
m_pClipboard->setText(text, QClipboard::Selection);
}

19
clipboardAdapter.h Normal file
View file

@ -0,0 +1,19 @@
#ifndef CLIPBOARDADAPTER_H
#define CLIPBOARDADAPTER_H
#include <QGuiApplication>
#include <QClipboard>
#include <QObject>
class clipboardAdapter : public QObject
{
Q_OBJECT
public:
explicit clipboardAdapter(QObject *parent = 0);
Q_INVOKABLE void setText(const QString &text);
private:
QClipboard *m_pClipboard;
};
#endif // CLIPBOARDADAPTER_H

View file

@ -1,5 +1,6 @@
import QtQuick 2.0
import "../components"
import moneroComponents 1.0
ListView {
id: listView
@ -36,30 +37,39 @@ ListView {
}
Text {
id: paymentIdText
width: text.length ? 120 : 0
id: descriptionText
width: text.length ? (descriptionArea.containsMouse ? parent.width - x - 12 : 120) : 0
anchors.verticalCenter: dot.verticalCenter
font.family: "Arial"
font.bold: true
font.pixelSize: 19
color: "#444444"
elide: Text.ElideRight
text: paymentId
text: description
MouseArea {
id: descriptionArea
anchors.fill: parent
hoverEnabled: true
}
}
Item { //separator
width: paymentIdText.width ? 12 : 0
width: descriptionText.width ? 12 : 0
height: 14
visible: !descriptionArea.containsMouse
}
Text {
id: addressText
anchors.verticalCenter: dot.verticalCenter
width: parent.width - x - 12
elide: Text.ElideRight
font.family: "Arial"
font.pixelSize: 14
color: "#545454"
text: description.length > 0 ? description : address
text: address
visible: !descriptionArea.containsMouse
}
}
@ -173,12 +183,22 @@ ListView {
color: "#DBDBDB"
}
ListModel {
id: dropModel
ListElement { name: "<b>Copy address to clipboard</b>"; icon: "../images/dropdownCopy.png" }
ListElement { name: "<b>Add to address book</b>"; icon: "../images/dropdownAdd.png" }
ListElement { name: "<b>Send to same destination</b>"; icon: "../images/dropdownSend.png" }
ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
}
Clipboard { id: clipboard }
TableDropdown {
id: dropdown
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: 11
anchors.rightMargin: 5
dataModel: dropModel
onExpandedChanged: {
if(listView.previousItem !== undefined && listView.previousItem !== delegate)
listView.previousItem.collapseDropdown()
@ -189,6 +209,10 @@ ListView {
}
}
onCollapsed: delegate.z = 0
onOptionClicked: {
if(option === 0)
clipboard.setText(address)
}
}
}
}

View file

@ -3,8 +3,9 @@ import QtQuick 2.0
Item {
id: dropdown
property bool expanded: false
property alias dataModel: repeater.model
signal collapsed()
signal optionClicked(int index)
signal optionClicked(int option)
width: 72
height: 37
@ -115,17 +116,8 @@ Item {
anchors.right: parent.right
anchors.top: parent.top
ListModel {
id: dataModel
ListElement { name: "<b>Add to adress book</b>"; icon: "../images/dropdownOption1.png" }
ListElement { name: "<b>Send to same destination</b>"; icon: "../images/dropdownSend.png" }
ListElement { name: "<b>Find similar transactions</b>"; icon: "../images/dropdownSearch.png" }
}
Repeater {
id: repeater
model: dataModel
delegate: Rectangle {
id: delegate
anchors.left: parent.left
@ -163,7 +155,7 @@ Item {
anchors.fill: parent
propagateComposedEvents: true
onEntered: {
var pos = appWindow.mapFromItem(delegate, 30, -20)
var pos = rootItem.mapFromItem(delegate, 30, -20)
tipItem.text = name
tipItem.x = pos.x
if(tipItem.height > 30)

View file

@ -9,6 +9,15 @@ Rectangle {
property int mouseX: 0
property int mouseY: 0
Text {
anchors.centerIn: parent
font.family: "Arial"
font.pixelSize: 15
font.letterSpacing: -1
color: "#FFFFFF"
text: qsTr("Monero")
}
Behavior on y {
NumberAnimation { duration: 100; easing.type: Easing.InQuad }
}

View file

@ -25,6 +25,10 @@ bool filter::eventFilter(QObject *obj, QEvent *ev) {
QKeySequence ks(ke->modifiers() + ke->key());
sks = ks.toString();
}
#ifndef Q_OS_MAC
if(sks.contains("Alt+Tab") || sks.contains("Alt+Shift+Backtab"))
break;
#endif
emit sequencePressed(QVariant::fromValue<QObject*>(obj), sks);
} break;
case QEvent::KeyRelease: {
@ -39,6 +43,10 @@ bool filter::eventFilter(QObject *obj, QEvent *ev) {
QKeySequence ks(ke->modifiers() + ke->key());
sks = ks.toString();
}
#ifndef Q_OS_MAC
if(sks.contains("Alt+Tab") || sks.contains("Alt+Shift+Backtab"))
break;
#endif
emit sequenceReleased(QVariant::fromValue<QObject*>(obj), sks);
} break;
case QEvent::MouseButtonPress: {

View file

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 384 B

BIN
images/dropdownCopy.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -1,6 +1,7 @@
#include <QApplication>
#include <QQmlApplicationEngine>
#include <QtQml>
#include "clipboardAdapter.h"
#include "filter.h"
int main(int argc, char *argv[])
@ -9,6 +10,8 @@ int main(int argc, char *argv[])
filter *eventFilter = new filter;
app.installEventFilter(eventFilter);
qmlRegisterType<clipboardAdapter>("moneroComponents", 1, 0, "Clipboard");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:///main.qml")));
QObject *rootObject = engine.rootObjects().first();

View file

@ -11,6 +11,7 @@ ApplicationWindow {
property bool whatIsEnable: false
property bool ctrlPressed: false
property bool rightPanelExpanded: true
property bool osx: false
function altKeyReleased() { ctrlPressed = false; }
function showPageRequest(page) {
@ -31,14 +32,14 @@ ApplicationWindow {
else if(seq === "Ctrl+B") middlePanel.state = "AddressBook"
else if(seq === "Ctrl+M") middlePanel.state = "Mining"
else if(seq === "Ctrl+S") middlePanel.state = "Settings"
else if(seq === "Ctrl+Tab") {
else if(seq === "Ctrl+Tab" || seq === "Alt+Tab") {
if(middlePanel.state === "Dashboard") middlePanel.state = "Transfer"
else if(middlePanel.state === "Transfer") middlePanel.state = "History"
else if(middlePanel.state === "History") middlePanel.state = "AddressBook"
else if(middlePanel.state === "AddressBook") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "Settings"
else if(middlePanel.state === "Settings") middlePanel.state = "Dashboard"
} else if(seq === "Ctrl+Shift+Backtab") {
} else if(seq === "Ctrl+Shift+Backtab" || seq === "Alt+Shift+Backtab") {
if(middlePanel.state === "Dashboard") middlePanel.state = "Settings"
else if(middlePanel.state === "Settings") middlePanel.state = "Mining"
else if(middlePanel.state === "Mining") middlePanel.state = "AddressBook"

View file

@ -41,7 +41,7 @@
<file>components/DashboardTable.qml</file>
<file>components/TableDropdown.qml</file>
<file>images/tableOptions.png</file>
<file>images/dropdownOption1.png</file>
<file>images/dropdownAdd.png</file>
<file>images/dropdownSearch.png</file>
<file>images/dropdownSend.png</file>
<file>components/TipItem.qml</file>
@ -69,5 +69,6 @@
<file>components/TitleBar.qml</file>
<file>images/collapseRightPanel.png</file>
<file>images/expandRightPanel.png</file>
<file>images/dropdownCopy.png</file>
</qresource>
</RCC>