diff --git a/gpt4all-chat/src/main.cpp b/gpt4all-chat/src/main.cpp index b3074c4f..0a52f446 100644 --- a/gpt4all-chat/src/main.cpp +++ b/gpt4all-chat/src/main.cpp @@ -12,14 +12,11 @@ #include #include -#include #include #include -#include #include #include #include -#include #include #include @@ -31,16 +28,19 @@ # include #endif -void raiseWindow(QWindow* window) { +using namespace Qt::Literals::StringLiterals; + + +static void raiseWindow(QWindow *window) +{ #ifdef Q_OS_WINDOWS - HWND hwnd = (HWND)window->winId(); + HWND hwnd = HWND(window->winId()); // check if window is minimized to Windows task bar - if (::IsIconic(hwnd)) { - ::ShowWindow(hwnd, SW_RESTORE); - } + if (IsIconic(hwnd)) + ShowWindow(hwnd, SW_RESTORE); - ::SetForegroundWindow(hwnd); + SetForegroundWindow(hwnd); #else window->show(); window->raise(); @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) SingleApplication app(argc, argv, true /*allowSecondary*/); if (app.isSecondary()) { #ifdef Q_OS_WINDOWS - AllowSetForegroundWindow( DWORD( app.primaryPid() ) ); + AllowSetForegroundWindow(DWORD(app.primaryPid())); #endif app.sendMessage("RAISE_WINDOW"); return 0; @@ -107,7 +107,7 @@ int main(int argc, char *argv[]) qmlRegisterSingletonInstance("localdocs", 1, 0, "LocalDocs", LocalDocs::globalInstance()); qmlRegisterUncreatableMetaObject(MySettingsEnums::staticMetaObject, "mysettingsenums", 1, 0, "MySettingsEnums", "Error: only enums"); - const QUrl url(u"qrc:/gpt4all/main.qml"_qs); + const QUrl url(u"qrc:/gpt4all/main.qml"_s); QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, &app, [url](QObject *obj, const QUrl &objUrl) { @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) engine.load(url); QObject *rootObject = engine.rootObjects().first(); - QQuickWindow *windowObject = qobject_cast(rootObject); + QQuickWindow *windowObject = qobject_cast(rootObject); QObject::connect(&app, &SingleApplication::receivedMessage, windowObject, [windowObject] () { raiseWindow(windowObject); } );