mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
GODT-1675: Pass app name and vendor from topmost Makefile.
This commit is contained in:
@ -24,6 +24,9 @@ const VendorName = "protonmail"
|
||||
|
||||
//nolint:gochecknoglobals
|
||||
var (
|
||||
// Version of the build.
|
||||
FullAppName = ""
|
||||
|
||||
// Version of the build.
|
||||
Version = ""
|
||||
|
||||
|
||||
@ -28,6 +28,20 @@ include(../BridgeSetup.cmake)
|
||||
|
||||
project(bridge-gui LANGUAGES CXX)
|
||||
|
||||
if (NOT DEFINED BRIDGE_APP_FULL_NAME)
|
||||
message(FATAL_ERROR "BRIDGE_APP_FULL_NAME is not defined.")
|
||||
else()
|
||||
message(STATUS "App name is ${BRIDGE_APP_FULL_NAME}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED BRIDGE_VENDOR)
|
||||
message(FATAL_ERROR "BRIDGE_VENDOR is not defined.")
|
||||
else()
|
||||
message(STATUS "App vendor is ${BRIDGE_VENDOR}")
|
||||
endif()
|
||||
|
||||
|
||||
|
||||
if (NOT DEFINED BRIDGE_APP_VERSION)
|
||||
message(FATAL_ERROR "BRIDGE_APP_VERSION is not defined.")
|
||||
else()
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
|
||||
|
||||
#include "DockIcon/DockIcon.h"
|
||||
#include "Version.h"
|
||||
#include "UserList.h"
|
||||
#include <bridgepp/GRPC/GRPCClient.h>
|
||||
#include <bridgepp/GRPC/GRPCUtils.h>
|
||||
@ -57,6 +58,8 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
Q_PROPERTY(QUrl releaseNotesLink READ releaseNotesLink NOTIFY releaseNotesLinkChanged) // _ core.QUrl `property:"releaseNotesLink"`
|
||||
Q_PROPERTY(QUrl dependencyLicensesLink READ dependencyLicensesLink NOTIFY dependencyLicensesLinkChanged) // _ core.QUrl `property:"dependencyLicensesLink"`
|
||||
Q_PROPERTY(QUrl landingPageLink READ landingPageLink NOTIFY landingPageLinkChanged) // _ core.QUrl `property:"landingPageLink"`
|
||||
Q_PROPERTY(QString appname READ appname NOTIFY appnameChanged) // _ string `property:"version"`
|
||||
Q_PROPERTY(QString vendor READ vendor NOTIFY vendorChanged) // _ string `property:"version"`
|
||||
Q_PROPERTY(QString version READ version NOTIFY versionChanged) // _ string `property:"version"`
|
||||
Q_PROPERTY(QString hostname READ hostname NOTIFY hostnameChanged) // _ string `property:"hostname"`
|
||||
Q_PROPERTY(bool isAutostartOn READ isAutostartOn NOTIFY isAutostartOnChanged) // _ bool `property:"isAutostartOn"`
|
||||
@ -86,6 +89,8 @@ public: // Qt/QML properties. Note that the NOTIFY-er signal is required even fo
|
||||
QUrl releaseNotesLink() const { QUrl link; app().grpc().releaseNotesPageLink(link); return link; }
|
||||
QUrl dependencyLicensesLink() const { QUrl link; app().grpc().dependencyLicensesLink(link); return link; }
|
||||
QUrl landingPageLink() const { QUrl link; app().grpc().landingPageLink(link); return link; }
|
||||
QString appname() const { return QString(PROJECT_FULL_NAME); }
|
||||
QString vendor() const { return QString(PROJECT_VENDOR); }
|
||||
QString version() const { QString version; app().grpc().version(version); return version; }
|
||||
QString hostname() const { QString hostname; app().grpc().hostname(hostname); return hostname; }
|
||||
bool isAutostartOn() const { bool v; app().grpc().isAutostartOn(v); return v; };
|
||||
@ -121,6 +126,8 @@ signals: // Signal used by the Qt property system. Many of them are unused but r
|
||||
void releaseNotesLinkChanged(QUrl const &link);
|
||||
void dependencyLicensesLinkChanged(QUrl const &link);
|
||||
void landingPageLinkChanged(QUrl const &link);
|
||||
void appnameChanged(QString const &appname);
|
||||
void vendorChanged(QString const &vendor);
|
||||
void versionChanged(QString const &version);
|
||||
void currentEmailClientChanged(QString const &email);
|
||||
void currentKeychainChanged(QString const &keychain);
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
#ifndef BRIDGE_GUI_VERSION_H
|
||||
#define BRIDGE_GUI_VERSION_H
|
||||
|
||||
#define PROJECT_FULL_NAME "@BRIDGE_APP_FULL_NAME@"
|
||||
#define PROJECT_VENDOR "@BRIDGE_VENDOR@"
|
||||
#define PROJECT_VER "@BRIDGE_APP_VERSION@"
|
||||
#define PROJECT_REVISION "@BRIDGE_REVISION@"
|
||||
#define PROJECT_BUILD_TIME "@BRIDGE_BUILD_TIME@"
|
||||
|
||||
@ -25,22 +25,23 @@ fi
|
||||
BRIDGE_REPO_ROOT="../../../.."
|
||||
BRIDGE_INSTALL_PATH=${BRIDGE_INSTALL_PATH:-deploy}
|
||||
BRIDGE_APP_VERSION=${BRIDGE_APP_VERSION:-$("${BRIDGE_REPO_ROOT}/utils/bridge_app_version.sh")}
|
||||
BRIDGE_VENDOR=${BRIDGE_VENDOR:-"Proton AG"}
|
||||
BUILD_CONFIG=${BRIDGE_GUI_BUILD_CONFIG:-Debug}
|
||||
BUILD_DIR=$(echo "./cmake-build-${BUILD_CONFIG}" | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
realpath() {
|
||||
START_DIR=$PWD
|
||||
BASENAME="$(basename "$1")"
|
||||
cd "$(dirname "$1")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
while [ "$LNK" ]; do
|
||||
BASENAME="$(basename "$LNK")"
|
||||
cd "$(dirname "$LNK")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
done
|
||||
REALPATH="$PWD/$BASENAME"
|
||||
cd "$START_DIR" || exit
|
||||
echo "$REALPATH"
|
||||
START_DIR=$PWD
|
||||
BASENAME="$(basename "$1")"
|
||||
cd "$(dirname "$1")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
while [ "$LNK" ]; do
|
||||
BASENAME="$(basename "$LNK")"
|
||||
cd "$(dirname "$LNK")" || exit
|
||||
LNK="$(readlink "$BASENAME")"
|
||||
done
|
||||
REALPATH="$PWD/$BASENAME"
|
||||
cd "$START_DIR" || exit
|
||||
echo "$REALPATH"
|
||||
}
|
||||
|
||||
check_exit() {
|
||||
@ -86,6 +87,8 @@ ${VCPKG_EXE} upgrade --no-dry-run
|
||||
|
||||
cmake \
|
||||
-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}" \
|
||||
-DBRIDGE_APP_FULL_NAME="${BRIDGE_APP_FULL_NAME}" \
|
||||
-DBRIDGE_VENDOR="${BRIDGE_VENDOR}" \
|
||||
-DBRIDGE_APP_VERSION="${BRIDGE_APP_VERSION}" \
|
||||
-G Ninja \
|
||||
-S . \
|
||||
|
||||
@ -30,7 +30,7 @@ using namespace bridgepp;
|
||||
namespace
|
||||
{
|
||||
|
||||
/// \brief The file extension for the bridge executable file.
|
||||
/// \brief The file extension for the bridge executable file.
|
||||
#ifdef Q_OS_WIN32
|
||||
QString const exeSuffix = ".exe";
|
||||
#else
|
||||
@ -62,12 +62,12 @@ void initQtApplication()
|
||||
if ((!qsgInfo.isEmpty()) && (qsgInfo != "0"))
|
||||
QLoggingCategory::setFilterRules("qt.scenegraph.general=true");
|
||||
|
||||
QGuiApplication::setApplicationName("Proton Mail Bridge");
|
||||
QGuiApplication::setApplicationName(PROJECT_FULL_NAME);
|
||||
QGuiApplication::setApplicationVersion(PROJECT_VER);
|
||||
QGuiApplication::setOrganizationName("Proton AG");
|
||||
QGuiApplication::setOrganizationName(PROJECT_VENDOR);
|
||||
QGuiApplication::setOrganizationDomain("proton.ch");
|
||||
QGuiApplication::setQuitOnLastWindowClosed(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
@ -147,7 +147,7 @@ void parseArguments(int argc, char *argv[], QStringList& args, QString& launcher
|
||||
launcher = QString::fromLocal8Bit(argv[0]);
|
||||
// for unknown reasons, on Windows QCoreApplication::arguments() frequently returns an empty list, which is incorrect, so we rebuild the argument
|
||||
// list from the original argc and argv values.
|
||||
for (int i = 1; i < argc; i++) {
|
||||
for (int i = 1; i < argc; i++) {
|
||||
QString const &arg = QString::fromLocal8Bit(argv[i]);
|
||||
// we can't use QCommandLineParser here since it will fail on unknown options.
|
||||
// Arguments may contain some bridge flags.
|
||||
@ -274,9 +274,9 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
app().log().debug(QString("Monitoring Bridge PID : %1").arg(status.pid));
|
||||
connection = QObject::connect(bridgeMonitor, &ProcessMonitor::processExited, [&](int returnCode) {
|
||||
bridgeExited = true;// clazy:exclude=lambda-in-connect
|
||||
qGuiApp->exit(returnCode);
|
||||
});
|
||||
bridgeExited = true;// clazy:exclude=lambda-in-connect
|
||||
qGuiApp->exit(returnCode);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ QtObject {
|
||||
return Math.max(lower_limit, Math.min(upper_limit, num))
|
||||
}
|
||||
|
||||
property var title: "Proton Mail Bridge"
|
||||
property var title: Backend.appname
|
||||
|
||||
property Notifications _notifications: Notifications {
|
||||
id: notifications
|
||||
|
||||
@ -108,8 +108,10 @@ SettingsView {
|
||||
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
text: qsTr("Proton Mail Bridge v%1<br>© 2021 Proton AG<br>%2 %3<br>%4").
|
||||
text: qsTr("%1 v%2<br>© 2021 %3<br>%4 %5<br>%6").
|
||||
arg(Backend.appname).
|
||||
arg(Backend.version).
|
||||
arg(Backend.vendor).
|
||||
arg(link(Backend.licensePath, qsTr("License"))).
|
||||
arg(link(Backend.dependencyLicensesLink, qsTr("Dependencies"))).
|
||||
arg(link(Backend.releaseNotesLink, qsTr("Release notes")))
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/events"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/types"
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||
@ -319,8 +320,8 @@ func (f *frontendCLI) watchEvents() {
|
||||
|
||||
// Loop starts the frontend loop with an interactive shell.
|
||||
func (f *frontendCLI) Loop() error {
|
||||
f.Print(`
|
||||
Welcome to Proton Mail Bridge interactive shell
|
||||
f.Printf(`
|
||||
Welcome to %s interactive shell
|
||||
___....___
|
||||
^^ __..-:'':__:..:__:'':-..__
|
||||
_.-:__:.-:'': : : :'':-.:__:-._
|
||||
@ -335,7 +336,7 @@ func (f *frontendCLI) Loop() error {
|
||||
[ ] [ ]
|
||||
jgs [ ] [ ]
|
||||
~~^_~^~/ \~^-~^~ _~^-~_^~-^~_^~~-^~_~^~-~_~-^~_^/ \~^ ~~_ ^
|
||||
`)
|
||||
`, constants.FullAppName)
|
||||
f.Run()
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user