Commit 7137e95d authored by Ronan Abhamon's avatar Ronan Abhamon

feat(app): supports Components

parent 51c5694d
......@@ -2,10 +2,10 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>main_window</name>
<name>SearchBar</name>
<message>
<source>helloWorld</source>
<translation>Hello World!</translation>
<translation>Hello World</translation>
</message>
</context>
</TS>
......@@ -2,10 +2,10 @@
<!DOCTYPE TS>
<TS version="2.1">
<context>
<name>main_window</name>
<name>SearchBar</name>
<message>
<source>helloWorld</source>
<translation>Bonjour le monde !</translation>
<translation>Bonjour le monde</translation>
</message>
</context>
</TS>
QT += core gui quick widgets
QT = core gui quick widgets
TARGET = linphone
TEMPLATE = app
SOURCES += \
SOURCES = \
src/app.cpp \
src/main.cpp \
src/views/main_window.cpp
HEADERS += \
HEADERS = \
src/app.hpp \
src/views/main_window.hpp
......@@ -17,8 +17,10 @@ TRANSLATIONS = \
languages/fr.ts
lupdate_only{
# Each component folder must be added explicitly.
SOURCES = \
ui/*.qml
ui/components/SearchBar/*.qml \
ui/views/*.qml
}
RESOURCES += \
......
......@@ -5,6 +5,7 @@
<file>languages/fr.qm</file>
<!-- UI. -->
<file>ui/main_window.qml</file>
<file>ui/components/SearchBar/SearchBar.qml</file>
<file>ui/views/main_window.qml</file>
</qresource>
</RCC>
......@@ -6,6 +6,8 @@
#define LANGUAGES_PATH ":/languages/"
// ===================================================================
App::App(int &argc, char **argv) : QGuiApplication(argc, argv) {
// Try to enable system translation by default. (else english)
if (m_translator.load(QString(LANGUAGES_PATH) + QLocale::system().name()) ||
......
......@@ -4,12 +4,12 @@
#include "app.hpp"
// ===================================================================
int main (int argc, char *argv[]) {
// Init main window.
App app(argc, argv);
QQmlApplicationEngine engine(QUrl("qrc:/ui/main_window.qml"));
QQmlApplicationEngine engine(QUrl("qrc:/ui/views/main_window.qml"));
// File not found.
if (engine.rootObjects().isEmpty())
exit(EXIT_FAILURE);
......
#ifndef MAIN_WINDOW_H
#define MAIN_WINDOW_H
#ifndef MAIN_WINDOW_H_
#define MAIN_WINDOW_H_
#endif // MAIN_WINDOW
class MainWindow {
// TODO.
};
#endif // MAIN_WINDOW_
import QtQuick 2.5
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
ApplicationWindow {
id: mainWindow
visible: true
header: ToolBar {
RowLayout {
anchors.fill: parent
}
}
footer: TabBar {
}
Text {
anchors.centerIn: parent
text: qsTr("helloWorld");
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment