mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 14:56:42 +00:00
Other: bridge-gui-tester.
WIP: Added bridge-gui-test app. WIP: goos. WIP: event sending. WIP: include bridge-gui-tester in frontend project WIP: app end login event buttons. WIP: login events. . WIP: moved and renamed tab code WIP: wired login logic. WIP: setColorScheme and loginAbort. WIP: more calls implemented + random users and numbers. WIP: mail calls. WIP: bug reports. WIP: more signal send via the grpc Qt proxy. WIP: Qt proxy on the event stream tab. WIP: user change events wiring. WIP: GUI changes. WIP: minor refactoring. WIP: remove event stream tab. WIP: GUI changes. WIP: separate logs, cache and keychain implemented. WIP: Automatic update. Other: fix linux build. WIP: fix for live addition/modification/removal of users on the server side.
This commit is contained in:
98
internal/frontend/bridge-gui/bridge-gui-tester/main.cpp
Normal file
98
internal/frontend/bridge-gui/bridge-gui-tester/main.cpp
Normal file
@ -0,0 +1,98 @@
|
||||
// Copyright (c) 2022 Proton AG
|
||||
//
|
||||
// This file is part of Proton Mail Bridge.
|
||||
//
|
||||
// Proton Mail Bridge is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Proton Mail Bridge is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Proton Mail Bridge. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "AppController.h"
|
||||
#include "GRPCServerWorker.h"
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
#include <bridgepp/Exception/Exception.h>
|
||||
#include <bridgepp/Worker/Overseer.h>
|
||||
|
||||
|
||||
#ifndef BRIDGE_APP_VERSION
|
||||
#error "BRIDGE_APP_VERSION is not defined"
|
||||
#endif
|
||||
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
|
||||
QString const applicationName = "Proton Mail Bridge GUI Tester"; ///< The name of the application.
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
using namespace bridgepp;
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] argc The number of command-line arguments.
|
||||
/// \param[in] argv The list of command-line arguments.
|
||||
/// \return The exit code for the application.
|
||||
//****************************************************************************************************************************************************
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
QApplication::setApplicationName(applicationName);
|
||||
QApplication::setOrganizationName("Proton AG");
|
||||
QApplication::setOrganizationDomain("proton.ch");
|
||||
QApplication::setQuitOnLastWindowClosed(true);
|
||||
|
||||
app().log().setEchoInConsole(true);
|
||||
app().log().info(QString("%1 started.").arg(applicationName));
|
||||
|
||||
MainWindow window(nullptr);
|
||||
app().setMainWindow(&window);
|
||||
window.setWindowTitle(QApplication::applicationName());
|
||||
window.show();
|
||||
|
||||
GRPCServerWorker *serverWorker = new GRPCServerWorker(nullptr);
|
||||
QObject::connect(serverWorker, &Worker::started, []() { app().log().info("Server worker started."); });
|
||||
QObject::connect(serverWorker, &Worker::finished, []() { app().log().info("Server worker finished."); });
|
||||
QObject::connect(serverWorker, &Worker::error, [](QString const &message) {
|
||||
throw Exception(QString("gRPC Server encountered an error: %1").arg(message));
|
||||
});
|
||||
UPOverseer overseer = std::make_unique<Overseer>(serverWorker, nullptr);
|
||||
overseer->startWorker(true);
|
||||
|
||||
qint32 const exitCode = QApplication::exec();
|
||||
|
||||
serverWorker->stop();
|
||||
while (!overseer->isFinished())
|
||||
{
|
||||
QThread::msleep(10);
|
||||
}
|
||||
|
||||
app().log().info(QString("%1 exiting with code %2.").arg(applicationName).arg(exitCode));
|
||||
|
||||
return exitCode;
|
||||
|
||||
}
|
||||
catch (Exception const &e)
|
||||
{
|
||||
QTextStream(stderr) << QString("A fatal error occurred: %1\n").arg(e.qwhat());
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user