Files
iDescriptor/src/main.cpp
T
uncor3 43d804991e refactor(ui): add WinUI stylesheet for Windows
- Introduced WinToolWidget for custom window management on Windows.
- Implemented backdrop type settings for Windows in SettingsManager.
- Enhanced SettingsWidget to allow selection of backdrop type.
- Improved status balloon and toolbox widget styles for Windows.
- Refined tab widget animations and styles for better visual feedback.
- Fixed issues with loading and error widgets in ZLoadingWidget.
- Updated welcome widget to support custom hyperlink colors.
- General code cleanup and style adjustments across multiple files.
2026-02-22 11:59:57 +03:00

96 lines
3.8 KiB
C++

/*
* iDescriptor: A free and open-source idevice management tool.
*
* Copyright (C) 2025 Uncore <https://github.com/uncor3>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "mainwindow.h"
// #include "settingsmanager.h"
#include "iDescriptor.h"
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QMessageBox>
#include <QStyleFactory>
#include <QtGlobal>
#include <stdlib.h>
#ifdef WIN32
#include "platform/windows/win_common.h"
#endif
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("iDescriptor");
QCoreApplication::setApplicationName("iDescriptor");
QCoreApplication::setApplicationVersion(APP_VERSION);
// idevice_init_logger(Debug, Disabled, NULL);
// if (a.arguments().contains("--reset-settings")) {
// SettingsManager::sharedInstance()->clear();
// QMessageBox::information(nullptr, "Settings Reset",
// "All application settings have been reset to
// " "their default values.");
// }
#ifdef WIN32
QFile styleFile(detectDarkModeWindows() ? ":/resources/win.dark.qcss"
: ":/resources/win.light.qcss");
if (styleFile.open(QFile::ReadOnly | QFile::Text)) {
const QString style = QString::fromUtf8(styleFile.readAll())
.arg(COLOR_ACCENT_BLUE.name());
qDebug() << "Loaded Windows style sheet successfully.";
a.setStyleSheet(style);
}
QString appPath = QCoreApplication::applicationDirPath();
QString gstPluginPath =
QDir::toNativeSeparators(appPath + "/gstreamer-1.0");
QString gstPluginScannerPath = QDir::toNativeSeparators(
appPath + "/gstreamer-1.0/libexec/gst-plugin-scanner.exe");
const char *oldPath = getenv("PATH");
QString newPath = appPath + ";" + QString(oldPath);
qputenv("PATH", newPath.toUtf8());
qputenv("GST_PLUGIN_PATH", gstPluginPath.toUtf8());
qDebug() << "GST_PLUGIN_PATH=" << gstPluginPath;
qputenv("GST_REGISTRY_REUSE_PLUGIN_SCANNER", "no");
qDebug() << "GST_REGISTRY_REUSE_PLUGIN_SCANNER=no";
qputenv("GST_PLUGIN_SYSTEM_PATH", gstPluginPath.toUtf8());
qDebug() << "GST_PLUGIN_SYSTEM_PATH=" << gstPluginPath;
qputenv("GST_DEBUG", "GST_PLUGIN_LOADING:5");
qDebug() << "GST_DEBUG=GST_PLUGIN_LOADING:5";
qputenv("GST_PLUGIN_SCANNER_1_0", gstPluginScannerPath.toUtf8());
qDebug() << "GST_PLUGIN_SCANNER_1_0=" << gstPluginScannerPath;
#endif
#ifdef __APPLE__
QString appPath = QCoreApplication::applicationDirPath();
QString frameworksPath =
QDir::toNativeSeparators(appPath + "/../Frameworks");
QString gstPluginPath =
QDir::toNativeSeparators(frameworksPath + "/gstreamer");
QString gstPluginScannerPath =
QDir::toNativeSeparators(frameworksPath + "/gst-plugin-scanner");
setenv("GST_PLUGIN_PATH", gstPluginPath.toUtf8().constData(), 1);
setenv("GST_PLUGIN_SYSTEM_PATH", gstPluginPath.toUtf8().constData(), 1);
setenv("GST_PLUGIN_SCANNER", gstPluginScannerPath.toUtf8().constData(), 1);
#endif
MainWindow *w = MainWindow::sharedInstance();
w->show();
return a.exec();
}