mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-15 20:25:47 +02:00
mainapplication: remove gnutls init/deinit
This is moved to libjami in commit e4fa507. Also bump libjami to e4fa507. Change-Id: I5414f0b4987aec6474c09d8ecc4d1675c565853d
This commit is contained in:
parent
b67ed463d1
commit
ada7c4f06f
4 changed files with 92 additions and 98 deletions
2
daemon
2
daemon
|
@ -1 +1 @@
|
||||||
Subproject commit a204b71769f168f4ece750e0faf369f4b91f7ce2
|
Subproject commit e4fa5074cac04f7ba5f8e86b4ce371a3af6a0961
|
|
@ -52,10 +52,6 @@
|
||||||
#include "dbuserrorhandler.h"
|
#include "dbuserrorhandler.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _MSC_VER
|
|
||||||
#include <gnutls/gnutls.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static QString
|
static QString
|
||||||
getRenderInterfaceString()
|
getRenderInterfaceString()
|
||||||
{
|
{
|
||||||
|
@ -140,10 +136,6 @@ MainApplication::init()
|
||||||
settingsManager_->loadTranslations();
|
settingsManager_->loadTranslations();
|
||||||
setApplicationFont();
|
setApplicationFont();
|
||||||
|
|
||||||
#if defined _MSC_VER
|
|
||||||
gnutls_global_init();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
initLrc(runOptions_[Option::UpdateUrl].toString(),
|
initLrc(runOptions_[Option::UpdateUrl].toString(),
|
||||||
connectivityMonitor_.get(),
|
connectivityMonitor_.get(),
|
||||||
runOptions_[Option::Debug].toBool() && !runOptions_[Option::MuteJamid].toBool());
|
runOptions_[Option::Debug].toBool() && !runOptions_[Option::MuteJamid].toBool());
|
||||||
|
|
|
@ -40,123 +40,129 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _MSC_VER && !COMPILE_ONLY
|
class Setup : public QObject
|
||||||
#include <gnutls/gnutls.h>
|
{
|
||||||
#endif
|
Q_OBJECT
|
||||||
|
|
||||||
class Setup : public QObject {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Setup(bool muteDring = false) : muteDring_(muteDring) {}
|
Setup(bool muteDring = false)
|
||||||
|
: muteDring_(muteDring)
|
||||||
|
{}
|
||||||
|
|
||||||
void init() {
|
void init()
|
||||||
connectivityMonitor_.reset(new ConnectivityMonitor(this));
|
{
|
||||||
settingsManager_.reset(new AppSettingsManager(this));
|
connectivityMonitor_.reset(new ConnectivityMonitor(this));
|
||||||
systemTray_.reset(new SystemTray(settingsManager_.get(), this));
|
settingsManager_.reset(new AppSettingsManager(this));
|
||||||
|
systemTray_.reset(new SystemTray(settingsManager_.get(), this));
|
||||||
|
|
||||||
QFontDatabase::addApplicationFont(":/images/FontAwesome.otf");
|
QFontDatabase::addApplicationFont(":/images/FontAwesome.otf");
|
||||||
|
|
||||||
#if defined _MSC_VER && !COMPILE_ONLY
|
#if defined _MSC_VER && !COMPILE_ONLY
|
||||||
gnutls_global_init();
|
gnutls_global_init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
lrcInstance_.reset(new LRCInstance(nullptr, nullptr, "",
|
lrcInstance_.reset(
|
||||||
connectivityMonitor_.get(), muteDring_));
|
new LRCInstance(nullptr, nullptr, "", connectivityMonitor_.get(), muteDring_));
|
||||||
lrcInstance_->subscribeToDebugReceived();
|
lrcInstance_->subscribeToDebugReceived();
|
||||||
|
|
||||||
auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath);
|
auto downloadPath = settingsManager_->getValue(Settings::Key::DownloadPath);
|
||||||
lrcInstance_->accountModel().downloadDirectory =
|
lrcInstance_->accountModel().downloadDirectory = downloadPath.toString() + "/";
|
||||||
downloadPath.toString() + "/";
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void qmlEngineRegistration(QQmlEngine *engine) {
|
void qmlEngineRegistration(QQmlEngine* engine)
|
||||||
// Expose custom types to the QML engine.
|
{
|
||||||
Utils::registerTypes(engine, systemTray_.get(), lrcInstance_.get(),
|
// Expose custom types to the QML engine.
|
||||||
settingsManager_.get(), previewEngine_.get(),
|
Utils::registerTypes(engine,
|
||||||
&screenInfo_, this);
|
systemTray_.get(),
|
||||||
}
|
lrcInstance_.get(),
|
||||||
|
settingsManager_.get(),
|
||||||
|
previewEngine_.get(),
|
||||||
|
&screenInfo_,
|
||||||
|
this);
|
||||||
|
}
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Called once before qmlEngineAvailable.
|
* Called once before qmlEngineAvailable.
|
||||||
*/
|
*/
|
||||||
void applicationAvailable() { init(); }
|
void applicationAvailable() { init(); }
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Called when the QML engine is available. Any import paths, plugin paths,
|
* Called when the QML engine is available. Any import paths, plugin paths,
|
||||||
* and extra file selectors will have been set on the engine by this point.
|
* and extra file selectors will have been set on the engine by this point.
|
||||||
* This function is called once for each QML test file, so any arguments are
|
* This function is called once for each QML test file, so any arguments are
|
||||||
* unique to that test. For example, this means that each QML test file will
|
* unique to that test. For example, this means that each QML test file will
|
||||||
* have its own QML engine.
|
* have its own QML engine.
|
||||||
*
|
*
|
||||||
* This function can be used to register QML types and add import paths,
|
* This function can be used to register QML types and add import paths,
|
||||||
* amongst other things.
|
* amongst other things.
|
||||||
*/
|
*/
|
||||||
void qmlEngineAvailable(QQmlEngine *engine) {
|
void qmlEngineAvailable(QQmlEngine* engine)
|
||||||
auto videoProvider = new VideoProvider(lrcInstance_->avModel(), this);
|
{
|
||||||
engine->rootContext()->setContextProperty("videoProvider", videoProvider);
|
auto videoProvider = new VideoProvider(lrcInstance_->avModel(), this);
|
||||||
|
engine->rootContext()->setContextProperty("videoProvider", videoProvider);
|
||||||
#ifdef WITH_WEBENGINE
|
#ifdef WITH_WEBENGINE
|
||||||
engine->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(true));
|
engine->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(true));
|
||||||
#else
|
#else
|
||||||
engine->rootContext()->setContextProperty("WITH_WEBENGINE",
|
engine->rootContext()->setContextProperty("WITH_WEBENGINE", QVariant(false));
|
||||||
QVariant(false));
|
|
||||||
#endif
|
#endif
|
||||||
qmlEngineRegistration(engine);
|
qmlEngineRegistration(engine);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Called once right after the all test execution has finished. Use this
|
* Called once right after the all test execution has finished. Use this
|
||||||
* function to clean up before everything is destroyed.
|
* function to clean up before everything is destroyed.
|
||||||
*/
|
*/
|
||||||
void cleanupTestCase() {}
|
void cleanupTestCase() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QScopedPointer<LRCInstance> lrcInstance_;
|
QScopedPointer<LRCInstance> lrcInstance_;
|
||||||
|
|
||||||
QScopedPointer<ConnectivityMonitor> connectivityMonitor_;
|
QScopedPointer<ConnectivityMonitor> connectivityMonitor_;
|
||||||
QScopedPointer<AppSettingsManager> settingsManager_;
|
QScopedPointer<AppSettingsManager> settingsManager_;
|
||||||
QScopedPointer<SystemTray> systemTray_;
|
QScopedPointer<SystemTray> systemTray_;
|
||||||
QScopedPointer<PreviewEngine> previewEngine_;
|
QScopedPointer<PreviewEngine> previewEngine_;
|
||||||
ScreenInfo screenInfo_;
|
ScreenInfo screenInfo_;
|
||||||
|
|
||||||
bool muteDring_{false};
|
bool muteDring_ {false};
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int
|
||||||
QDir tempDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
|
main(int argc, char** argv)
|
||||||
|
{
|
||||||
|
QDir tempDir(QStandardPaths::writableLocation(QStandardPaths::TempLocation));
|
||||||
|
|
||||||
auto jamiDataDir = tempDir.absolutePath() + "\\jami_test\\jami";
|
auto jamiDataDir = tempDir.absolutePath() + "\\jami_test\\jami";
|
||||||
auto jamiConfigDir = tempDir.absolutePath() + "\\jami_test\\.config";
|
auto jamiConfigDir = tempDir.absolutePath() + "\\jami_test\\.config";
|
||||||
auto jamiCacheDir = tempDir.absolutePath() + "\\jami_test\\.cache";
|
auto jamiCacheDir = tempDir.absolutePath() + "\\jami_test\\.cache";
|
||||||
|
|
||||||
bool envSet = qputenv("JAMI_DATA_HOME", jamiDataDir.toLocal8Bit());
|
bool envSet = qputenv("JAMI_DATA_HOME", jamiDataDir.toLocal8Bit());
|
||||||
envSet &= qputenv("JAMI_CONFIG_HOME", jamiConfigDir.toLocal8Bit());
|
envSet &= qputenv("JAMI_CONFIG_HOME", jamiConfigDir.toLocal8Bit());
|
||||||
envSet &= qputenv("JAMI_CACHE_HOME", jamiCacheDir.toLocal8Bit());
|
envSet &= qputenv("JAMI_CACHE_HOME", jamiCacheDir.toLocal8Bit());
|
||||||
if (!envSet)
|
if (!envSet)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
bool muteDring{false};
|
bool muteDring {false};
|
||||||
|
|
||||||
// Remove "-mutejamid" from argv, as quick_test_main_with_setup() will
|
// Remove "-mutejamid" from argv, as quick_test_main_with_setup() will
|
||||||
// fail if given an invalid command-line argument.
|
// fail if given an invalid command-line argument.
|
||||||
auto end = std::remove_if(argv + 1, argv + argc, [](char *argv) {
|
auto end = std::remove_if(argv + 1, argv + argc, [](char* argv) {
|
||||||
return (strcmp(argv, "-mutejamid") == 0);
|
return (strcmp(argv, "-mutejamid") == 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (end != argv + argc) {
|
if (end != argv + argc) {
|
||||||
muteDring = true;
|
muteDring = true;
|
||||||
|
|
||||||
// Adjust the argument count.
|
// Adjust the argument count.
|
||||||
argc = std::distance(argv, end);
|
argc = std::distance(argv, end);
|
||||||
}
|
}
|
||||||
#ifdef WITH_WEBENGINE
|
#ifdef WITH_WEBENGINE
|
||||||
QtWebEngineQuick::initialize();
|
QtWebEngineQuick::initialize();
|
||||||
#endif
|
#endif
|
||||||
QTEST_SET_MAIN_SOURCE_PATH
|
QTEST_SET_MAIN_SOURCE_PATH
|
||||||
Setup setup(muteDring);
|
Setup setup(muteDring);
|
||||||
return quick_test_main_with_setup(argc, argv, "qml_test", nullptr, &setup);
|
return quick_test_main_with_setup(argc, argv, "qml_test", nullptr, &setup);
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "main.moc"
|
#include "main.moc"
|
||||||
|
|
|
@ -33,10 +33,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _MSC_VER && !COMPILE_ONLY
|
|
||||||
#include <gnutls/gnutls.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class TestEnvironment
|
class TestEnvironment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
Loading…
Add table
Reference in a new issue