You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Moved main page to separate qml file
This commit is contained in:
4
QtClient/JoplinQtClient/LoginPage.qml
Executable file
4
QtClient/JoplinQtClient/LoginPage.qml
Executable file
@ -0,0 +1,4 @@
|
||||
import QtQuick 2.4
|
||||
|
||||
LoginPageForm {
|
||||
}
|
68
QtClient/JoplinQtClient/LoginPageForm.ui.qml
Executable file
68
QtClient/JoplinQtClient/LoginPageForm.ui.qml
Executable file
@ -0,0 +1,68 @@
|
||||
import QtQuick 2.4
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Item {
|
||||
width: 400
|
||||
height: 400
|
||||
|
||||
GridLayout {
|
||||
id: gridLayout1
|
||||
flow: GridLayout.LeftToRight
|
||||
rows: 6
|
||||
columns: 2
|
||||
anchors.fill: parent
|
||||
|
||||
Label {
|
||||
id: label1
|
||||
text: qsTr("Domain")
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textField1
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
id: label2
|
||||
text: qsTr("Email")
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textField2
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Label {
|
||||
id: label3
|
||||
text: qsTr("Password")
|
||||
}
|
||||
|
||||
TextField {
|
||||
id: textField3
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Button {
|
||||
id: button1
|
||||
text: qsTr("Login")
|
||||
Layout.fillWidth: true
|
||||
Layout.columnSpan: 2
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: rectangle1
|
||||
width: 200
|
||||
height: 200
|
||||
color: "#ffffff"
|
||||
Layout.columnSpan: 2
|
||||
Layout.rowSpan: 1
|
||||
Layout.fillHeight: true
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -4,14 +4,8 @@ import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 800
|
||||
height: 600
|
||||
signal currentFolderChanged()
|
||||
signal currentNoteChanged()
|
||||
signal addNoteButtonClicked()
|
||||
signal addFolderButtonClicked()
|
||||
signal syncButtonClicked()
|
||||
|
||||
property Item appRoot
|
||||
property alias currentFolderIndex: folderList.currentIndex
|
||||
property alias currentNoteIndex: noteList.currentIndex
|
||||
|
||||
@ -31,7 +25,7 @@ Item {
|
||||
Layout.minimumHeight: 150
|
||||
|
||||
onCurrentItemChanged: {
|
||||
root.currentFolderChanged()
|
||||
appRoot.currentFolderChanged()
|
||||
}
|
||||
|
||||
onEditingAccepted: function(index, text) {
|
||||
@ -66,7 +60,7 @@ Item {
|
||||
Layout.preferredHeight: 100
|
||||
|
||||
onCurrentItemChanged: {
|
||||
root.currentNoteChanged()
|
||||
appRoot.currentNoteChanged()
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,7 +83,7 @@ Item {
|
||||
folderList.model.showVirtualItem();
|
||||
folderList.startEditing(folderList.model.rowCount() - 1);
|
||||
}
|
||||
onAddNoteButtonClicked: root.addNoteButtonClicked()
|
||||
onAddNoteButtonClicked: appRoot.addNoteButtonClicked()
|
||||
}
|
||||
|
||||
Button {
|
||||
@ -97,7 +91,7 @@ Item {
|
||||
text: "Sync"
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
onClicked: root.syncButtonClicked()
|
||||
onClicked: appRoot.syncButtonClicked()
|
||||
}
|
||||
|
||||
}
|
28
QtClient/JoplinQtClient/app.qml
Executable file
28
QtClient/JoplinQtClient/app.qml
Executable file
@ -0,0 +1,28 @@
|
||||
import QtQuick 2.7
|
||||
import QtQuick.Controls 2.0
|
||||
import QtQuick.Controls 1.4
|
||||
import QtQuick.Layouts 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
width: 800
|
||||
height: 600
|
||||
signal currentFolderChanged()
|
||||
signal currentNoteChanged()
|
||||
signal addNoteButtonClicked()
|
||||
signal addFolderButtonClicked()
|
||||
signal syncButtonClicked()
|
||||
property alias currentFolderIndex: mainPage.currentFolderIndex
|
||||
property alias currentNoteIndex: mainPage.currentNoteIndex
|
||||
|
||||
MainPage {
|
||||
id: mainPage
|
||||
anchors.fill: parent
|
||||
appRoot: root
|
||||
}
|
||||
|
||||
LoginPage {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -17,7 +17,6 @@ Application::Application(int &argc, char **argv) :
|
||||
QGuiApplication(argc, argv),
|
||||
db_(jop::db()),
|
||||
api_(jop::API_BASE_URL),
|
||||
//api_("https://joplin.cozic.net"),
|
||||
synchronizer_(api_.baseUrl(), db_),
|
||||
folderModel_(db_)
|
||||
|
||||
@ -45,7 +44,7 @@ Application::Application(int &argc, char **argv) :
|
||||
ctxt->setContextProperty("noteListModel", ¬eModel_);
|
||||
ctxt->setContextProperty("noteModel", &selectedQmlNote_);
|
||||
|
||||
view_.setSource(QUrl("qrc:/main.qml"));
|
||||
view_.setSource(QUrl("qrc:/app.qml"));
|
||||
|
||||
QObject* rootObject = (QObject*)view_.rootObject();
|
||||
|
||||
@ -68,17 +67,17 @@ Application::Application(int &argc, char **argv) :
|
||||
connect(&api_, SIGNAL(requestDone(const QJsonObject&, const QString&)), this, SLOT(api_requestDone(const QJsonObject&, const QString&)));
|
||||
|
||||
// Don't store password, store session ID
|
||||
QString clientId = "B6E12222B6E12222";
|
||||
if (!settings.contains("user.email")) {
|
||||
settings.setValue("user.email", "laurent@cozic.net");
|
||||
settings.setValue("user.password", "12345678");
|
||||
}
|
||||
// QString clientId = "B6E12222B6E12222";
|
||||
// if (!settings.contains("user.email")) {
|
||||
// settings.setValue("user.email", "laurent@cozic.net");
|
||||
// settings.setValue("user.password", "12345678");
|
||||
// }
|
||||
|
||||
QUrlQuery postData;
|
||||
postData.addQueryItem("email", settings.value("user.email").toString());
|
||||
postData.addQueryItem("password", settings.value("user.password").toString());
|
||||
postData.addQueryItem("client_id", clientId);
|
||||
api_.post("sessions", QUrlQuery(), postData, "getSession");
|
||||
// QUrlQuery postData;
|
||||
// postData.addQueryItem("email", settings.value("user.email").toString());
|
||||
// postData.addQueryItem("password", settings.value("user.password").toString());
|
||||
// postData.addQueryItem("client_id", clientId);
|
||||
// api_.post("sessions", QUrlQuery(), postData, "getSession");
|
||||
}
|
||||
|
||||
void Application::api_requestDone(const QJsonObject& response, const QString& tag) {
|
||||
|
@ -1,10 +1,13 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>main.qml</file>
|
||||
<file>app.qml</file>
|
||||
<file>FolderList.qml</file>
|
||||
<file>NoteList.qml</file>
|
||||
<file>NoteEditor.qml</file>
|
||||
<file>AddButton.qml</file>
|
||||
<file>EditableListItem.qml</file>
|
||||
<file>LoginPage.qml</file>
|
||||
<file>LoginPageForm.ui.qml</file>
|
||||
<file>MainPage.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
Reference in New Issue
Block a user