feat(GODT-3121): fix issues reported by the resharper C++ engine.
This commit is contained in:
parent
ebeca394c7
commit
39b31abef8
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "AppController.h"
|
||||
#include "GRPCService.h"
|
||||
#include <bridgepp/GRPC/GRPCUtils.h>
|
||||
#include <bridgepp/Exception/Exception.h>
|
||||
#include "MainWindow.h"
|
||||
#include <bridgepp/Log/Log.h>
|
||||
|
@ -68,7 +67,7 @@ void AppController::setMainWindow(MainWindow *mainWindow) {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return The main window.
|
||||
//****************************************************************************************************************************************************
|
||||
MainWindow &AppController::mainWindow() {
|
||||
MainWindow &AppController::mainWindow() const {
|
||||
if (!mainWindow_) {
|
||||
throw Exception("mainWindow has not yet been registered.");
|
||||
}
|
||||
|
@ -79,7 +78,7 @@ MainWindow &AppController::mainWindow() {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return A reference to the log.
|
||||
//****************************************************************************************************************************************************
|
||||
bridgepp::Log &AppController::log() {
|
||||
bridgepp::Log &AppController::log() const {
|
||||
return *log_;
|
||||
}
|
||||
|
||||
|
@ -87,7 +86,7 @@ bridgepp::Log &AppController::log() {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return A reference to the bridge-gui log.
|
||||
//****************************************************************************************************************************************************
|
||||
bridgepp::Log &AppController::bridgeGUILog() {
|
||||
bridgepp::Log &AppController::bridgeGUILog() const {
|
||||
return *bridgeGUILog_;
|
||||
}
|
||||
|
||||
|
@ -95,6 +94,6 @@ bridgepp::Log &AppController::bridgeGUILog() {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return A reference to the gRPC service.
|
||||
//****************************************************************************************************************************************************
|
||||
GRPCService &AppController::grpc() {
|
||||
GRPCService &AppController::grpc() const {
|
||||
return *grpc_;
|
||||
}
|
||||
|
|
|
@ -42,10 +42,10 @@ public: // member functions.
|
|||
AppController &operator=(AppController const &) = delete; ///< Disabled assignment operator.
|
||||
AppController &operator=(AppController &&) = delete; ///< Disabled move assignment operator.
|
||||
void setMainWindow(MainWindow *mainWindow); ///< Set the main window.
|
||||
MainWindow &mainWindow(); ///< Return the main window.
|
||||
bridgepp::Log &log(); ///< Return a reference to the log.
|
||||
bridgepp::Log &bridgeGUILog(); ///< Return a reference to the bridge-gui log.
|
||||
GRPCService &grpc(); ///< Return a reference to the gRPC service.
|
||||
MainWindow &mainWindow() const; ///< Return the main window.
|
||||
bridgepp::Log &log() const; ///< Return a reference to the log.
|
||||
bridgepp::Log &bridgeGUILog() const; ///< Return a reference to the bridge-gui log.
|
||||
GRPCService &grpc() const; ///< Return a reference to the gRPC service.
|
||||
|
||||
private: // member functions.
|
||||
AppController(); ///< Default constructor.
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace grpc;
|
|||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] The server token expected from gRPC calls
|
||||
/// \param[in] serverToken The server token expected from gRPC calls
|
||||
//****************************************************************************************************************************************************
|
||||
GRPCMetadataProcessor::GRPCMetadataProcessor(QString const &serverToken)
|
||||
: serverToken_(serverToken.toStdString()) {
|
||||
|
@ -43,16 +43,16 @@ bool GRPCMetadataProcessor::IsBlocking() const {
|
|||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] inputMeta
|
||||
/// \param authMetadata The authentication metadata.
|
||||
/// \return the result of the metadata processing.
|
||||
//****************************************************************************************************************************************************
|
||||
Status GRPCMetadataProcessor::Process(AuthMetadataProcessor::InputMetadata const &auth_metadata, AuthContext *,
|
||||
AuthMetadataProcessor::OutputMetadata *, AuthMetadataProcessor::OutputMetadata *) {
|
||||
Status GRPCMetadataProcessor::Process(InputMetadata const &authMetadata, AuthContext *,
|
||||
OutputMetadata *, OutputMetadata *) {
|
||||
try {
|
||||
AuthMetadataProcessor::InputMetadata::const_iterator pathIt = auth_metadata.find(":path");
|
||||
QString const callName = (pathIt == auth_metadata.end()) ? ("unkown gRPC call") : QString::fromLocal8Bit(pathIt->second);
|
||||
const InputMetadata::const_iterator pathIt = authMetadata.find(":path");
|
||||
QString const callName = (pathIt == authMetadata.end()) ? ("unkown gRPC call") : QString::fromLocal8Bit(pathIt->second);
|
||||
|
||||
AuthMetadataProcessor::InputMetadata::size_type const count = auth_metadata.count(grpcMetadataServerTokenKey);
|
||||
AuthMetadataProcessor::InputMetadata::size_type const count = authMetadata.count(grpcMetadataServerTokenKey);
|
||||
if (count == 0) {
|
||||
throw Exception(QString("Missing server token in gRPC client call '%1'.").arg(callName));
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ Status GRPCMetadataProcessor::Process(AuthMetadataProcessor::InputMetadata const
|
|||
throw Exception(QString("Several server tokens were provided in gRPC client call '%1'.").arg(callName));
|
||||
}
|
||||
|
||||
if (auth_metadata.find(grpcMetadataServerTokenKey)->second != serverToken_) {
|
||||
if (authMetadata.find(grpcMetadataServerTokenKey)->second != serverToken_) {
|
||||
throw Exception(QString("Invalid server token provided by gRPC client call '%1'.").arg(callName));
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ Status GRPCMetadataProcessor::Process(AuthMetadataProcessor::InputMetadata const
|
|||
}
|
||||
catch (Exception const &e) {
|
||||
app().log().error(e.qwhat());
|
||||
return Status(StatusCode::UNAUTHENTICATED, e.qwhat().toStdString());
|
||||
return Status(UNAUTHENTICATED, e.qwhat().toStdString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ public: // member functions.
|
|||
GRPCMetadataProcessor &operator=(GRPCMetadataProcessor const &) = delete; ///< Disabled assignment operator.
|
||||
GRPCMetadataProcessor &operator=(GRPCMetadataProcessor &&) = delete; ///< Disabled move assignment operator.
|
||||
bool IsBlocking() const override; ///< Is the processor blocking?
|
||||
grpc::Status Process(InputMetadata const &auth_metadata, grpc::AuthContext *context, OutputMetadata *consumed_auth_metadata,
|
||||
grpc::Status Process(InputMetadata const &authMetadata, grpc::AuthContext *context, OutputMetadata *consumed_auth_metadata,
|
||||
OutputMetadata *response_metadata) override; ///< Process the metadata
|
||||
|
||||
private:
|
||||
|
|
|
@ -31,10 +31,10 @@ GRPCQtProxy::GRPCQtProxy()
|
|||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void GRPCQtProxy::connectSignals() {
|
||||
void GRPCQtProxy::connectSignals() const {
|
||||
MainWindow &mainWindow = app().mainWindow();
|
||||
SettingsTab &settingsTab = mainWindow.settingsTab();
|
||||
UsersTab &usersTab = mainWindow.usersTab();
|
||||
SettingsTab const &settingsTab = mainWindow.settingsTab();
|
||||
UsersTab const &usersTab = mainWindow.usersTab();
|
||||
connect(this, &GRPCQtProxy::delayedEventRequested, &mainWindow, &MainWindow::sendDelayedEvent);
|
||||
connect(this, &GRPCQtProxy::setIsAutostartOnReceived, &settingsTab, &SettingsTab::setIsAutostartOn);
|
||||
connect(this, &GRPCQtProxy::setIsBetaEnabledReceived, &settingsTab, &SettingsTab::setIsBetaEnabled);
|
||||
|
@ -157,8 +157,8 @@ void GRPCQtProxy::setClientPlatform(QString const &clientPlatform) {
|
|||
/// \param[in] useSSLForIMAP The IMAP connexion mode.
|
||||
/// \param[in] useSSLForSMTP The IMAP connexion mode.
|
||||
//****************************************************************************************************************************************************
|
||||
void GRPCQtProxy::setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool userSSLForSMTP) {
|
||||
emit setMailServerSettingsReceived(imapPort, smtpPort, useSSLForIMAP, userSSLForSMTP);
|
||||
void GRPCQtProxy::setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool useSSLForSMTP) {
|
||||
emit setMailServerSettingsReceived(imapPort, smtpPort, useSSLForIMAP, useSSLForSMTP);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ public: // member functions.
|
|||
GRPCQtProxy &operator=(GRPCQtProxy const &) = delete; ///< Disabled assignment operator.
|
||||
GRPCQtProxy &operator=(GRPCQtProxy &&) = delete; ///< Disabled move assignment operator.
|
||||
|
||||
void connectSignals(); // connect the signals to the main window.
|
||||
void connectSignals() const; // connect the signals to the main window.
|
||||
void sendDelayedEvent(bridgepp::SPStreamEvent const &event); ///< Sends a delayed stream event.
|
||||
void setIsAutostartOn(bool on); ///< Forwards a SetIsAutostartOn call via a Qt signal.
|
||||
void setIsBetaEnabled(bool enabled); ///< Forwards a SetIsBetaEnabled call via a Qt signal.
|
||||
|
@ -49,7 +49,7 @@ public: // member functions.
|
|||
void exportTLSCertificates(QString const &folderPath); //< Forward an 'ExportTLSCertificates' call via a Qt signal.
|
||||
void setIsStreaming(bool isStreaming); ///< Forward a isStreaming internal messages via a Qt signal.
|
||||
void setClientPlatform(QString const &clientPlatform); ///< Forward a setClientPlatform call via a Qt signal.
|
||||
void setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool userSSLForSMTP); ///< Forwards a setMailServerSettings' call via a Qt signal.
|
||||
void setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Forwards a setMailServerSettings' call via a Qt signal.
|
||||
void setIsDoHEnabled(bool enabled); ///< Forwards a setIsDoHEnabled call via a Qt signal.
|
||||
void setDiskCachePath(QString const &path); ///< Forwards a setDiskCachePath call via a Qt signal.
|
||||
void setIsAutomaticUpdateOn(bool on); ///< Forwards a SetIsAutomaticUpdateOn call via a Qt signal.
|
||||
|
|
|
@ -50,7 +50,7 @@ void GRPCServerWorker::run() {
|
|||
SslServerCredentialsOptions ssl_opts;
|
||||
ssl_opts.pem_root_certs = "";
|
||||
ssl_opts.pem_key_cert_pairs.push_back(pair);
|
||||
std::shared_ptr<ServerCredentials> credentials = grpc::SslServerCredentials(ssl_opts);
|
||||
std::shared_ptr<ServerCredentials> const credentials = SslServerCredentials(ssl_opts);
|
||||
|
||||
GRPCConfig config;
|
||||
config.cert = testTLSCert;
|
||||
|
@ -59,8 +59,7 @@ void GRPCServerWorker::run() {
|
|||
credentials->SetAuthMetadataProcessor(processor_); // gRPC interceptors are still experimental in C++, so we use AuthMetadataProcessor
|
||||
ServerBuilder builder;
|
||||
int port = 0; // Port will not be known until ServerBuilder::BuildAndStart() is called
|
||||
bool const useFileSocket = useFileSocketForGRPC();
|
||||
if (useFileSocket) {
|
||||
if (useFileSocketForGRPC()) {
|
||||
QString const fileSocketPath = getAvailableFileSocketPath();
|
||||
if (fileSocketPath.isEmpty()) {
|
||||
throw Exception("Could not get an available file socket.");
|
||||
|
@ -102,7 +101,7 @@ void GRPCServerWorker::run() {
|
|||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void GRPCServerWorker::stop() {
|
||||
void GRPCServerWorker::stop() const {
|
||||
if (server_) {
|
||||
server_->Shutdown();
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ public: // member functions.
|
|||
GRPCServerWorker &operator=(GRPCServerWorker &&) = delete; ///< Disabled move assignment operator.
|
||||
|
||||
void run() override; ///< Run the worker.
|
||||
void stop(); ///< Stop the gRPC service.
|
||||
void stop() const; ///< Stop the gRPC service.
|
||||
|
||||
private: // data members
|
||||
std::unique_ptr<grpc::Server> server_ { nullptr }; ///< The gRPC server.
|
||||
|
|
|
@ -39,7 +39,7 @@ QString const defaultKeychain = "defaultKeychain"; ///< The default keychain.
|
|||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void GRPCService::connectProxySignals() {
|
||||
void GRPCService::connectProxySignals() const {
|
||||
qtProxy_.connectSignals();
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ Status GRPCService::SetIsAllMailVisible(ServerContext *, BoolValue const *reques
|
|||
/// \param[out] response The response.
|
||||
/// \return The status for the call.
|
||||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::IsAllMailVisible(ServerContext *, Empty const *request, BoolValue *response) {
|
||||
Status GRPCService::IsAllMailVisible(ServerContext *, Empty const *, BoolValue *response) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
response->set_value(app().mainWindow().settingsTab().isAllMailVisible());
|
||||
return Status::OK;
|
||||
|
@ -409,7 +409,7 @@ Status GRPCService::Login(ServerContext *, LoginRequest const *request, Empty *)
|
|||
UsersTab &usersTab = app().mainWindow().usersTab();
|
||||
loginUsername_ = QString::fromStdString(request->username());
|
||||
|
||||
SPUser const& user = usersTab.userTable().userWithUsernameOrEmail(QString::fromStdString(request->username()));
|
||||
SPUser const &user = usersTab.userTable().userWithUsernameOrEmail(QString::fromStdString(request->username()));
|
||||
if (user) {
|
||||
qtProxy_.sendDelayedEvent(newLoginAlreadyLoggedInEvent(user->id()));
|
||||
return Status::OK;
|
||||
|
@ -444,7 +444,7 @@ Status GRPCService::Login(ServerContext *, LoginRequest const *request, Empty *)
|
|||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::Login2FA(ServerContext *, LoginRequest const *request, Empty *) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
UsersTab &usersTab = app().mainWindow().usersTab();
|
||||
UsersTab const &usersTab = app().mainWindow().usersTab();
|
||||
if (usersTab.nextUserTFAError()) {
|
||||
qtProxy_.sendDelayedEvent(newLoginError(LoginErrorType::TFA_ERROR, "2FA Error."));
|
||||
return Status::OK;
|
||||
|
@ -469,7 +469,7 @@ Status GRPCService::Login2FA(ServerContext *, LoginRequest const *request, Empty
|
|||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::Login2Passwords(ServerContext *, LoginRequest const *request, Empty *) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
UsersTab &usersTab = app().mainWindow().usersTab();
|
||||
UsersTab const &usersTab = app().mainWindow().usersTab();
|
||||
|
||||
if (usersTab.nextUserTwoPasswordsError()) {
|
||||
qtProxy_.sendDelayedEvent(newLoginError(LoginErrorType::TWO_PASSWORDS_ERROR, "Two Passwords error."));
|
||||
|
@ -559,12 +559,12 @@ Status GRPCService::DiskCachePath(ServerContext *, Empty const *, StringValue *r
|
|||
Status GRPCService::SetDiskCachePath(ServerContext *, StringValue const *path, Empty *) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
|
||||
EventsTab &eventsTab = app().mainWindow().eventsTab();
|
||||
EventsTab const &eventsTab = app().mainWindow().eventsTab();
|
||||
QString const qPath = QString::fromStdString(path->value());
|
||||
|
||||
// we mimic the behaviour of Bridge
|
||||
if (!eventsTab.nextCacheChangeWillSucceed()) {
|
||||
qtProxy_.sendDelayedEvent(newDiskCacheErrorEvent(grpc::DiskCacheErrorType(CANT_MOVE_DISK_CACHE_ERROR)));
|
||||
qtProxy_.sendDelayedEvent(newDiskCacheErrorEvent(static_cast<DiskCacheErrorType>(CANT_MOVE_DISK_CACHE_ERROR)));
|
||||
} else {
|
||||
qtProxy_.setDiskCachePath(qPath);
|
||||
qtProxy_.sendDelayedEvent(newDiskCachePathChangedEvent(qPath));
|
||||
|
@ -601,7 +601,7 @@ Status GRPCService::IsDoHEnabled(ServerContext *, Empty const *, BoolValue *resp
|
|||
/// \param[in] settings The IMAP/SMTP settings.
|
||||
/// \return The status for the call.
|
||||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::SetMailServerSettings(::grpc::ServerContext *context, ImapSmtpSettings const *settings, Empty *) {
|
||||
Status GRPCService::SetMailServerSettings(ServerContext *, ImapSmtpSettings const *settings, Empty *) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
qtProxy_.setMailServerSettings(settings->imapport(), settings->smtpport(), settings->usesslforimap(), settings->usesslforsmtp());
|
||||
qtProxy_.sendDelayedEvent(newMailServerSettingsChanged(*settings));
|
||||
|
@ -614,9 +614,9 @@ Status GRPCService::SetMailServerSettings(::grpc::ServerContext *context, ImapSm
|
|||
/// \param[out] outSettings The settings
|
||||
/// \return The status for the call.
|
||||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::MailServerSettings(::grpc::ServerContext *, Empty const *, ImapSmtpSettings *outSettings) {
|
||||
Status GRPCService::MailServerSettings(ServerContext *, Empty const *, ImapSmtpSettings *outSettings) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
SettingsTab &tab = app().mainWindow().settingsTab();
|
||||
SettingsTab const &tab = app().mainWindow().settingsTab();
|
||||
outSettings->set_imapport(tab.imapPort());
|
||||
outSettings->set_smtpport(tab.smtpPort());
|
||||
outSettings->set_usesslforimap(tab.useSSLForIMAP());
|
||||
|
@ -714,8 +714,8 @@ Status GRPCService::GetUserList(ServerContext *, Empty const *, UserListResponse
|
|||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::GetUser(ServerContext *, StringValue const *request, grpc::User *response) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
QString userID = QString::fromStdString(request->value());
|
||||
SPUser user = app().mainWindow().usersTab().userWithID(userID);
|
||||
QString const userID = QString::fromStdString(request->value());
|
||||
SPUser const user = app().mainWindow().usersTab().userWithID(userID);
|
||||
if (!user) {
|
||||
return Status(NOT_FOUND, QString("user not found %1").arg(userID).toStdString());
|
||||
}
|
||||
|
@ -783,14 +783,14 @@ Status GRPCService::ConfigureUserAppleMail(ServerContext *, ConfigureAppleMailRe
|
|||
/// \param[in] request The request
|
||||
/// \return The status for the call.
|
||||
//****************************************************************************************************************************************************
|
||||
Status GRPCService::ExportTLSCertificates(ServerContext *, StringValue const *request, Empty *response) {
|
||||
Status GRPCService::ExportTLSCertificates(ServerContext *, StringValue const *request, Empty *) {
|
||||
app().log().debug(__FUNCTION__);
|
||||
SettingsTab &tab = app().mainWindow().settingsTab();
|
||||
SettingsTab const &tab = app().mainWindow().settingsTab();
|
||||
if (!tab.nextTLSCertExportWillSucceed()) {
|
||||
qtProxy_.sendDelayedEvent(newGenericErrorEvent(grpc::TLS_CERT_EXPORT_ERROR));
|
||||
qtProxy_.sendDelayedEvent(newGenericErrorEvent(TLS_CERT_EXPORT_ERROR));
|
||||
}
|
||||
if (!tab.nextTLSKeyExportWillSucceed()) {
|
||||
qtProxy_.sendDelayedEvent(newGenericErrorEvent(grpc::TLS_KEY_EXPORT_ERROR));
|
||||
qtProxy_.sendDelayedEvent(newGenericErrorEvent(TLS_KEY_EXPORT_ERROR));
|
||||
}
|
||||
qtProxy_.exportTLSCertificates(QString::fromStdString(request->value()));
|
||||
return Status::OK;
|
||||
|
|
|
@ -37,7 +37,7 @@ public: // member functions.
|
|||
~GRPCService() override = default; ///< Destructor.
|
||||
GRPCService &operator=(GRPCService const &) = delete; ///< Disabled assignment operator.
|
||||
GRPCService &operator=(GRPCService &&) = delete; ///< Disabled move assignment operator.
|
||||
void connectProxySignals(); ///< Connect the signals of the Qt Proxy to the GUI components
|
||||
void connectProxySignals() const; ///< Connect the signals of the Qt Proxy to the GUI components
|
||||
bool isStreaming() const; ///< Check if the service is currently streaming events.
|
||||
grpc::Status CheckTokens(::grpc::ServerContext *context, ::google::protobuf::StringValue const *request, ::google::protobuf::StringValue *response) override;
|
||||
grpc::Status AddLogEntry(::grpc::ServerContext *, ::grpc::AddLogEntryRequest const *request, ::google::protobuf::Empty *) override;
|
||||
|
|
|
@ -63,7 +63,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return A reference to the 'General' tab.
|
||||
//****************************************************************************************************************************************************
|
||||
SettingsTab &MainWindow::settingsTab() {
|
||||
SettingsTab &MainWindow::settingsTab() const {
|
||||
return *ui_.settingsTab;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ KnowledgeBaseTab& MainWindow::knowledgeBaseTab() const {
|
|||
/// \param[in] level The log level.
|
||||
/// \param[in] message The log message
|
||||
//****************************************************************************************************************************************************
|
||||
void MainWindow::addLogEntry(bridgepp::Log::Level level, const QString &message) {
|
||||
void MainWindow::addLogEntry(bridgepp::Log::Level level, const QString &message) const {
|
||||
addEntryToLogEdit(level, message, *ui_.editLog);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ void MainWindow::addLogEntry(bridgepp::Log::Level level, const QString &message)
|
|||
/// \param[in] level The log level.
|
||||
/// \param[in] message The log message
|
||||
//****************************************************************************************************************************************************
|
||||
void MainWindow::addBridgeGUILogEntry(bridgepp::Log::Level level, const QString &message) {
|
||||
void MainWindow::addBridgeGUILogEntry(bridgepp::Log::Level level, const QString &message) const {
|
||||
addEntryToLogEdit(level, message, *ui_.editBridgeGUILog);
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ void MainWindow::addBridgeGUILogEntry(bridgepp::Log::Level level, const QString
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] event The event.
|
||||
//****************************************************************************************************************************************************
|
||||
void MainWindow::sendDelayedEvent(SPStreamEvent const &event) {
|
||||
void MainWindow::sendDelayedEvent(SPStreamEvent const &event) const {
|
||||
QTimer::singleShot(this->eventsTab().eventDelayMs(), [event] { app().grpc().sendEvent(event); });
|
||||
}
|
||||
|
||||
|
|
|
@ -38,17 +38,17 @@ public: // member functions.
|
|||
MainWindow &operator=(MainWindow const &) = delete; ///< Disabled assignment operator.
|
||||
MainWindow &operator=(MainWindow &&) = delete; ///< Disabled move assignment operator.
|
||||
|
||||
SettingsTab &settingsTab(); ///< Returns a reference the 'Settings' tab.
|
||||
SettingsTab &settingsTab() const; ///< Returns a reference the 'Settings' tab.
|
||||
UsersTab &usersTab() const; ///< Returns a reference to the 'Users' tab.
|
||||
EventsTab &eventsTab() const; ///< Returns a reference to the 'Events' tab.
|
||||
KnowledgeBaseTab &knowledgeBaseTab() const; ///< Returns a reference to the 'Knowledge Base' tab.
|
||||
|
||||
public slots:
|
||||
void sendDelayedEvent(bridgepp::SPStreamEvent const &event); ///< Sends a gRPC event after the delay specified in the UI. The call is non blocking.
|
||||
void sendDelayedEvent(bridgepp::SPStreamEvent const &event) const; ///< Sends a gRPC event after the delay specified in the UI. The call is non blocking.
|
||||
|
||||
private slots:
|
||||
void addLogEntry(bridgepp::Log::Level level, QString const &message); ///< Add an entry to the log.
|
||||
void addBridgeGUILogEntry(bridgepp::Log::Level level, const QString &message); ///< Add an entry to the log.
|
||||
void addLogEntry(bridgepp::Log::Level level, QString const &message) const; ///< Add an entry to the log.
|
||||
void addBridgeGUILogEntry(bridgepp::Log::Level level, const QString &message) const; ///< Add an entry to the log.
|
||||
|
||||
private:
|
||||
Ui::MainWindow ui_ {}; ///< The GUI for the window.
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace bridgepp;
|
|||
/// \param[in] edit The edit containing the address.
|
||||
/// \param[in] eventGenerator The factory function creating the event.
|
||||
//****************************************************************************************************************************************************
|
||||
void connectAddressError(QPushButton* button, QLineEdit* edit, bridgepp::SPStreamEvent (*eventGenerator)(QString const&)) {
|
||||
void connectAddressError(QPushButton const* button, QLineEdit* edit, SPStreamEvent (*eventGenerator)(QString const&)) {
|
||||
QObject::connect(button, &QPushButton::clicked, [edit, eventGenerator]() { app().grpc().sendEvent(eventGenerator(edit->text())); });
|
||||
}
|
||||
|
||||
|
@ -77,13 +77,6 @@ qint32 EventsTab::eventDelayMs() const {
|
|||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void EventsTab::updateGUIState() {
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \return The bug report results
|
||||
//****************************************************************************************************************************************************
|
||||
|
|
|
@ -45,7 +45,6 @@ public: // member functions.
|
|||
EventsTab& operator=(EventsTab&&) = delete; ///< Disabled move assignment operator.
|
||||
|
||||
qint32 eventDelayMs() const; ///< Get the delay for sending automatically generated events.
|
||||
void updateGUIState(); ///< Update the GUI state.
|
||||
BugReportResult nextBugReportResult() const; ///< Get the value of the 'Next bug report result' combo box.
|
||||
bool isPortFree() const; ///< Get the value for the "Is Port Free" check box.
|
||||
bool nextCacheChangeWillSucceed() const; ///< Get the value for the 'Next Cache Change will succeed' edit.
|
||||
|
@ -53,7 +52,7 @@ public: // member functions.
|
|||
void resetUI() const; ///< Resets the UI.
|
||||
|
||||
private: // data members
|
||||
Ui::EventsTab ui_; ///< The UI for the widget.
|
||||
Ui::EventsTab ui_ {}; ///< The UI for the widget.
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ KnowledgeBaseTab::KnowledgeBaseTab(QWidget* parent)
|
|||
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] checkbox The check box.
|
||||
/// \param[in] widgets The widgets to conditionally enable.
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include "SettingsTab.h"
|
||||
#include "GRPCService.h"
|
||||
#include <bridgepp/GRPC/EventFactory.h>
|
||||
#include <bridgepp/BridgeUtils.h>
|
||||
|
||||
|
||||
|
@ -47,7 +46,7 @@ SettingsTab::SettingsTab(QWidget *parent)
|
|||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::updateGUIState() {
|
||||
bool connected = app().grpc().isStreaming();
|
||||
bool const connected = app().grpc().isStreaming();
|
||||
for (QWidget *widget: { ui_.groupVersion, ui_.groupGeneral, ui_.groupMail, ui_.groupPaths, ui_.groupCache }) {
|
||||
widget->setEnabled(!connected);
|
||||
}
|
||||
|
@ -66,7 +65,7 @@ void SettingsTab::setIsStreaming(bool isStreaming) {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] clientPlatform The client platform.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setClientPlatform(QString const &clientPlatform) {
|
||||
void SettingsTab::setClientPlatform(QString const &clientPlatform) const {
|
||||
ui_.labelClientPlatformValue->setText(clientPlatform);
|
||||
}
|
||||
|
||||
|
@ -131,7 +130,7 @@ bool SettingsTab::isAutostartOn() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] on Should autostart be turned on?
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setIsAutostartOn(bool on) {
|
||||
void SettingsTab::setIsAutostartOn(bool on) const {
|
||||
ui_.checkAutostart->setChecked(on);
|
||||
}
|
||||
|
||||
|
@ -147,7 +146,7 @@ QString SettingsTab::colorSchemeName() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] name True if the 'Use Dark Theme' check box should be checked.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setColorSchemeName(QString const &name) {
|
||||
void SettingsTab::setColorSchemeName(QString const &name) const {
|
||||
ui_.checkDarkTheme->setChecked(name == colorSchemeDark);
|
||||
}
|
||||
|
||||
|
@ -163,7 +162,7 @@ bool SettingsTab::isBetaEnabled() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] enabled The new state for the 'Beta Enabled' check box.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setIsBetaEnabled(bool enabled) {
|
||||
void SettingsTab::setIsBetaEnabled(bool enabled) const {
|
||||
ui_.checkBetaEnabled->setChecked(enabled);
|
||||
}
|
||||
|
||||
|
@ -179,7 +178,7 @@ bool SettingsTab::isAllMailVisible() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] visible The new value for the 'All Mail Visible' check box.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setIsAllMailVisible(bool visible) {
|
||||
void SettingsTab::setIsAllMailVisible(bool visible) const {
|
||||
ui_.checkAllMailVisible->setChecked(visible);
|
||||
}
|
||||
|
||||
|
@ -195,7 +194,7 @@ bool SettingsTab::isTelemetryDisabled() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] isDisabled The new value for the 'Disable Telemetry' check box.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setIsTelemetryDisabled(bool isDisabled) {
|
||||
void SettingsTab::setIsTelemetryDisabled(bool isDisabled) const {
|
||||
ui_.checkIsTelemetryDisabled->setChecked(isDisabled);
|
||||
}
|
||||
|
||||
|
@ -249,7 +248,7 @@ QString SettingsTab::landingPageLink() const {
|
|||
/// \param[in] includeLogs Are the log included.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setBugReport(QString const &osType, QString const &osVersion, QString const &emailClient, QString const &address,
|
||||
QString const &description, bool includeLogs) {
|
||||
QString const &description, bool includeLogs) const {
|
||||
ui_.editOSType->setText(osType);
|
||||
ui_.editOSVersion->setText(osVersion);
|
||||
ui_.editEmailClient->setText(emailClient);
|
||||
|
@ -262,7 +261,7 @@ void SettingsTab::setBugReport(QString const &osType, QString const &osVersion,
|
|||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::installTLSCertificate() {
|
||||
void SettingsTab::installTLSCertificate() const {
|
||||
ui_.labelLastTLSCertInstall->setText(QString("Last install: %1").arg(QDateTime::currentDateTime().toString(Qt::ISODateWithMs)));
|
||||
ui_.checkTLSCertIsInstalled->setChecked(this->nextTLSCertInstallResult() == TLSCertInstallResult::Success);
|
||||
}
|
||||
|
@ -271,7 +270,7 @@ void SettingsTab::installTLSCertificate() {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] folderPath The folder path.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::exportTLSCertificates(QString const &folderPath) {
|
||||
void SettingsTab::exportTLSCertificates(QString const &folderPath) const {
|
||||
ui_.labeLastTLSCertExport->setText(QString("%1 Export to %2").arg(QDateTime::currentDateTime().toString(Qt::ISODateWithMs),folderPath));
|
||||
}
|
||||
|
||||
|
@ -288,7 +287,7 @@ bool SettingsTab::isTLSCertificateInstalled() const {
|
|||
/// \return The value for the 'Next TLS cert install result'.
|
||||
//****************************************************************************************************************************************************
|
||||
SettingsTab::TLSCertInstallResult SettingsTab::nextTLSCertInstallResult() const {
|
||||
return TLSCertInstallResult(ui_.comboNextTLSCertInstallResult->currentIndex());
|
||||
return static_cast<TLSCertInstallResult>(ui_.comboNextTLSCertInstallResult->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,7 +318,7 @@ QString SettingsTab::hostname() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return The value of the IMAP port spin box.
|
||||
//****************************************************************************************************************************************************
|
||||
qint32 SettingsTab::imapPort() {
|
||||
qint32 SettingsTab::imapPort() const {
|
||||
return ui_.spinPortIMAP->value();
|
||||
}
|
||||
|
||||
|
@ -327,7 +326,7 @@ qint32 SettingsTab::imapPort() {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return The value of the SMTP port spin box.
|
||||
//****************************************************************************************************************************************************
|
||||
qint32 SettingsTab::smtpPort() {
|
||||
qint32 SettingsTab::smtpPort() const {
|
||||
return ui_.spinPortSMTP->value();
|
||||
}
|
||||
|
||||
|
@ -338,7 +337,7 @@ qint32 SettingsTab::smtpPort() {
|
|||
/// \param[in] useSSLForIMAP The IMAP connexion mode.
|
||||
/// \param[in] useSSLForSMTP The IMAP connexion mode.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool useSSLForSMTP) {
|
||||
void SettingsTab::setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool useSSLForSMTP) const {
|
||||
ui_.spinPortIMAP->setValue(imapPort);
|
||||
ui_.spinPortSMTP->setValue(smtpPort);
|
||||
ui_.checkUseSSLForIMAP->setChecked(useSSLForIMAP);
|
||||
|
@ -373,7 +372,7 @@ bool SettingsTab::isDoHEnabled() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] enabled The state of the 'DoH enabled' check box.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setIsDoHEnabled(bool enabled) {
|
||||
void SettingsTab::setIsDoHEnabled(bool enabled) const {
|
||||
ui_.checkDoHEnabled->setChecked(enabled);
|
||||
}
|
||||
|
||||
|
@ -381,7 +380,7 @@ void SettingsTab::setIsDoHEnabled(bool enabled) {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] path The path of the local cache.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setDiskCachePath(const QString &path) {
|
||||
void SettingsTab::setDiskCachePath(const QString &path) const {
|
||||
ui_.editDiskCachePath->setText(path);
|
||||
}
|
||||
|
||||
|
@ -405,7 +404,7 @@ bool SettingsTab::isAutomaticUpdateOn() const {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \param[in] on The value for the 'Automatic Update' check.
|
||||
//****************************************************************************************************************************************************
|
||||
void SettingsTab::setIsAutomaticUpdateOn(bool on) {
|
||||
void SettingsTab::setIsAutomaticUpdateOn(bool on) const {
|
||||
ui_.checkAutomaticUpdate->setChecked(on);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@ public: // member functions.
|
|||
bool nextTLSCertExportWillSucceed() const; ///< Get the status of the 'Next TLS Cert export will succeed' check box.
|
||||
bool nextTLSKeyExportWillSucceed() const; ///< Get the status of the 'Next TLS Key export will succeed' check box.
|
||||
QString hostname() const; ///< Get the value of the 'Hostname' edit.
|
||||
qint32 imapPort(); ///< Get the value of the IMAP port spin.
|
||||
qint32 smtpPort(); ///< Get the value of the SMTP port spin.
|
||||
qint32 imapPort() const; ///< Get the value of the IMAP port spin.
|
||||
qint32 smtpPort() const; ///< Get the value of the SMTP port spin.
|
||||
bool useSSLForSMTP() const; ///< Get the value for the 'Use SSL for SMTP' check box.
|
||||
bool useSSLForIMAP() const; ///< Get the value for the 'Use SSL for IMAP' check box.
|
||||
bool isDoHEnabled() const; ///< Get the value for the 'DoH Enabled' check box.
|
||||
|
@ -75,20 +75,20 @@ public: // member functions.
|
|||
public slots:
|
||||
void updateGUIState(); ///< Update the GUI state.
|
||||
void setIsStreaming(bool isStreaming); ///< Set the isStreamingEvents value.
|
||||
void setClientPlatform(QString const &clientPlatform); ///< Set the client platform.
|
||||
void setIsAutostartOn(bool on); ///< Set the value for the 'Autostart' check box.
|
||||
void setIsBetaEnabled(bool enabled); ///< Set the value for the 'Beta Enabled' check box.
|
||||
void setIsAllMailVisible(bool visible); ///< Set the value for the 'All Mail Visible' check box.
|
||||
void setIsTelemetryDisabled(bool isDisabled); ///< Set the value for the 'Disable Telemetry' check box.
|
||||
void setColorSchemeName(QString const &name); ///< Set the value for the 'Use Dark Theme' check box.
|
||||
void setClientPlatform(QString const &clientPlatform) const; ///< Set the client platform.
|
||||
void setIsAutostartOn(bool on) const; ///< Set the value for the 'Autostart' check box.
|
||||
void setIsBetaEnabled(bool enabled) const; ///< Set the value for the 'Beta Enabled' check box.
|
||||
void setIsAllMailVisible(bool visible) const; ///< Set the value for the 'All Mail Visible' check box.
|
||||
void setIsTelemetryDisabled(bool isDisabled) const; ///< Set the value for the 'Disable Telemetry' check box.
|
||||
void setColorSchemeName(QString const &name) const; ///< Set the value for the 'Use Dark Theme' check box.
|
||||
void setBugReport(QString const &osType, QString const &osVersion, QString const &emailClient, QString const &address, QString const &description,
|
||||
bool includeLogs); ///< Set the content of the bug report box.
|
||||
void installTLSCertificate(); ///< Install the TLS certificate.
|
||||
void exportTLSCertificates(QString const &folderPath); ///< Export the TLS certificates.
|
||||
void setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool useSSLForSMTP); ///< Change the mail server settings.
|
||||
void setIsDoHEnabled(bool enabled); ///< Set the value for the 'DoH Enabled' check box.
|
||||
void setDiskCachePath(QString const &path); ///< Set the value for the 'Cache On Disk Enabled' check box.
|
||||
void setIsAutomaticUpdateOn(bool on); ///< Set the value for the 'Automatic Update' check box.
|
||||
bool includeLogs) const; ///< Set the content of the bug report box.
|
||||
void installTLSCertificate() const; ///< Install the TLS certificate.
|
||||
void exportTLSCertificates(QString const &folderPath) const; ///< Export the TLS certificates.
|
||||
void setMailServerSettings(qint32 imapPort, qint32 smtpPort, bool useSSLForIMAP, bool useSSLForSMTP) const; ///< Change the mail server settings.
|
||||
void setIsDoHEnabled(bool enabled) const; ///< Set the value for the 'DoH Enabled' check box.
|
||||
void setDiskCachePath(QString const &path) const; ///< Set the value for the 'Cache On Disk Enabled' check box.
|
||||
void setIsAutomaticUpdateOn(bool on) const; ///< Set the value for the 'Automatic Update' check box.
|
||||
|
||||
private: // member functions.
|
||||
void resetUI(); ///< Reset the widget.
|
||||
|
|
|
@ -85,7 +85,7 @@ void UsersTab::onAddUserButton() {
|
|||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onEditUserButton() {
|
||||
int index = selectedIndex();
|
||||
const int index = selectedIndex();
|
||||
if ((index < 0) || (index >= users_.userCount())) {
|
||||
return;
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ void UsersTab::onEditUserButton() {
|
|||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onRemoveUserButton() {
|
||||
int index = selectedIndex();
|
||||
const int index = selectedIndex();
|
||||
if ((index < 0) || (index >= users_.userCount())) {
|
||||
return;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ void UsersTab::onRemoveUserButton() {
|
|||
//****************************************************************************************************************************************************
|
||||
//
|
||||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onSelectionChanged(QItemSelection, QItemSelection) {
|
||||
void UsersTab::onSelectionChanged(QItemSelection const&, QItemSelection const&) {
|
||||
this->updateGUIState();
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,6 @@ void UsersTab::onSelectionChanged(QItemSelection, QItemSelection) {
|
|||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onSendUserBadEvent() {
|
||||
SPUser const user = selectedUser();
|
||||
int const index = this->selectedIndex();
|
||||
|
||||
if (!user) {
|
||||
app().log().error(QString("%1 failed. Unkown user.").arg(__FUNCTION__));
|
||||
|
@ -175,8 +174,8 @@ void UsersTab::onSendUsedBytesChangedEvent() {
|
|||
app().log().error(QString("%1 failed. User is not connected").arg(__FUNCTION__));
|
||||
}
|
||||
|
||||
qint64 const usedBytes = qint64(ui_.spinUsedBytes->value());
|
||||
user->setUsedBytes(usedBytes);
|
||||
auto const usedBytes = static_cast<qint64>(ui_.spinUsedBytes->value());
|
||||
user->setUsedBytes(static_cast<float>(usedBytes));
|
||||
users_.touch(index);
|
||||
|
||||
GRPCService &grpc = app().grpc();
|
||||
|
@ -224,9 +223,10 @@ void UsersTab::updateGUIState() {
|
|||
QSignalBlocker b(ui_.checkSync);
|
||||
bool const syncing = user && user->isSyncing();
|
||||
ui_.checkSync->setChecked(syncing);
|
||||
// ReSharper disable once CppDFAUnusedValue
|
||||
b = QSignalBlocker(ui_.sliderSync);
|
||||
ui_.sliderSync->setEnabled(syncing);
|
||||
qint32 const progressPercent = syncing ? qint32(user->syncProgress() * 100.0f) : 0;
|
||||
qint32 const progressPercent = syncing ? static_cast<qint32>(user->syncProgress() * 100.0f) : 0;
|
||||
ui_.sliderSync->setValue(progressPercent);
|
||||
ui_.labelSync->setText(syncing ? QString("%1%").arg(progressPercent) : "" );
|
||||
}
|
||||
|
@ -418,7 +418,7 @@ void UsersTab::processBadEventUserFeedback(QString const &userID, bool doResync)
|
|||
return; // we do not do any form of emulation for resync.
|
||||
}
|
||||
|
||||
SPUser user = users_.userWithID(userID);
|
||||
SPUser const user = users_.userWithID(userID);
|
||||
if (!user) {
|
||||
app().log().error(QString("%1(): could not find user with id %1.").arg(__func__, userID));
|
||||
}
|
||||
|
@ -464,12 +464,12 @@ void UsersTab::onCheckSyncToggled(bool checked) {
|
|||
//****************************************************************************************************************************************************
|
||||
void UsersTab::onSliderSyncValueChanged(int value) {
|
||||
SPUser const user = this->selectedUser();
|
||||
if ((!user) || (!user->isSyncing()) || user->syncProgress() == value) {
|
||||
if ((!user) || (!user->isSyncing()) || user->syncProgress() == static_cast<float>(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
double const progress = value / 100.0;
|
||||
user->setSyncProgress(progress);
|
||||
user->setSyncProgress(static_cast<float>(progress));
|
||||
app().grpc().sendEvent(newSyncProgressEvent(user->id(), progress, 1, 1)); // we do not simulate elapsed & remaining.
|
||||
this->updateGUIState();
|
||||
}
|
||||
|
|
|
@ -53,14 +53,14 @@ public slots:
|
|||
void setUserSplitMode(QString const &userID, bool makeItActive); ///< Slot for the split mode.
|
||||
void logoutUser(QString const &userID); ///< slot for the logging out of a user.
|
||||
void removeUser(QString const &userID); ///< Slot for the removal of a user.
|
||||
void configureUserAppleMail(QString const &userID, QString const &address); ///< Slot for the configuration of Apple mail.
|
||||
static void configureUserAppleMail(QString const &userID, QString const &address); ///< Slot for the configuration of Apple mail.
|
||||
void processBadEventUserFeedback(QString const& userID, bool doResync); ///< Slot for the reception of a bad event user feedback.
|
||||
|
||||
private slots:
|
||||
void onAddUserButton(); ///< Add a user to the user list.
|
||||
void onEditUserButton(); ///< Edit the currently selected user.
|
||||
void onRemoveUserButton(); ///< Remove the currently selected user.
|
||||
void onSelectionChanged(QItemSelection, QItemSelection); ///< Slot for the change of the selection.
|
||||
void onSelectionChanged(QItemSelection const&, QItemSelection const&); ///< Slot for the change of the selection.
|
||||
void onSendUserBadEvent(); ///< Slot for the 'Send Bad Event Error' button.
|
||||
void onSendUsedBytesChangedEvent(); ///< Slot for the 'Send Used Bytes Changed Event' button.
|
||||
void onSendIMAPLoginFailedEvent(); ///< Slot for the 'Send IMAP Login failure Event' button.
|
||||
|
|
|
@ -26,7 +26,7 @@ using namespace bridgepp;
|
|||
/// \param[in] user The user.
|
||||
/// \param[in] parent The parent widget of the dialog.
|
||||
//****************************************************************************************************************************************************
|
||||
UserDialog::UserDialog(bridgepp::SPUser &user, QWidget *parent)
|
||||
UserDialog::UserDialog(const bridgepp::SPUser &user, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, user_(user) {
|
||||
ui_.setupUi(this);
|
||||
|
@ -57,8 +57,8 @@ void UserDialog::onOK() {
|
|||
user_->setAvatarText(ui_.editAvatarText->text());
|
||||
user_->setState(this->state());
|
||||
user_->setSplitMode(ui_.checkSplitMode->isChecked());
|
||||
user_->setUsedBytes(float(ui_.spinUsedBytes->value()));
|
||||
user_->setTotalBytes(float(ui_.spinTotalBytes->value()));
|
||||
user_->setUsedBytes(static_cast<float>(ui_.spinUsedBytes->value()));
|
||||
user_->setTotalBytes(static_cast<float>(ui_.spinTotalBytes->value()));
|
||||
|
||||
this->accept();
|
||||
}
|
||||
|
@ -67,14 +67,14 @@ void UserDialog::onOK() {
|
|||
//****************************************************************************************************************************************************
|
||||
/// \return The user state that is currently selected in the dialog.
|
||||
//****************************************************************************************************************************************************
|
||||
UserState UserDialog::state() {
|
||||
return UserState(ui_.comboState->currentIndex());
|
||||
UserState UserDialog::state() const {
|
||||
return static_cast<UserState>(ui_.comboState->currentIndex());
|
||||
}
|
||||
|
||||
|
||||
//****************************************************************************************************************************************************
|
||||
/// \param[in] state The user state to select in the dialog.
|
||||
//****************************************************************************************************************************************************
|
||||
void UserDialog::setState(UserState state) {
|
||||
ui_.comboState->setCurrentIndex(qint32(state));
|
||||
void UserDialog::setState(UserState state) const {
|
||||
ui_.comboState->setCurrentIndex(static_cast<qint32>(state));
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
class UserDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public: // member functions.
|
||||
UserDialog(bridgepp::SPUser &user, QWidget *parent); ///< Default constructor.
|
||||
UserDialog(const bridgepp::SPUser &user, QWidget *parent); ///< Default constructor.
|
||||
UserDialog(UserDialog const &) = delete; ///< Disabled copy-constructor.
|
||||
UserDialog(UserDialog &&) = delete; ///< Disabled assignment copy-constructor.
|
||||
~UserDialog() override = default; ///< Destructor.
|
||||
|
@ -38,8 +38,8 @@ public: // member functions.
|
|||
UserDialog &operator=(UserDialog &&) = delete; ///< Disabled move assignment operator.
|
||||
|
||||
private: // member functions
|
||||
bridgepp::UserState state(); ///< Get the user state selected in the dialog.
|
||||
void setState(bridgepp::UserState state); ///< Set the user state selected in the dialog
|
||||
bridgepp::UserState state() const; ///< Get the user state selected in the dialog.
|
||||
void setState(bridgepp::UserState state) const; ///< Set the user state selected in the dialog
|
||||
|
||||
private slots:
|
||||
void onOK(); ///< Slot for the OK button.
|
||||
|
|
|
@ -35,7 +35,7 @@ UserTable::UserTable(QObject *parent)
|
|||
/// \return The number of rows in the table.
|
||||
//****************************************************************************************************************************************************
|
||||
int UserTable::rowCount(QModelIndex const &) const {
|
||||
return users_.size();
|
||||
return static_cast<int>(users_.size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -111,7 +111,7 @@ QVariant UserTable::headerData(int section, Qt::Orientation orientation, int rol
|
|||
/// \param[in] user The user to add.
|
||||
//****************************************************************************************************************************************************
|
||||
void UserTable::append(SPUser const &user) {
|
||||
qint32 const count = users_.size();
|
||||
qint32 const count = static_cast<int>(users_.size());
|
||||
this->beginInsertRows(QModelIndex(), count, count);
|
||||
users_.append(user);
|
||||
this->endInsertRows();
|
||||
|
@ -122,7 +122,7 @@ void UserTable::append(SPUser const &user) {
|
|||
/// \return The number of users in the table.
|
||||
//****************************************************************************************************************************************************
|
||||
qint32 UserTable::userCount() const {
|
||||
return users_.count();
|
||||
return static_cast<qint32>(users_.count());
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,7 +141,7 @@ bridgepp::SPUser UserTable::userAtIndex(qint32 index) {
|
|||
/// \return A null pointer if the user is not in the list.
|
||||
//****************************************************************************************************************************************************
|
||||
bridgepp::SPUser UserTable::userWithID(QString const &userID) {
|
||||
QList<SPUser>::const_iterator it = std::find_if(users_.constBegin(), users_.constEnd(), [&userID](SPUser const &user) -> bool {
|
||||
QList<SPUser>::const_iterator const it = std::find_if(users_.constBegin(), users_.constEnd(), [&userID](SPUser const &user) -> bool {
|
||||
return user->id() == userID;
|
||||
});
|
||||
|
||||
|
@ -155,7 +155,7 @@ bridgepp::SPUser UserTable::userWithID(QString const &userID) {
|
|||
/// \return A null pointer if the user is not in the list.
|
||||
//****************************************************************************************************************************************************
|
||||
bridgepp::SPUser UserTable::userWithUsernameOrEmail(QString const &username) {
|
||||
QList<SPUser>::const_iterator it = std::find_if(users_.constBegin(), users_.constEnd(), [&username](SPUser const &user) -> bool {
|
||||
QList<SPUser>::const_iterator const it = std::find_if(users_.constBegin(), users_.constEnd(), [&username](SPUser const &user) -> bool {
|
||||
if (user->username().compare(username, Qt::CaseInsensitive) == 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ bridgepp::SPUser UserTable::userWithUsernameOrEmail(QString const &username) {
|
|||
/// \return -1 if the user could not be found.
|
||||
//****************************************************************************************************************************************************
|
||||
qint32 UserTable::indexOfUser(QString const &userID) {
|
||||
QList<SPUser>::const_iterator it = std::find_if(users_.constBegin(), users_.constEnd(), [&userID](SPUser const &user) -> bool {
|
||||
QList<SPUser>::const_iterator const it = std::find_if(users_.constBegin(), users_.constEnd(), [&userID](SPUser const &user) -> bool {
|
||||
return user->id() == userID;
|
||||
});
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public: // member functions.
|
|||
explicit UserTable(QObject *parent); ///< Default constructor.
|
||||
UserTable(UserTable const &) = delete; ///< Disabled copy-constructor.
|
||||
UserTable(UserTable &&) = delete; ///< Disabled assignment copy-constructor.
|
||||
~UserTable() = default; ///< Destructor.
|
||||
~UserTable() override = default; ///< Destructor.
|
||||
UserTable &operator=(UserTable const &) = delete; ///< Disabled assignment operator.
|
||||
UserTable &operator=(UserTable &&) = delete; ///< Disabled move assignment operator.
|
||||
qint32 userCount() const; ///< Return the number of users in the table.
|
||||
|
|
|
@ -71,7 +71,7 @@ int main(int argc, char **argv) {
|
|||
app().log().error(message);
|
||||
qApp->exit(EXIT_FAILURE);
|
||||
});
|
||||
UPOverseer overseer = std::make_unique<Overseer>(serverWorker, nullptr);
|
||||
UPOverseer const overseer = std::make_unique<Overseer>(serverWorker, nullptr);
|
||||
overseer->startWorker(true);
|
||||
|
||||
qint32 const exitCode = QApplication::exec();
|
||||
|
|
Loading…
Reference in New Issue