Allow for building without QtKeychain (#3318)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
+11
-1
@@ -492,7 +492,6 @@ target_link_libraries(${LIBRARY_PROJECT}
|
||||
Qt${MAJOR_QT_VERSION}::Concurrent
|
||||
|
||||
LibCommuni::LibCommuni
|
||||
qt${MAJOR_QT_VERSION}keychain
|
||||
Pajlada::Serialize
|
||||
Pajlada::Settings
|
||||
Pajlada::Signals
|
||||
@@ -501,6 +500,17 @@ target_link_libraries(${LIBRARY_PROJECT}
|
||||
RapidJSON::RapidJSON
|
||||
LRUCache
|
||||
)
|
||||
if (BUILD_WITH_QTKEYCHAIN)
|
||||
target_link_libraries(${LIBRARY_PROJECT}
|
||||
PUBLIC
|
||||
qt${MAJOR_QT_VERSION}keychain
|
||||
)
|
||||
else()
|
||||
target_compile_definitions(${LIBRARY_PROJECT}
|
||||
PUBLIC
|
||||
NO_QTKEYCHAIN
|
||||
)
|
||||
endif()
|
||||
|
||||
if (BUILD_APP)
|
||||
add_executable(${EXECUTABLE_PROJECT} main.cpp)
|
||||
|
||||
@@ -9,10 +9,12 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
#ifdef CMAKE_BUILD
|
||||
# include "qt5keychain/keychain.h"
|
||||
#else
|
||||
# include "keychain.h"
|
||||
#ifndef NO_QTKEYCHAIN
|
||||
# ifdef CMAKE_BUILD
|
||||
# include "qt5keychain/keychain.h"
|
||||
# else
|
||||
# include "keychain.h"
|
||||
# endif
|
||||
#endif
|
||||
#include <QSaveFile>
|
||||
#include <boost/variant.hpp>
|
||||
@@ -28,6 +30,9 @@ namespace chatterino {
|
||||
namespace {
|
||||
bool useKeyring()
|
||||
{
|
||||
#ifdef NO_QTKEYCHAIN
|
||||
return false;
|
||||
#endif
|
||||
if (getPaths()->isPortable())
|
||||
{
|
||||
return false;
|
||||
@@ -104,6 +109,7 @@ namespace {
|
||||
|
||||
static void runNextJob()
|
||||
{
|
||||
#ifndef NO_QTKEYCHAIN
|
||||
auto &&queue = jobQueue();
|
||||
|
||||
if (!queue.empty())
|
||||
@@ -140,6 +146,7 @@ namespace {
|
||||
|
||||
queue.pop();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void queueJob(Job &&job)
|
||||
@@ -174,6 +181,8 @@ void Credentials::get(const QString &provider, const QString &name_,
|
||||
|
||||
if (useKeyring())
|
||||
{
|
||||
#ifndef NO_QTKEYCHAIN
|
||||
// if NO_QTKEYCHAIN is set, then this code is never used either way
|
||||
auto job = new QKeychain::ReadPasswordJob("chatterino");
|
||||
job->setAutoDelete(true);
|
||||
job->setKey(name);
|
||||
@@ -184,6 +193,7 @@ void Credentials::get(const QString &provider, const QString &name_,
|
||||
},
|
||||
Qt::DirectConnection);
|
||||
job->start();
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -140,9 +140,11 @@ AboutPage::AboutPage()
|
||||
addLicense(form.getElement(), "Websocketpp",
|
||||
"https://www.zaphoyd.com/websocketpp/",
|
||||
":/licenses/websocketpp.txt");
|
||||
#ifndef NO_QTKEYCHAIN
|
||||
addLicense(form.getElement(), "QtKeychain",
|
||||
"https://github.com/frankosterfeld/qtkeychain",
|
||||
":/licenses/qtkeychain.txt");
|
||||
#endif
|
||||
addLicense(form.getElement(), "lrucache",
|
||||
"https://github.com/lamerman/cpp-lru-cache",
|
||||
":/licenses/lrucache.txt");
|
||||
|
||||
@@ -584,7 +584,7 @@ void GeneralPage::initLayout(GeneralPageView &layout)
|
||||
|
||||
layout.addCheckbox("Restart on crash", s.restartOnCrash);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if defined(Q_OS_LINUX) && !defined(NO_QTKEYCHAIN)
|
||||
if (!getPaths()->isPortable())
|
||||
{
|
||||
layout.addCheckbox(
|
||||
|
||||
Reference in New Issue
Block a user