Commit ece8e32f authored by Ronan's avatar Ronan
Browse files

feat(app): settings in progress (ui)

parent 4f22e23c
......@@ -51,6 +51,13 @@
<translation>PAUSE CALL</translation>
</message>
</context>
<context>
<name>CallsWindow</name>
<message>
<source>callsTitle</source>
<translation type="unfinished">Calls</translation>
</message>
</context>
<context>
<name>Chat</name>
<message>
......@@ -503,6 +510,80 @@ Server url not configured.</translation>
<translation type="vanished">Search contact or enter SIP address</translation>
</message>
</context>
<context>
<name>SettingsCallsChat</name>
<message>
<source>fileServerLabel</source>
<translation>File server</translation>
</message>
<message>
<source>encryptWithLimeLabel</source>
<translation>Encrypt with LIME</translation>
</message>
<message>
<source>limeDisabled</source>
<translation>Disabled</translation>
</message>
<message>
<source>limeRequired</source>
<translation>Requis</translation>
</message>
<message>
<source>limePreferred</source>
<translation>Preferred</translation>
</message>
<message>
<source>chatTitle</source>
<translation>Chat</translation>
</message>
<message>
<source>callsTitle</source>
<translation>Calls</translation>
</message>
<message>
<source>encryptionLabel</source>
<translation>Encryption</translation>
</message>
<message>
<source>noEncryption</source>
<translation>None</translation>
</message>
</context>
<context>
<name>SettingsWindow</name>
<message>
<source>settingsTitle</source>
<translation>Linphone - Settings</translation>
</message>
<message>
<source>sipAccountsTab</source>
<translation>SIP accounts</translation>
</message>
<message>
<source>audioTab</source>
<translation>Audio</translation>
</message>
<message>
<source>videoTab</source>
<translation>Video</translation>
</message>
<message>
<source>callsAndChatTab</source>
<translation>Calls and Chat</translation>
</message>
<message>
<source>networkTab</source>
<translation>Network</translation>
</message>
<message>
<source>uiTab</source>
<translation>User Interface</translation>
</message>
<message>
<source>validButton</source>
<translation>OK</translation>
</message>
</context>
<context>
<name>SmartSearchBar</name>
<message>
......
......@@ -43,6 +43,13 @@
<translation>PAUSE</translation>
</message>
</context>
<context>
<name>CallsWindow</name>
<message>
<source>callsTitle</source>
<translation type="unfinished">Appels</translation>
</message>
</context>
<context>
<name>Chat</name>
<message>
......@@ -513,6 +520,80 @@ Url du serveur non configurée.</translation>
<translation type="vanished">Rechercher un contact ou entrer une adresse SIP</translation>
</message>
</context>
<context>
<name>SettingsCallsChat</name>
<message>
<source>fileServerLabel</source>
<translation>Serveur de partage</translation>
</message>
<message>
<source>encryptWithLimeLabel</source>
<translation>Chiffrer avec LIME</translation>
</message>
<message>
<source>limeDisabled</source>
<translation>Désactivé</translation>
</message>
<message>
<source>limeRequired</source>
<translation>Obligatoire</translation>
</message>
<message>
<source>limePreferred</source>
<translation>Préféré</translation>
</message>
<message>
<source>chatTitle</source>
<translation>Chat</translation>
</message>
<message>
<source>callsTitle</source>
<translation>Appels</translation>
</message>
<message>
<source>encryptionLabel</source>
<translation>Chiffrement</translation>
</message>
<message>
<source>noEncryption</source>
<translation>Aucune</translation>
</message>
</context>
<context>
<name>SettingsWindow</name>
<message>
<source>settingsTitle</source>
<translation>Linphone - Paramètres</translation>
</message>
<message>
<source>sipAccountsTab</source>
<translation>Comptes SIP</translation>
</message>
<message>
<source>audioTab</source>
<translation>Audio</translation>
</message>
<message>
<source>videoTab</source>
<translation>Vidéo</translation>
</message>
<message>
<source>callsAndChatTab</source>
<translation>Appels et Chat</translation>
</message>
<message>
<source>networkTab</source>
<translation>Réseau</translation>
</message>
<message>
<source>uiTab</source>
<translation>Interface Utilisateur</translation>
</message>
<message>
<source>validButton</source>
<translation>OK</translation>
</message>
</context>
<context>
<name>SmartSearchBar</name>
<message>
......
......@@ -167,9 +167,14 @@
<file>ui/modules/Common/Form/ActionSwitch.qml</file>
<file>ui/modules/Common/Form/CheckBoxText.qml</file>
<file>ui/modules/Common/Form/ExclusiveButtons.qml</file>
<file>ui/modules/Common/Form/FormGroup.qml</file>
<file>ui/modules/Common/Form/Form.qml</file>
<file>ui/modules/Common/Form/ListForm.qml</file>
<file>ui/modules/Common/Form/SmallButton.qml</file>
<file>ui/modules/Common/Form/StaticListForm.qml</file>
<file>ui/modules/Common/Form/Tab/TabBar.qml</file>
<file>ui/modules/Common/Form/Tab/TabButton.qml</file>
<file>ui/modules/Common/Form/Tab/TabContainer.qml</file>
<file>ui/modules/Common/Form/TextButtonA.qml</file>
<file>ui/modules/Common/Form/TextButtonB.qml</file>
<file>ui/modules/Common/Form/TextField.qml</file>
......@@ -200,8 +205,12 @@
<file>ui/modules/Common/Styles/Form/ActionBarStyle.qml</file>
<file>ui/modules/Common/Styles/Form/CheckBoxTextStyle.qml</file>
<file>ui/modules/Common/Styles/Form/ExclusiveButtonsStyle.qml</file>
<file>ui/modules/Common/Styles/Form/FormGroupStyle.qml</file>
<file>ui/modules/Common/Styles/Form/FormStyle.qml</file>
<file>ui/modules/Common/Styles/Form/ListFormStyle.qml</file>
<file>ui/modules/Common/Styles/Form/SmallButtonStyle.qml</file>
<file>ui/modules/Common/Styles/Form/Tab/TabButtonStyle.qml</file>
<file>ui/modules/Common/Styles/Form/Tab/TabContainerStyle.qml</file>
<file>ui/modules/Common/Styles/Form/TextButtonAStyle.qml</file>
<file>ui/modules/Common/Styles/Form/TextButtonBStyle.qml</file>
<file>ui/modules/Common/Styles/Form/TextFieldStyle.qml</file>
......@@ -266,19 +275,27 @@
<file>ui/views/App/Calls/IncomingCall.qml</file>
<file>ui/views/App/Calls/OutgoingCall.qml</file>
<file>ui/views/App/IncallFullscreen.qml</file>
<file>ui/views/App/MainWindow/ContactEdit.qml</file>
<file>ui/views/App/MainWindow/Contacts.qml</file>
<file>ui/views/App/MainWindow/Conversation.qml</file>
<file>ui/views/App/MainWindow/Home.qml</file>
<file>ui/views/App/MainWindow/MainWindow.qml</file>
<file>ui/views/App/Main/ContactEdit.qml</file>
<file>ui/views/App/Main/Contacts.qml</file>
<file>ui/views/App/Main/Conversation.qml</file>
<file>ui/views/App/Main/Home.qml</file>
<file>ui/views/App/Main/MainWindow.qml</file>
<file>ui/views/App/ManageAccounts.qml</file>
<file>ui/views/App/qmldir</file>
<file>ui/views/App/Settings/SettingsAudio.qml</file>
<file>ui/views/App/Settings/SettingsCallsChat.qml</file>
<file>ui/views/App/Settings/SettingsNetwork.qml</file>
<file>ui/views/App/Settings/SettingsSipAccounts.qml</file>
<file>ui/views/App/Settings/SettingsUi.qml</file>
<file>ui/views/App/Settings/SettingsVideo.qml</file>
<file>ui/views/App/Settings/SettingsWindow.qml</file>
<file>ui/views/App/Styles/Calls/CallStyle.qml</file>
<file>ui/views/App/Styles/Calls/CallsWindowStyle.qml</file>
<file>ui/views/App/Styles/MainWindow/ContactEditStyle.qml</file>
<file>ui/views/App/Styles/MainWindow/ContactsStyle.qml</file>
<file>ui/views/App/Styles/MainWindow/ConversationStyle.qml</file>
<file>ui/views/App/Styles/MainWindow/MainWindowStyle.qml</file>
<file>ui/views/App/Styles/Main/ContactEditStyle.qml</file>
<file>ui/views/App/Styles/Main/ContactsStyle.qml</file>
<file>ui/views/App/Styles/Main/ConversationStyle.qml</file>
<file>ui/views/App/Styles/Main/MainWindowStyle.qml</file>
<file>ui/views/App/Styles/qmldir</file>
<file>ui/views/App/Styles/Settings/SettingsWindowStyle.qml</file>
</qresource>
</RCC>
......@@ -41,9 +41,10 @@
#define LANGUAGES_PATH ":/languages/"
#define WINDOW_ICON_PATH ":/assets/images/linphone.png"
// The two main windows of Linphone desktop.
#define QML_VIEW_MAIN_WINDOW "qrc:/ui/views/App/MainWindow/MainWindow.qml"
#define QML_VIEW_CALL_WINDOW "qrc:/ui/views/App/Calls/CallsWindow.qml"
// The main windows of Linphone desktop.
#define QML_VIEW_MAIN_WINDOW "qrc:/ui/views/App/Main/MainWindow.qml"
#define QML_VIEW_CALLS_WINDOW "qrc:/ui/views/App/Calls/CallsWindow.qml"
#define QML_VIEW_SETTINGS_WINDOW "qrc:/ui/views/App/Settings/SettingsWindow.qml"
// =============================================================================
......@@ -85,11 +86,7 @@ App::App (int &argc, char **argv) : QApplication(argc, argv) {
// -----------------------------------------------------------------------------
QQuickWindow *App::getCallsWindow () const {
QQuickWindow *window = m_engine.rootContext()->contextProperty("CallsWindow").value<QQuickWindow *>();
if (!window)
qFatal("Unable to get calls window.");
return window;
return m_calls_window;
}
QQuickWindow *App::getMainWindow () const {
......@@ -97,8 +94,14 @@ QQuickWindow *App::getMainWindow () const {
return qobject_cast<QQuickWindow *>(engine.rootObjects().at(0));
}
QQuickWindow *App::getSettingsWindow () const {
return m_settings_window;
}
// -----------------------------------------------------------------------------
bool App::hasFocus () const {
return getMainWindow()->isActive() || getCallsWindow()->isActive();
return getMainWindow()->isActive() || m_calls_window->isActive();
}
// -----------------------------------------------------------------------------
......@@ -108,9 +111,9 @@ void App::initContentApp () {
CoreManager::init();
qInfo() << "Core manager initialized.";
// Register types and load context properties.
// Register types ans make sub windows.
registerTypes();
addContextProperties();
createSubWindows();
// Enable notifications.
m_notifier = new Notifier();
......@@ -130,6 +133,8 @@ void App::initContentApp () {
setTrayIcon();
}
// -----------------------------------------------------------------------------
void App::registerTypes () {
qInfo() << "Registering types...";
......@@ -214,19 +219,28 @@ void App::registerTypes () {
qRegisterMetaType<ChatModel::EntryType>("ChatModel::EntryType");
}
void App::addContextProperties () {
qInfo() << "Adding context properties...";
QQmlContext *context = m_engine.rootContext();
// -----------------------------------------------------------------------------
QQmlComponent component(&m_engine, QUrl(QML_VIEW_CALL_WINDOW));
inline QQuickWindow *createSubWindow (QQmlApplicationEngine &engine, const char *path) {
QQmlComponent component(&engine, QUrl(path));
if (component.isError()) {
qWarning() << component.errors();
abort();
}
context->setContextProperty("CallsWindow", component.create());
// Default Ownership is Cpp: http://doc.qt.io/qt-5/qqmlengine.html#ObjectOwnership-enum
return qobject_cast<QQuickWindow *>(component.create());
}
void App::createSubWindows () {
qInfo() << "Create sub windows...";
m_calls_window = createSubWindow(m_engine, QML_VIEW_CALLS_WINDOW);
m_settings_window = createSubWindow(m_engine, QML_VIEW_SETTINGS_WINDOW);
}
// -----------------------------------------------------------------------------
void App::setTrayIcon () {
QQuickWindow *root = getMainWindow();
QMenu *menu = new QMenu();
......
......@@ -50,6 +50,7 @@ public:
QQuickWindow *getCallsWindow () const;
QQuickWindow *getMainWindow () const;
QQuickWindow *getSettingsWindow () const;
bool hasFocus () const;
......@@ -76,7 +77,7 @@ private:
void initContentApp ();
void registerTypes ();
void addContextProperties ();
void createSubWindows ();
void setTrayIcon ();
QQmlApplicationEngine m_engine;
......@@ -91,6 +92,9 @@ private:
Notifier *m_notifier = nullptr;
QString m_locale = "en";
QQuickWindow *m_calls_window = nullptr;
QQuickWindow *m_settings_window = nullptr;
static App *m_instance;
};
......
import QtQuick 2.7
import QtQuick.Layouts 1.3
import Common.Styles 1.0
// =============================================================================
Column {
property alias title: title.text
// ---------------------------------------------------------------------------
spacing: FormStyle.spacing
ColumnLayout {
width: parent.width
spacing: FormStyle.header.spacing
Text {
id: title
color: FormStyle.header.title.color
font {
bold: true
pointSize: FormStyle.header.title.fontSize
}
}
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: FormStyle.header.separator.height
color: FormStyle.header.separator.color
}
Item {
height: FormStyle.header.bottomMargin
}
}
}
import QtQuick 2.7
import QtQuick.Layouts 1.3
import Common.Styles 1.0
// =============================================================================
RowLayout {
property alias label: label.text
default property alias _content: content.data
// ---------------------------------------------------------------------------
spacing: FormGroupStyle.spacing
Text {
id: label
Layout.preferredHeight: FormGroupStyle.legend.height
Layout.preferredWidth: FormGroupStyle.legend.width
color: FormGroupStyle.legend.color
font.pointSize: FormGroupStyle.legend.fontSize
horizontalAlignment: Text.AlignRight
verticalAlignment: Text.AlignVCenter
}
Item {
id: content
Layout.alignment: {
var height = _content[0].height
return height < label.height ? Qt.AlignVCenter : Qt.AlignTop
}
Layout.maximumWidth: FormGroupStyle.content.width
Layout.preferredHeight: _content[0].height
Layout.preferredWidth: FormGroupStyle.content.width
}
}
import QtQuick 2.7
import QtQuick.Controls 2.1
// =============================================================================
TabBar {}
import QtQuick 2.7
import QtQuick.Controls 2.1
import Common.Styles 1.0
// =============================================================================
TabButton {
id: button
// ---------------------------------------------------------------------------
function _getBackgroundColor () {
if (button.parent.parent.currentItem === button) {
return TabButtonStyle.backgroundColor.selected
}
return button.down
? TabButtonStyle.backgroundColor.pressed
: (
button.hovered
? TabButtonStyle.backgroundColor.hovered
: TabButtonStyle.backgroundColor.normal
)
}
function _getTextColor () {
if (button.parent.parent.currentItem === button) {
return TabButtonStyle.text.color.selected
}
return button.down
? TabButtonStyle.text.color.pressed
: (
button.hovered
? TabButtonStyle.text.color.hovered
: TabButtonStyle.text.color.normal
)
}
// ---------------------------------------------------------------------------
background: Rectangle {
color: _getBackgroundColor()
implicitHeight: TabButtonStyle.text.height
}
contentItem: Text {
color: _getTextColor()
font {
bold: true
pointSize: TabButtonStyle.text.fontSize
}
elide: Text.ElideRight
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
leftPadding: TabButtonStyle.text.leftPadding
rightPadding: TabButtonStyle.text.rightPadding
text: button.text
}
hoverEnabled: true
}
import QtQuick 2.7
import Common.Styles 1.0
// =============================================================================
Rectangle {
default property alias _content: content.data
anchors.fill: parent
color: TabContainerStyle.color
Item {
id: content
anchors {
fill: parent
bottomMargin: TabContainerStyle.bottomMargin
leftMargin: TabContainerStyle.leftMargin
rightMargin: TabContainerStyle.rightMargin
topMargin: TabContainerStyle.topMargin
}
}
}
......@@ -18,6 +18,7 @@ Controls.TextField {
}
color: TextFieldStyle.background.color
implicitHeight: TextFieldStyle.background.height
implicitWidth: TextFieldStyle.background.width
radius: TextFieldStyle.background.radius
}
......
......@@ -37,8 +37,8 @@ Item {
// See: https://www.opengl.org/sdk/docs/man/html/mix.xhtml
fragmentShader: '
#ifdef GL_ES
precision lowp float;
#endif
precision lowp float;
#endif
uniform sampler2D image;
uniform sampler2D mask;
uniform vec4 backgroundColor;
......