forked from Silverfish/proton-bridge
Revert GODT-2373 (bridgelib).
This commit is contained in:
@ -85,49 +85,6 @@ message(STATUS "Using Qt ${Qt6_VERSION}")
|
||||
#*****************************************************************************************************************************************************
|
||||
find_package(sentry CONFIG REQUIRED)
|
||||
|
||||
|
||||
#*****************************************************************************************************************************************************
|
||||
# bridgelib
|
||||
#*****************************************************************************************************************************************************
|
||||
find_program(GO_BIN "go")
|
||||
if (NOT GO_BIN)
|
||||
message(FATAL_ERROR "Could not location go compiler")
|
||||
endif()
|
||||
message(STATUS "go compiler is ${GO_BIN}")
|
||||
|
||||
if (APPLE) # set some env variable for go compiler on macOS. Note the CGO_ENABLED=1 is required when cross-compiling.
|
||||
if (CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||
set(GO_BIN "MACOSX_DEPLOYMENT_TARGET=11.0" "GOARCH=arm64" "CGO_CFLAGS=\"-mmacosx-version-min=11.0\"" CGO_ENABLED=1 ${GO_BIN})
|
||||
else ()
|
||||
set(GO_BIN "MACOSX_DEPLOYMENT_TARGET=10.15" "GOARCH=amd64" "CGO_CFLAGS=\"-mmacosx-version-min=10.15\"" CGO_ENABLED=1 ${GO_BIN})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
file(REAL_PATH "pkg/bridgelib" BRIDGELIB_DIR BASE_DIRECTORY "${BRIDGE_REPO_ROOT}")
|
||||
message(STATUS "bridgelib folder is ${BRIDGELIB_DIR}")
|
||||
|
||||
set(BRIDGELIB_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(BRIDGELIB_BASE_NAME "bridgelib")
|
||||
if (UNIX AND NOT APPLE)
|
||||
set(BRIDGELIB_LIB_FILE "${BRIDGELIB_BASE_NAME}.so")
|
||||
endif()
|
||||
if (APPLE)
|
||||
set(BRIDGELIB_OUTPUT_DIR ${BRIDGELIB_OUTPUT_DIR}/${CMAKE_PROJECT_NAME}.app/Contents/MacOS)
|
||||
set(BRIDGELIB_LIB_FILE "${BRIDGELIB_BASE_NAME}.dylib")
|
||||
endif()
|
||||
if (WIN32)
|
||||
set(BRIDGELIB_LIB_FILE "${BRIDGELIB_BASE_NAME}.dll")
|
||||
endif()
|
||||
|
||||
set(BRIDGELIB_OUTPUT_PATH "${BRIDGELIB_OUTPUT_DIR}/${BRIDGELIB_LIB_FILE}")
|
||||
|
||||
add_custom_target(
|
||||
bridgelib
|
||||
COMMAND ${GO_BIN} build -o ${BRIDGELIB_OUTPUT_PATH} --buildmode c-shared
|
||||
WORKING_DIRECTORY ${BRIDGELIB_DIR}
|
||||
COMMENT "Compile bridgelib library"
|
||||
)
|
||||
|
||||
#*****************************************************************************************************************************************************
|
||||
# Source files and output
|
||||
#*****************************************************************************************************************************************************
|
||||
@ -152,6 +109,7 @@ add_executable(bridge-gui
|
||||
Resources.qrc
|
||||
AppController.cpp AppController.h
|
||||
BridgeApp.cpp BridgeApp.h
|
||||
BuildConfig.h
|
||||
CommandLine.cpp CommandLine.h
|
||||
EventStreamWorker.cpp EventStreamWorker.h
|
||||
LogUtils.cpp LogUtils.h
|
||||
@ -167,8 +125,6 @@ if (APPLE)
|
||||
target_sources(bridge-gui PRIVATE MacOS/SecondInstance.mm MacOS/SecondInstance.h)
|
||||
endif(APPLE)
|
||||
|
||||
add_dependencies(bridge-gui bridgelib)
|
||||
|
||||
if (WIN32) # on Windows, we add a (non-Qt) resource file that contains the application icon and version information.
|
||||
string(TIMESTAMP BRIDGE_BUILD_YEAR "%Y")
|
||||
set(REGEX_NUMBER "[0123456789]") # CMake matches does not support \d.
|
||||
|
||||
@ -46,9 +46,6 @@ install(DIRECTORY "${QT_DIR}/lib/QtQuickDialogs2Utils.framework"
|
||||
# PLUGINS
|
||||
install(FILES "${QT_DIR}/plugins/imageformats/libqsvg.dylib"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/PlugIns/imageformats")
|
||||
# BRIDGELIB
|
||||
install(FILES "${BRIDGELIB_OUTPUT_DIR}/${BRIDGELIB_LIB_FILE}"
|
||||
DESTINATION "${CMAKE_INSTALL_PREFIX}/bridge-gui.app/Contents/MacOS")
|
||||
|
||||
# crash handler utils
|
||||
## Build
|
||||
|
||||
@ -43,9 +43,6 @@ macro( AppendQt6Lib LIB_NAME)
|
||||
AppendLib("${LIB_NAME}" "${QT_DIR}/lib/")
|
||||
endmacro()
|
||||
|
||||
# bridgelib
|
||||
install(FILES ${BRIDGELIB_OUTPUT_PATH} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
#Qt6
|
||||
AppendQt6Lib("libQt6QuickControls2.so.6")
|
||||
AppendQt6Lib("libQt6Quick.so.6")
|
||||
|
||||
@ -47,9 +47,6 @@ endmacro()
|
||||
# Force plugins to be installed near the exe.
|
||||
install(SCRIPT ${deploy_script})
|
||||
|
||||
# bridgelib
|
||||
install(FILES ${BRIDGELIB_OUTPUT_PATH} DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
# Vcpkg DLLs
|
||||
AppendVCPKGLib("abseil_dll.dll")
|
||||
AppendVCPKGLib("cares.dll")
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
#include "LogUtils.h"
|
||||
#include "BuildConfig.h"
|
||||
#include <bridgepp/BridgeLib.h>
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
|
||||
|
||||
using namespace bridgepp;
|
||||
@ -28,7 +28,7 @@ using namespace bridgepp;
|
||||
/// \return user logs directory used by bridge.
|
||||
//****************************************************************************************************************************************************
|
||||
QString userLogsDir() {
|
||||
QString const path = QDir(bridgelib::userDataDir()).absoluteFilePath("logs");
|
||||
QString const path = QDir(bridgepp::userDataDir()).absoluteFilePath("logs");
|
||||
QDir().mkpath(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "QMLBackend.h"
|
||||
#include "BuildConfig.h"
|
||||
#include "EventStreamWorker.h"
|
||||
#include <bridgepp/BridgeLib.h>
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
#include <bridgepp/GRPC/GRPCClient.h>
|
||||
#include <bridgepp/Exception/Exception.h>
|
||||
#include <bridgepp/Worker/Overseer.h>
|
||||
@ -57,7 +57,7 @@ void QMLBackend::init(GRPCConfig const &serviceConfig) {
|
||||
app().grpc().setLog(&log);
|
||||
this->connectGrpcEvents();
|
||||
|
||||
app().grpc().connectToServer(bridgelib::userConfigDir(), serviceConfig, app().bridgeMonitor());
|
||||
app().grpc().connectToServer(bridgepp::userConfigDir(), serviceConfig, app().bridgeMonitor());
|
||||
app().log().info("Connected to backend via gRPC service.");
|
||||
|
||||
QString bridgeVer;
|
||||
@ -74,6 +74,7 @@ void QMLBackend::init(GRPCConfig const &serviceConfig) {
|
||||
});
|
||||
|
||||
// Grab from bridge the value that will not change during the execution of this app (or that will only change locally).
|
||||
app().grpc().goos(goos_);
|
||||
app().grpc().logsPath(logsPath_);
|
||||
app().grpc().licensePath(licensePath_);
|
||||
bool sslForIMAP = false, sslForSMTP = false;
|
||||
@ -151,16 +152,6 @@ bool QMLBackend::areSameFileOrFolder(QUrl const &lhs, QUrl const &rhs) const {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
QString QMLBackend::goOS() {
|
||||
HANDLE_EXCEPTION_RETURN_QSTRING(
|
||||
return bridgelib::goos();
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The value for the 'showOnStartup' property.
|
||||
//****************************************************************************************************************************************************
|
||||
@ -186,6 +177,16 @@ void QMLBackend::setShowSplashScreen(bool show) {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The value for the 'GOOS' property.
|
||||
//****************************************************************************************************************************************************
|
||||
QString QMLBackend::goos() const {
|
||||
HANDLE_EXCEPTION_RETURN_QSTRING(
|
||||
return goos_;
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The value for the 'showSplashScreen' property.
|
||||
//****************************************************************************************************************************************************
|
||||
|
||||
@ -50,11 +50,11 @@ public: // member functions.
|
||||
Q_INVOKABLE bool isPortFree(int port) const; ///< Check if a given network port is available.
|
||||
Q_INVOKABLE QString nativePath(QUrl const &url) const; ///< Retrieve the native path of a local URL.
|
||||
Q_INVOKABLE bool areSameFileOrFolder(QUrl const &lhs, QUrl const &rhs) const; ///< Check if two local URL point to the same file.
|
||||
Q_INVOKABLE QString goOS(); ///< Return the OS string from golang's runtime.GOOS.
|
||||
|
||||
public: // Qt/QML properties. Note that the NOTIFY-er signal is required even for read-only properties (QML warning otherwise)
|
||||
Q_PROPERTY(bool showOnStartup READ showOnStartup NOTIFY showOnStartupChanged)
|
||||
Q_PROPERTY(bool showSplashScreen READ showSplashScreen WRITE setShowSplashScreen NOTIFY showSplashScreenChanged)
|
||||
Q_PROPERTY(QString goos READ goos NOTIFY goosChanged)
|
||||
Q_PROPERTY(QUrl logsPath READ logsPath NOTIFY logsPathChanged)
|
||||
Q_PROPERTY(QUrl licensePath READ licensePath NOTIFY licensePathChanged)
|
||||
Q_PROPERTY(QUrl releaseNotesLink READ releaseNotesLink NOTIFY releaseNotesLinkChanged)
|
||||
@ -86,6 +86,7 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
bool showOnStartup() const; ///< Getter for the 'showOnStartup' property.
|
||||
void setShowSplashScreen(bool show); ///< Setter for the 'showSplashScreen' property.
|
||||
bool showSplashScreen() const; ///< Getter for the 'showSplashScreen' property.
|
||||
QString goos() const; ///< Getter for the 'GOOS' property.
|
||||
QUrl logsPath() const; ///< Getter for the 'logsPath' property.
|
||||
QUrl licensePath() const; ///< Getter for the 'licensePath' property.
|
||||
QUrl releaseNotesLink() const;///< Getter for the 'releaseNotesLink' property.
|
||||
@ -119,6 +120,7 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
signals: // Signal used by the Qt property system. Many of them are unused but required to avoid warning from the QML engine.
|
||||
void showSplashScreenChanged(bool value); ///<Signal for the change of the 'showSplashScreen' property.
|
||||
void showOnStartupChanged(bool value); ///<Signal for the change of the 'showOnStartup' property.
|
||||
void goosChanged(QString const &value); ///<Signal for the change of the 'GOOS' property.
|
||||
void diskCachePathChanged(QUrl const &url); ///<Signal for the change of the 'diskCachePath' property.
|
||||
void imapPortChanged(int port); ///<Signal for the change of the 'imapPort' property.
|
||||
void smtpPortChanged(int port); ///<Signal for the change of the 'smtpPort' property.
|
||||
@ -245,6 +247,7 @@ private: // data members
|
||||
UserList *users_ { nullptr }; ///< The user list. Owned by backend.
|
||||
std::unique_ptr<bridgepp::Overseer> eventStreamOverseer_; ///< The event stream overseer.
|
||||
bool showSplashScreen_ { false }; ///< The cached version of show splash screen. Retrieved on startup from bridge, and potentially modified locally.
|
||||
QString goos_; ///< The cached version of the GOOS variable.
|
||||
QUrl logsPath_; ///< The logs path. Retrieved from bridge on startup.
|
||||
QUrl licensePath_; ///< The license path. Retrieved from bridge on startup.
|
||||
int imapPort_ { 0 }; ///< The cached value for the IMAP port.
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
|
||||
#include "SentryUtils.h"
|
||||
#include "BuildConfig.h"
|
||||
#include <bridgepp/BridgeLib.h>
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
|
||||
|
||||
@ -27,18 +26,6 @@ using namespace bridgepp;
|
||||
static constexpr const char *LoggerName = "bridge-gui";
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \brief Get the path of the sentry cache folder.
|
||||
///
|
||||
/// \return sentry cache directory used by bridge.
|
||||
//****************************************************************************************************************************************************
|
||||
QString sentryCacheDir() {
|
||||
QString const path = QDir(bridgelib::userDataDir()).absoluteFilePath("sentry_cache");
|
||||
QDir().mkpath(path);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \brief Get a hash of the computer's host name
|
||||
//****************************************************************************************************************************************************
|
||||
@ -88,7 +75,7 @@ void initSentry() {
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void setSentryReportScope() {
|
||||
sentry_set_tag("OS", bridgelib::goos().toUtf8());
|
||||
sentry_set_tag("OS", bridgepp::goos().toUtf8());
|
||||
sentry_set_tag("Client", PROJECT_FULL_NAME);
|
||||
sentry_set_tag("Version", PROJECT_REVISION);
|
||||
sentry_set_tag("HostArch", QSysInfo::currentCpuArchitecture().toUtf8());
|
||||
|
||||
@ -23,7 +23,6 @@
|
||||
#include "QMLBackend.h"
|
||||
#include "SentryUtils.h"
|
||||
#include "BuildConfig.h"
|
||||
#include <bridgepp/BridgeLib.h>
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
#include <bridgepp/Exception/Exception.h>
|
||||
#include <bridgepp/FocusGRPC/FocusGRPCClient.h>
|
||||
@ -158,7 +157,7 @@ QUrl getApiUrl() {
|
||||
url.setPort(1042);
|
||||
|
||||
// override with what can be found in the prefs.json file.
|
||||
QFile prefFile(QString("%1/%2").arg(bridgelib::userConfigDir(), "prefs.json"));
|
||||
QFile prefFile(QString("%1/%2").arg(bridgepp::userConfigDir(), "prefs.json"));
|
||||
if (prefFile.exists()) {
|
||||
prefFile.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
QByteArray data = prefFile.readAll();
|
||||
@ -186,7 +185,7 @@ QUrl getApiUrl() {
|
||||
/// \return true if an instance of bridge is already running.
|
||||
//****************************************************************************************************************************************************
|
||||
bool isBridgeRunning() {
|
||||
QLockFile lockFile(QDir(bridgelib::userCacheDir()).absoluteFilePath(bridgeLock));
|
||||
QLockFile lockFile(QDir(bridgepp::userCacheDir()).absoluteFilePath(bridgeLock));
|
||||
return (!lockFile.tryLock()) && (lockFile.error() == QLockFile::LockFailedError);
|
||||
}
|
||||
|
||||
@ -198,7 +197,7 @@ void focusOtherInstance() {
|
||||
try {
|
||||
FocusGRPCClient client;
|
||||
GRPCConfig sc;
|
||||
QString const path = FocusGRPCClient::grpcFocusServerConfigPath(bridgelib::userConfigDir());
|
||||
QString const path = FocusGRPCClient::grpcFocusServerConfigPath(bridgepp::userConfigDir());
|
||||
QFile file(path);
|
||||
if (file.exists()) {
|
||||
if (!sc.load(path)) {
|
||||
@ -277,8 +276,7 @@ int main(int argc, char *argv[]) {
|
||||
BridgeApp guiApp(argc, argv);
|
||||
|
||||
try {
|
||||
bridgelib::loadLibrary();
|
||||
QString const& configDir = bridgelib::userConfigDir();
|
||||
QString const& configDir = bridgepp::userConfigDir();
|
||||
|
||||
// Init sentry.
|
||||
initSentry();
|
||||
@ -290,7 +288,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
Log &log = initLog();
|
||||
|
||||
QLockFile lock(bridgelib::userCacheDir() + "/" + bridgeGUILock);
|
||||
QLockFile lock(bridgepp::userCacheDir() + "/" + bridgeGUILock);
|
||||
if (!checkSingleInstance(lock)) {
|
||||
focusOtherInstance();
|
||||
return EXIT_FAILURE;
|
||||
|
||||
@ -231,7 +231,7 @@ QtObject {
|
||||
}
|
||||
|
||||
function getTrayIconPath() {
|
||||
var color = Backend.goOS() == "darwin" ? "mono" : "color"
|
||||
var color = Backend.goos == "darwin" ? "mono" : "color"
|
||||
|
||||
var level = "norm"
|
||||
if (_systrayfilter.topmost) {
|
||||
|
||||
@ -45,7 +45,7 @@ Item {
|
||||
property string link: "https://proton.me/support/protonmail-bridge-clients-apple-mail"
|
||||
|
||||
Component.onCompleted : {
|
||||
if (Backend.goOS() == "darwin") {
|
||||
if (Backend.goos == "darwin") {
|
||||
append({
|
||||
"name" : "Apple Mail",
|
||||
"iconSource" : "/qml/icons/ic-apple-mail.svg",
|
||||
@ -59,7 +59,7 @@ Item {
|
||||
"link" : "https://proton.me/support/protonmail-bridge-clients-macos-outlook-2019"
|
||||
})
|
||||
}
|
||||
if (Backend.goOS() == "windows") {
|
||||
if (Backend.goos == "windows") {
|
||||
append({
|
||||
"name" : "Microsoft Outlook",
|
||||
"iconSource" : "/qml/icons/ic-microsoft-outlook.svg",
|
||||
|
||||
Reference in New Issue
Block a user