Commit 2df59f19 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(app): coding style

parent 7a3d0f2c
......@@ -58,7 +58,7 @@ App::App (int &argc, char **argv) : QApplication(argc, argv) {
m_engine.addImportPath(":/ui/views");
}
// -------------------------------------------------------------------
// -----------------------------------------------------------------------------
void App::initContentApp () {
qInfo() << "Initializing core manager...";
......
......@@ -11,7 +11,7 @@
class Notifier;
// ===================================================================
// =============================================================================
class App : public QApplication {
Q_OBJECT;
......
#include <QtDebug>
#include "Database.hpp"
#include "../utils.hpp"
#include "AvatarProvider.hpp"
// ===================================================================
// =============================================================================
const QString AvatarProvider::PROVIDER_ID = "avatar";
......
......@@ -3,7 +3,7 @@
#include <QQuickImageProvider>
// ===================================================================
// =============================================================================
class AvatarProvider : public QQuickImageProvider {
public:
......@@ -17,6 +17,7 @@ public:
) override;
static const QString PROVIDER_ID;
private:
QString m_avatars_path;
};
......
......@@ -7,12 +7,12 @@
#include "Database.hpp"
#ifdef _WIN32
#define DATABASES_PATH \
QStandardPaths::writableLocation(QStandardPaths::DataLocation)
#define DATABASES_PATH \
QStandardPaths::writableLocation(QStandardPaths::DataLocation)
#else
#define DATABASES_PATH \
QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
#endif
#define DATABASES_PATH \
QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
#endif // ifdef _WIN32
#define DATABASE_PATH_AVATARS ".linphone/avatars/"
#define DATABASE_PATH_CALL_HISTORY_LIST ".linphone-call-history.db"
......@@ -21,7 +21,7 @@
using namespace std;
// ===================================================================
// =============================================================================
inline bool ensureDatabaseFilePathExists (const QString &path) {
QDir dir(DATABASES_PATH);
......@@ -47,9 +47,9 @@ string Database::getAvatarsPath () {
inline string getDatabaseFilePath (const QString &filename) {
QString path(DATABASES_PATH + "/");
path += filename;
return ensureDatabaseFilePathExists(path)
? Utils::qStringToLinphoneString(QDir::toNativeSeparators(path))
: "";
return ensureDatabaseFilePathExists(path) ? Utils::qStringToLinphoneString(
QDir::toNativeSeparators(path)
) : "";
}
string Database::getCallHistoryPath () {
......
......@@ -3,7 +3,7 @@
#include <string>
// ===================================================================
// =============================================================================
namespace Database {
// Returns the databases paths.
......@@ -14,6 +14,6 @@ namespace Database {
std::string getCallHistoryPath ();
std::string getFriendsListPath ();
std::string getMessageHistoryPath ();
};
}
#endif // DATABASE_H_
......@@ -3,7 +3,7 @@
#include "DefaultTranslator.hpp"
// ===================================================================
// =============================================================================
DefaultTranslator::DefaultTranslator () {
QDirIterator it(":", QDirIterator::Subdirectories);
......
......@@ -4,7 +4,7 @@
#include <QSet>
#include <QTranslator>
// ===================================================================
// =============================================================================
class DefaultTranslator : public QTranslator {
public:
......@@ -22,4 +22,4 @@ private:
QSet<QString> m_contexts;
};
#endif
#endif // DEFAULT_TRANSLATOR_H_
......@@ -14,9 +14,9 @@
#define PURPLE ""
#define RED ""
#define RESET ""
#endif
#endif // ifdef __linux__
// ===================================================================
// =============================================================================
void logger (QtMsgType type, const QMessageLogContext &context, const QString &msg) {
QByteArray local_msg = msg.toLocal8Bit();
......@@ -31,26 +31,31 @@ void logger (QtMsgType type, const QMessageLogContext &context, const QString &m
context_line = context.line;
}
switch (type) {
case QtDebugMsg:
fprintf(stderr, GREEN "[%s][Debug]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData());
break;
case QtInfoMsg:
fprintf(stderr, BLUE "[%s][Info]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData());
break;
case QtWarningMsg:
fprintf(stderr, RED "[%s][Warning]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData());
break;
case QtCriticalMsg:
fprintf(stderr, RED "[%s][Critical]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData());
break;
case QtFatalMsg:
fprintf(stderr, RED "[%s][Fatal]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData());
abort();
if (type == QtDebugMsg)
fprintf(
stderr, GREEN "[%s][Debug]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData()
);
else if (type == QtInfoMsg)
fprintf(
stderr, BLUE "[%s][Info]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData()
);
else if (type == QtWarningMsg)
fprintf(
stderr, RED "[%s][Warning]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData()
);
else if (type == QtCriticalMsg)
fprintf(
stderr, RED "[%s][Critical]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData()
);
else if (type == QtFatalMsg) {
fprintf(
stderr, RED "[%s][Fatal]" PURPLE "%s:%u: " RESET "%s\n",
date_time.constData(), context_file, context_line, local_msg.constData()
);
abort();
}
}
......@@ -3,6 +3,8 @@
#include <QtGlobal>
// =============================================================================
void logger (QtMsgType type, const QMessageLogContext &context, const QString &msg);
#endif // LOGGER_H_
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