Sorry, a fatal error has occurred and the application must " "now exit.
"; } else { text = "Sorry, a critical error has occurred.
"; } if (isLicensedProduct()) { text += QString(R"(Please contact us)" " and copy/paste the following error:
") .arg(kUrlContact, kColorSecondary); } else { text += QString(R"(Please report a bug)" " and copy/paste the following error:
") .arg(kUrlBugReport, kColorSecondary); } const QString version = QString::fromStdString(deskflow::version()); text += QString("v%1\n%2\n%3").arg(version, message, fileLine); if (type == QtFatalMsg) { // create a blocking message box for fatal errors, as we want to wait // until the dialog is dismissed before aborting the app. QMessageBox critical( QMessageBox::Critical, title, text, QMessageBox::Abort); critical.exec(); } else if (!Errors::s_ignoredErrors.contains(message)) { // prevent message boxes piling up by deleting the last one if it exists. // if none exists yet, then nothing will happen. Errors::s_criticalMessage.reset(); // as we don't abort for critical messages, create a new non-blocking // message box. this is so that we don't block the message handler; if we // did, we would prevent new messages from being logged properly. // the memory will stay allocated until the app exits, which is acceptable. Errors::s_criticalMessage = std::make_unique
Deskflow will continue to run in the background and can be accessed " "via the Deskflow icon in your system notifications area. This setting " "can be disabled.
"; #if defined(Q_OS_LINUX) message += QString("On some Linux systems such as GNOME 3, the " "notification area might be disabled. " "You may need to " R"(enable an extension)" " to see the Deskflow tray icon.
") .arg(kUrlGnomeTrayFix, kStyleLink); #endif QMessageBox::information(parent, "Notification area icon", message); } void showFirstServerStartMessage(QWidget *parent) { QMessageBox::information( parent, "Server is running", "Great, the server is now running.
" "Now you can connect your other computers to this server. " "You should see a prompt here on the server when a new client tries to " "connect.
"); } void showFirstConnectedMessage( QWidget *parent, bool closeToTray, bool enableService, bool isServer) { auto message = QString("Deskflow is now connected!
"); if (isServer) { message += "Try moving your mouse to your other computer. Once there, go ahead " "and type something.
" "Don't forget, you can copy and paste between computers too.
"; } else { message += "Try controlling this computer remotely.
"; } if (!closeToTray && !enableService) { message += "As you do not have the setting enabled to keep Deskflow running in " "the background, you'll need to keep this window open or minimized to " "keep Deskflow running.
"; } else { message += "You can now close this window and Deskflow will continue to run in " "the background. This setting can be disabled.
"; } QMessageBox::information(parent, "Connected", message); } void showDevThanks(QWidget *parent, const QString &productName) { if (productName.isEmpty()) { qFatal("product name not set"); } QMessageBox::information( parent, "Thank you!", QString("Thanks for using %1.
" "If you enjoy using this app, you can support the
"
"developers by "
R"(purchasing a license)"
" or "
R"(contributing code.)"
"
This message will only appear once.
") .arg( productName, kUrlPurchase, kColorSecondary, kUrlGitHub, kColorSecondary)); } void showClientConnectError( QWidget *parent, ClientError error, const QString &address) { using enum ClientError; auto message = QString("The connection to server '%1' didn't work.
").arg(address); if (error == AlreadyConnected) { message += // "Two of your client computers have the same name or there are " "two instances of the client process running.
" "Please ensure that you're using a unique name and that only a " "single client process is running.
"; } else if (error == HostnameError) { message += // "Please try to connect to the server using the server IP address " "instead of the hostname.
" "If that doesn't work, please check your TLS and " "firewall settings.
"; } else if (error == GenericError) { message += // "Please check your TLS and firewall settings.
"; } else { qFatal("unknown client error"); } QMessageBox dialog(parent); dialog.addButton(QObject::tr("Close"), QMessageBox::RejectRole); dialog.setText(message); dialog.exec(); } NewClientPromptResult showNewClientPrompt(QWidget *parent, const QString &clientName) { using enum NewClientPromptResult; QMessageBox message(parent); const QPushButton *ignore = message.addButton("Ignore", QMessageBox::RejectRole); const QPushButton *add = message.addButton("Add client", QMessageBox::AcceptRole); message.setText( QString("A new client called '%1' wants to connect").arg(clientName)); message.exec(); if (message.clickedButton() == add) { return Add; } else if (message.clickedButton() == ignore) { return Ignore; } else { qFatal("no expected dialog button was clicked"); abort(); } } bool showClearSettings(QWidget *parent) { QMessageBox message(parent); message.addButton(QObject::tr("Cancel"), QMessageBox::RejectRole); const auto clear = message.addButton(QObject::tr("Clear settings"), QMessageBox::AcceptRole); message.setText( "Are you sure you want to clear all settings and restart Deskflow?
" "This action cannot be undone.
"); message.exec(); return message.clickedButton() == clear; } void showReadOnlySettings(QWidget *parent, const QString &systemSettingsPath) { QString nativePath = QDir::toNativeSeparators(systemSettingsPath); QMessageBox::information( parent, "Read-only settings", QString("Settings are read-only because you only have read access " "to the file:
%1
") .arg(nativePath)); } void showWaylandExperimental(QWidget *parent) { QMessageBox::information( parent, "Experimental feature", QString( "Thanks for trying the beta version!
" "Wayland support is experimental and contains bugs.
" R"(Please report bugs to us if you find any.
)" "Happy testing!
") .arg(kUrlBugReport, kColorSecondary)); } void showWaylandLibraryError(QWidget *parent) { QMessageBox::critical( parent, "Library problem", QString( "Sorry, while this version of Deskflow does support Wayland, " "this build was not linked with one or more of the required " "libraries.
" "Please either switch to X from your login screen or use a build " "that uses the correct libraries.
" "If you think this is incorrect, please " R"(report a bug.
)" "Please check the logs for more information.
") .arg(kUrlBugReport, kColorSecondary)); } } // namespace deskflow::gui::messages