refactor: Messages::showFirstConnectedMessage

add the app name into the title
      use QString::append to add to the string
      enable translations
This commit is contained in:
sithlord48 2025-06-06 22:09:40 -04:00 committed by Nick Bolton
parent bc9b1d1178
commit 3adcb64f57

View file

@ -144,32 +144,41 @@ void showFirstServerStartMessage(QWidget *parent)
void showFirstConnectedMessage(QWidget *parent, bool closeToTray, bool enableService, bool isServer) void showFirstConnectedMessage(QWidget *parent, bool closeToTray, bool enableService, bool isServer)
{ {
auto message = QString("<p>%1 is now connected!</p>").arg(kAppName); auto message = QObject::tr("<p>%1 is now connected!</p>").arg(kAppName);
if (isServer) { if (isServer) {
message += "<p>Try moving your mouse to your other computer. Once there, go ahead " message.append(
"and type something.</p>" QObject::tr(
"<p>Don't forget, you can copy and paste between computers too.</p>"; "<p>Try moving your mouse to your other computer. Once there, go ahead "
"and type something.</p>"
"<p>Don't forget, you can copy and paste between computers too.</p>"
)
);
} else { } else {
message += "<p>Try controlling this computer remotely.</p>"; message.append(QObject::tr("<p>Try controlling this computer remotely.</p>"));
} }
if (!closeToTray && !enableService) { if (!closeToTray && !enableService) {
message += QString( message.append(
"<p>As you do not have the setting enabled to keep %1 running in " QObject::tr(
"the background, you'll need to keep this window open or minimized " "<p>As you do not have the setting enabled to keep %1 running in "
"to keep %1 running.</p>" "the background, you'll need to keep this window open or minimized "
) "to keep %1 running.</p>"
.arg(kAppName); )
.arg(kAppName)
);
} else { } else {
message += QString( message.append(
"<p>You can now close this window and %1 will continue to run in " QObject::tr(
"the background. This setting can be disabled.</p>" "<p>You can now close this window and %1 will continue to run in "
) "the background. This setting can be disabled.</p>"
.arg(kAppName); )
.arg(kAppName)
);
} }
QMessageBox::information(parent, "Connected", message); const auto title = QObject::tr("%1 Connected").arg(kAppName);
QMessageBox::information(parent, title, message);
} }
void showClientConnectError(QWidget *parent, ClientError error, const QString &address) void showClientConnectError(QWidget *parent, ClientError error, const QString &address)