Skip to content

Commit

Permalink
Add clang-format and active utils string conversion.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ledjlale committed Oct 3, 2023
1 parent 23c0b9b commit 52b1ce5
Show file tree
Hide file tree
Showing 23 changed files with 1,400 additions and 1,146 deletions.
31 changes: 31 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2010-2023 Belledonne Communications SARL.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

---
Language: Cpp
BasedOnStyle: LLVM
AccessModifierOffset: -4
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: AllIfsAndElse
AlwaysBreakTemplateDeclarations: Yes
BinPackParameters: false
ColumnLimit: 120
PointerAlignment: Right
IndentCaseLabels: true
IndentWidth: 4
Standard: c++14
TabWidth: 4
UseTab: ForIndentation
...
10 changes: 7 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
.*
\#*\#
.#.*
!.gitignore
!.gitlab-ci*
!.gitmodules
# Project configuration --------------------------------------------------------

*.pro.user
Expand Down Expand Up @@ -44,3 +41,10 @@ rpm-*/

vgcore.*
linphone.spec

# Exceptions -------------------------------------------------------------------

!.clang-format
!.gitignore
!.gitlab-ci*
!.gitmodules
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,4 @@ else()
include(cmake/TasksMacos.cmake)
endif()

file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/hook/pre-commit" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/")
30 changes: 15 additions & 15 deletions Linphone/core/App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
#include "tool/Constants.hpp"
#include "view/Page/LoginPage.hpp"


App::App(QObject * parent) : QObject(parent) {
App::App(QObject *parent) : QObject(parent) {
init();
}

Expand All @@ -15,26 +14,27 @@ App::App(QObject * parent) : QObject(parent) {
//-----------------------------------------------------------

void App::init() {
// Core
// Core
mCoreModel = QSharedPointer<CoreModel>::create("", this);
mCoreModel->start();
// QML
// QML
mEngine = new QQmlApplicationEngine(this);
mEngine->addImportPath(":/");

initCppInterfaces();

const QUrl url(u"qrc:/Linphone/view/App/Main.qml"_qs);
QObject::connect(mEngine, &QQmlApplicationEngine::objectCreated,
this, [url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl)
QCoreApplication::exit(-1);
}, Qt::QueuedConnection);
QObject::connect(
mEngine, &QQmlApplicationEngine::objectCreated, this,
[url](QObject *obj, const QUrl &objUrl) {
if (!obj && url == objUrl) QCoreApplication::exit(-1);
},
Qt::QueuedConnection);
mEngine->load(url);
}

void App::initCppInterfaces() {
qmlRegisterSingletonType<LoginPage>(Constants::MainQmlUri, 1, 0, "LoginPageCpp", [](QQmlEngine *engine, QJSEngine *) -> QObject *{
return new LoginPage(engine);
});
}
qmlRegisterSingletonType<LoginPage>(
Constants::MainQmlUri, 1, 0, "LoginPageCpp",
[](QQmlEngine *engine, QJSEngine *) -> QObject * { return new LoginPage(engine); });
}
12 changes: 6 additions & 6 deletions Linphone/core/App.hpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@

#include <QSharedPointer>
#include <QQmlApplicationEngine>
#include <QSharedPointer>

#include "model/core/CoreModel.hpp"

class App : public QObject{
class App : public QObject {
public:
App(QObject * parent = nullptr);
App(QObject *parent = nullptr);

void init();
void initCppInterfaces();
QQmlApplicationEngine * mEngine = nullptr;

QQmlApplicationEngine *mEngine = nullptr;
QSharedPointer<CoreModel> mCoreModel;
};
Loading

0 comments on commit 52b1ce5

Please sign in to comment.