ImageManager::ImageManager(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { //setModal(true); setupUi(this); // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib class pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset(static_cast<corelib *>(CoreLibClassPointer(true))); setWindowIcon(CoreLib->loadIcon(CoreLib->getSetting("app", "icon", false, "q4wine").toString())); loadThemeIcons(); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(tableImage, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableImage_showContextMenu(const QPoint &))); connect(tableImage, SIGNAL(clicked(const QModelIndex &)), this, SLOT(update_lblPathInfo(const QModelIndex &))); getCDImages(); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
ImageManager::ImageManager(QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { //setModal(true); setupUi(this); // Loading libq4wine-core.so libq4wine.setFileName("libq4wine-core"); if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); loadThemeIcons(); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(tableImage, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(tableImage_showContextMenu(const QPoint &))); connect(tableImage, SIGNAL(clicked(const QModelIndex &)), this, SLOT(update_lblPathInfo(const QModelIndex &))); getCDImages(); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
PrefixSettings::PrefixSettings(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { // Setup base UI setupUi(this); this->setWindowTitle(tr("Add new Prefix")); this->addNew=true; // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setWindowIcon(CoreLib->loadIcon("q4wine")); this->loadThemeIcons(); cmdGetPrefixPath->installEventFilter(this); cmdGetMountPoint->installEventFilter(this); // Hide deprecated options widDeprecated->setVisible(false); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(cmdClnWineBin, SIGNAL(clicked()), this, SLOT(cmdClnWineBin_Click())); connect(cmdClnWineServerBin, SIGNAL(clicked()), this, SLOT(cmdClnWineServerBin_Click())); connect(cmdClnWineLoaderBin, SIGNAL(clicked()), this, SLOT(cmdClnWineLoaderBin_Click())); connect(cmdClnWineLibs, SIGNAL(clicked()), this, SLOT(cmdClnWineLibs_Click())); connect(txtPrefixName, SIGNAL(textChanged(QString)), this, SLOT(setDefPath(QString))); connect(comboVersionList, SIGNAL(currentIndexChanged(const QString)), this, SLOT(comboVersionList_Change(const QString))); connect(comboTemplatesList, SIGNAL(currentIndexChanged(const int)), this, SLOT(comboTemplatesList_Change(const int))); connect(cmdAddVersion, SIGNAL(clicked()), this, SLOT(cmdAddVersion_Click())); getVersionsList(); comboVersionList->setCurrentIndex(0); connect(txtRunString, SIGNAL(textChanged()), this, SLOT(txtRunString_Changed())); txtRunString->setText(RUN_STRING_TEMPLATE_DEFAULT); // comboArchList->setEnabled(false); txtPrefixName->setFocus(Qt::ActiveWindowFocusReason); return; }
WineDriveDialog::WineDriveDialog(QStringList removeLetters, QString driveLetter, QString drivePath, QString driveType, QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { setupUi(this); // Loading libq4wine-core.so libq4wine.setFileName("libq4wine-core"); if (!libq4wine.load()) { libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); if (removeLetters.count()>0) { for (int i=0; i<removeLetters.count(); i++) { if (cbDriveLetter->findText(removeLetters.at(i), Qt::MatchExactly)>=0) { cbDriveLetter->removeItem(cbDriveLetter->findText(removeLetters.at(i))); } } } if (cbDriveLetter->findText(driveLetter, Qt::MatchExactly)>=0) { cbDriveLetter->setCurrentIndex(cbDriveLetter->findText(driveLetter, Qt::MatchExactly)); } txtDrivePath->setText(drivePath); if (cbDriveType->findText(driveType, Qt::MatchExactly)>=0) { cbDriveType->setCurrentIndex(cbDriveType->findText(driveType, Qt::MatchExactly)); } if (driveLetter=="C:") { cbDriveLetter->setEnabled(FALSE); cbDriveType->setEnabled(FALSE); cmdGetDrivePath->setEnabled(FALSE); txtDrivePath->setEnabled(FALSE); } connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdGetDrivePath, SIGNAL(clicked()), this, SLOT(cmdGetDrivePath_Click())); cmdGetDrivePath->setIcon(CoreLib->loadIcon("data/folder.png")); cmdOk->setFocus(Qt::ActiveWindowFocusReason); }
Run::Run(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { // Setup base UI setupUi(this); // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setWindowIcon(CoreLib->loadIcon("q4wine")); loadThemeIcons(); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdGetProgramBin, SIGNAL(clicked()), this, SLOT(cmdGetProgram_Click())); connect(cmdGetWorkDir, SIGNAL(clicked()), this, SLOT(cmdGetWorkDir_Click())); connect(cmdAdd, SIGNAL(clicked()), this, SLOT(cmdAdd_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(comboPrefixes, SIGNAL(currentIndexChanged (int)), this, SLOT(comboPrefixes_indexChanged (int))); connect(cbUseConsole, SIGNAL(stateChanged(int)), this, SLOT(cbUseConsole_stateChanged(int))); QString res = CoreLib->getSetting("advanced", "defaultDesktopSize", false, "").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } twDlls->horizontalHeader()->setStretchLastSection(true); twDlls->setColumnWidth(0, 400); cmdGetProgramBin->installEventFilter(this); cmdGetWorkDir->installEventFilter(this); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
PrefixSettings::PrefixSettings(QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { // Setup base UI setupUi(this); this->setWindowTitle(tr("Add new Prefix")); this->lblCaption->setText(tr("Add new Prefix")); this->addNew=true; // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); this->loadThemeIcons(); cmdGetPrefixPath->installEventFilter(this); cmdGetWineBin->installEventFilter(this); cmdGetWineServerBin->installEventFilter(this); cmdGetWineLoaderBin->installEventFilter(this); cmdGetWineLibs->installEventFilter(this); cmdGetMountPoint->installEventFilter(this); txtRunString->setText(RUN_STRING_TEMPLATE); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(txtPrefixName, SIGNAL(textChanged(QString)), this, SLOT(setDefPath(QString))); txtPrefixName->setFocus(Qt::ActiveWindowFocusReason); return; }
WineDriveDialog::WineDriveDialog(QStringList removeLetters, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { setupUi(this); // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setWindowIcon(CoreLib->loadIcon(CoreLib->getSetting("app", "icon", false, "q4wine").toString())); if (removeLetters.count()>0){ for (int i=0; i<removeLetters.count(); i++){ if (cbDriveLetter->findText(removeLetters.at(i), Qt::MatchExactly)>=0){ cbDriveLetter->removeItem(cbDriveLetter->findText(removeLetters.at(i))); } } } if (cbDriveLetter->count()>2){ cbDriveLetter->setCurrentIndex(2); } connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdGetDrivePath, SIGNAL(clicked()), this, SLOT(cmdGetDrivePath_Click())); cmdGetDrivePath->setIcon(CoreLib->loadIcon("document-open")); cmdOk->setFocus(Qt::ActiveWindowFocusReason); }
VersionManager::VersionManager(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setupUi(this); setWindowTitle("Wine Version Manager"); setWindowIcon(CoreLib->loadIcon("q4wine")); createActions(); loadThemeIcons(); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); std::auto_ptr<QToolBar> tbPrefix (new QToolBar(this)); tbPrefix->setIconSize(QSize(24, 24)); tbPrefix->addAction(searchClear.get()); searchField.reset(new QLineEdit(this)); connect(searchField.get(), SIGNAL(textChanged(QString)), this, SLOT(searchFilterChange(QString))); tbPrefix->addWidget(searchField.get()); //listPrefix.reset(new VersionListWidget(this)); std::auto_ptr<QVBoxLayout> layout (new QVBoxLayout(wPrefix)); layout->setSpacing(0); layout->setContentsMargins(0,0,0,0); layout->addWidget(tbPrefix.release()); layout->addWidget(listPrefix); wPrefix->setLayout(layout.release()); std::auto_ptr<QToolBar> tbSettings (new QToolBar(this)); tbSettings->setIconSize(QSize(24, 24)); tbSettings->addAction(saveVersion.get()); tbSettings->addSeparator(); tbSettings->addAction(addVersion.get()); tbSettings->addAction(delVersion.get()); std::auto_ptr<QVBoxLayout> s_layout (new QVBoxLayout(wSettings)); s_layout->setSpacing(0); s_layout->setContentsMargins(0,0,0,0); s_layout->addWidget(tbSettings.release()); s_layout->addWidget(gSettings); wSettings->setLayout(s_layout.release()); splitter.reset(new QSplitter(wContent)); splitter->addWidget(wPrefix); splitter->addWidget(wSettings); QList<int> a; a.append(CoreLib->getSetting("VersionManager", "splitterSize0", false, 170).toInt()); a.append(CoreLib->getSetting("VersionManager", "splitterSize1", false, 379).toInt()); splitter->setSizes(a); std::auto_ptr<QVBoxLayout> g_layout (new QVBoxLayout(wContent)); g_layout->setSpacing(0); g_layout->setContentsMargins(6,0,6,0); g_layout->addWidget(splitter.get()); wContent->setLayout(g_layout.release()); listPrefix->setContextMenuPolicy(Qt::CustomContextMenu); listPrefix->setSelectionMode(QAbstractItemView::SingleSelection); listPrefix->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); listPrefix->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); listPrefix->setMovement(QListView::Static); int nSize = CoreLib->getSetting("IconWidget", "IconSize", false, 32).toInt(); listPrefix->setViewMode(QListView::ListMode); listPrefix->setGridSize(QSize(nSize, nSize)); listPrefix->setIconSize(QSize(nSize, nSize)); listPrefix->setWrapping(false); listPrefix->setWordWrap(false); connect(listPrefix, SIGNAL(currentItemChanged (QListWidgetItem *, QListWidgetItem *)), this, SLOT(currentItemChanged (QListWidgetItem *, QListWidgetItem *))); cmdGetWineBin->installEventFilter(this); cmdGetWineLibs32->installEventFilter(this); cmdGetWineLibs64->installEventFilter(this); cmdGetWineLoaderBin->installEventFilter(this); cmdGetWineServerBin->installEventFilter(this); connect(txtWineBin, SIGNAL(textChanged(QString)), this, SLOT(versionSettingsChanged(QString))); connect(txtWineLibs32, SIGNAL(textChanged(QString)), this, SLOT(versionSettingsChanged(QString))); connect(txtWineLibs32, SIGNAL(textChanged(QString)), this, SLOT(versionSettingsChanged(QString))); connect(txtWineLoaderBin, SIGNAL(textChanged(QString)), this, SLOT(versionSettingsChanged(QString))); connect(txtWineServerBin, SIGNAL(textChanged(QString)), this, SLOT(versionSettingsChanged(QString))); currentVersion.reset(NULL); currentVersionChanged_ = false; getVersions(); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
IconSettings::IconSettings(QString prefix_name, QString dir_name, QString icon_name, QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { /* ** This functions is constructor for IconSettings dialog * * Args: * @newIcon -- This define which type of dialog we'l use "New Icon" or "Edit Icon" * @p_id -- PrefixId * @p_id -- PrefixId */ setupUi(this); // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); this->prefix_name = prefix_name; this->dir_name = dir_name; this->icon_name = icon_name; this->prefix_path = db_prefix.getByName(this->prefix_name).value("path"); if (this->prefix_path.isEmpty()){ this->prefix_path = QDir::homePath(); this->prefix_path.append("/.wine/drive_c/"); } else { this->prefix_path.append("/drive_c/"); } // Creating side bar urls prefix_urls << QUrl::fromLocalFile(QDir::rootPath()); prefix_urls << QUrl::fromLocalFile(QDir::homePath()); if (QDir(this->prefix_path).exists()) prefix_urls << QUrl::fromLocalFile(this->prefix_path); QString cd_mount = db_prefix.getMountPoint(this->prefix_name); if (!cd_mount.isEmpty()) if (QDir().exists(cd_mount)) prefix_urls << QUrl::fromLocalFile(cd_mount); this->loadThemeIcons(); QString res; switch (icon_name.isEmpty()){ case TRUE: lblCaption->setText(tr("Adding new icon")); setWindowTitle(tr("Adding new icon")); res = CoreLib->getSetting("advanced", "defaultDesktopSize", false, "").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } break; case FALSE: lblCaption->setText(tr("Icon settings")); setWindowTitle(tr("Icon settings")); getIconReccord(); break; } connect(twbGeneral, SIGNAL(currentChanged(int)), this, SLOT(ResizeContent(int))); connect(cmdAdd, SIGNAL(clicked()), this, SLOT(cmdAdd_Click())); connect(cmdGetProgram, SIGNAL(clicked()), this, SLOT(cmdGetProgram_Click())); connect(cmdGetWorkDir, SIGNAL(clicked()), this, SLOT(cmdGetWorkDir_Click())); connect(cmdGetIcon, SIGNAL(clicked()), this, SLOT(cmdGetIcon_Click())); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(cmdGetPreRun, SIGNAL(clicked()), this, SLOT(cmdGetPreRun_Click())); connect(cmdGetPostRun, SIGNAL(clicked()), this, SLOT(cmdGetPostRun_Click())); connect(cbUseConsole, SIGNAL(stateChanged(int)), this, SLOT(cbUseConsole_stateChanged(int))); twDlls->installEventFilter(this); cboxDlls->addItems(CoreLib->getWineDlls(db_prefix.getByName(prefix_name).value("libs"))); cboxDlls->setMaxVisibleItems (10); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
AppSettings::AppSettings(QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setupUi(this); splitter.reset(new QSplitter(widgetContent)); splitter->addWidget(optionsTreeWidget); splitter->addWidget(optionsStack); QList<int> size; size << 150 << 150; splitter->setSizes(size); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); vlayout->addWidget(splitter.release()); vlayout->setMargin(0); vlayout->setSpacing(0); widgetContent->setLayout(vlayout.release()); setWindowTitle(tr("%1 settings").arg(APP_NAME)); setWindowIcon(CoreLib->loadIcon(CoreLib->getSetting("app", "icon", false, "q4wine").toString())); connect(optionsTree, SIGNAL(itemClicked (QTreeWidgetItem *, int)), this, SLOT(optionsTree_itemClicked ( QTreeWidgetItem *, int))); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(cmdVersionManager, SIGNAL(clicked()), this, SLOT(cmdVersionManager_Click())); connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString))); //Installing event filters for get buttuns cmdGetTarBin->installEventFilter(this); cmdGetMountBin->installEventFilter(this); cmdGetUmountBin->installEventFilter(this); cmdGetSudoBin->installEventFilter(this); cmdGetGuiSudoBin->installEventFilter(this); cmdGetNiceBin->installEventFilter(this); cmdGetReniceBin->installEventFilter(this); cmdGetConsoleBin->installEventFilter(this); cmdGetShBin->installEventFilter(this); cmdGetDefPrefixPath->installEventFilter(this); QSettings settings(APP_SHORT_NAME, "default"); settings.beginGroup("logging"); connect (cbShowTray, SIGNAL(stateChanged (int)), this, SLOT(cbShowTray_stateChanged (int))); if (settings.value("autoClear", 1).toInt()==1){ cbClearLogs->setCheckState(Qt::Checked); } else { cbClearLogs->setCheckState(Qt::Unchecked); } settings.endGroup(); settings.beginGroup("app"); QString appIcon = settings.value("icon").toString(); if (appIcon == "q4wine-ambiance"){ comboAppIcons->setCurrentIndex(comboAppIcons->findText(tr("Ambient Light"))); } else if (appIcon == "q4wine-ambiance-dark"){ comboAppIcons->setCurrentIndex(comboAppIcons->findText(tr("Ambient Dark"))); } else { comboAppIcons->setCurrentIndex(comboAppIcons->findText(tr("Default"))); } if (settings.value("showTrareyIcon", 0).toInt()==1){ cbShowTray->setCheckState(Qt::Checked); } else { cbShowTray->setCheckState(Qt::Unchecked); } if (settings.value("showNotifications", 1).toInt()==1){ cbShowNotifications->setCheckState(Qt::Checked); } else { cbShowNotifications->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTray", 0).toInt()==1){ cbMinimizeToTray->setCheckState(Qt::Checked); } else { cbMinimizeToTray->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTrayAtAppStart", 0).toInt()==1){ cbMinimizeToTrayApp->setCheckState(Qt::Checked); } else { cbMinimizeToTrayApp->setCheckState(Qt::Unchecked); } loadThemeIcons(); getLangs(); if (settings.value("lang").toString().isEmpty()){ comboLangs->setCurrentIndex(comboLangs->findText(tr("System Default"))); } else { QString lName = settings.value("lang").toString(); //Strip q4wine_ from setting if any lName.replace("q4wine_", ""); comboLangs->setCurrentIndex(comboLangs->findText(QLocale(lName).nativeLanguageName())); } settings.endGroup(); settings.beginGroup("system"); txtTarBin->setText(settings.value("tar").toString()); txtMountBin->setText(settings.value("mount").toString()); txtUmountBin->setText(settings.value("umount").toString()); txtSudoBin->setText(settings.value("sudo").toString()); txtGuiSudoBin->setText(settings.value("gui_sudo").toString()); txtNiceBin->setText(settings.value("nice").toString()); txtReniceBin->setText(settings.value("renice").toString()); txtShBin->setText(settings.value("sh").toString()); settings.endGroup(); settings.beginGroup("console"); txtConsoleBin->setText(settings.value("bin").toString()); txtConsoleArgs->setText(settings.value("args").toString()); settings.endGroup(); settings.beginGroup("quickmount"); comboMountProfiles->setCurrentIndex(settings.value("type", 0).toInt()); connect(comboMountProfiles, SIGNAL(currentIndexChanged(int)), this, SLOT(comboMountProfiles_currentIndexChanged(int))); if (!settings.value("mount_drive_string").toString().isEmpty()) txtMountString->setText(settings.value("mount_drive_string").toString()); if (!settings.value("mount_image_string").toString().isEmpty()) txtMountImageString->setText(settings.value("mount_image_string").toString()); if (!settings.value("umount_string").toString().isEmpty()) txtUmountString->setText(settings.value("umount_string").toString()); settings.endGroup(); #ifdef WITH_ICOUTILS settings.beginGroup("icotool"); txtWrestoolBin->setText(settings.value("wrestool").toString()); txtIcotoolBin->setText(settings.value("icotool").toString()); settings.endGroup(); cmdGetWrestoolBin->installEventFilter(this); cmdGetIcotoolBin->installEventFilter(this); #else txtWrestoolBin->setEnabled(false); txtIcotoolBin->setEnabled(false); cmdGetWrestoolBin->setEnabled(false); cmdGetIcotoolBin->setEnabled(false); #endif settings.beginGroup("network"); txtProxyHost->setText(settings.value("host").toString()); txtProxyPort->setText(settings.value("port").toString()); txtProxyUser->setText(settings.value("user").toString()); txtProxyPass->setText(settings.value("pass").toString()); comboProxyType->setCurrentIndex(settings.value("type").toInt()); settings.endGroup(); #ifdef _OS_FREEBSD_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); #endif #ifdef _OS_DARWIN_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); this->comboMountProfiles->removeItem(1); this->comboMountProfiles->setItemText(0, tr("generic")); this->txtMountString->setEnabled(false); this->frameMount->setVisible(false); #endif settings.beginGroup("advanced"); txtDefPrefixPath->setText(settings.value("prefixDefaultPath").toString()); if (settings.value("openRunDialog", 0).toInt()==0){ cbOpenRunDialog->setChecked(false); } else { cbOpenRunDialog->setChecked(true); } if (settings.value("useSingleClick", 0).toInt()==0){ cbUseSingleClick->setChecked(false); } else { cbUseSingleClick->setChecked(true); } #if QT_VERSION >= 0x040500 if (settings.value("useNativeFileDialog", 1).toInt()==1){ cbUseNativeDialog->setChecked(true); } else { cbUseNativeDialog->setChecked(false); } #else cbUseNativeDialog->setEnabled(false); #endif QString res = settings.value("defaultDesktopSize").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } settings.endGroup(); settings.beginGroup("DesktopImport"); if (settings.value("remove", 0).toInt()==0){ cbRemoveDesktopFiles->setChecked(false); } else { cbRemoveDesktopFiles->setChecked(true); } if (settings.value("importAtStartup", 0).toInt()==0){ cbImportDesktopFilesAtStartup->setChecked(false); } else { cbImportDesktopFilesAtStartup->setChecked(true); } settings.endGroup(); settings.beginGroup("AppDB"); if (settings.value("useSystemBrowser", 1).toInt()==1){ cbUseSystemBrowser->setChecked(true); } else { cbUseSystemBrowser->setChecked(false); } settings.endGroup(); #ifndef _OS_DARWIN_ settings.beginGroup("Plugins"); if (settings.value("enableMenuDesktop", 1).toInt()==1){ cbEnableDesktopMenu->setChecked(true); } else { cbEnableDesktopMenu->setChecked(false); } settings.endGroup(); connect(cmdDesktopMenu_Regen, SIGNAL(clicked()), this, SLOT(cmdDesktopMenu_Regen_Click())); connect(cmdDesktopMenu_Remove, SIGNAL(clicked()), this, SLOT(cmdDesktopMenu_Remove_Click())); #else cbEnableDesktopMenu->setEnabled(false); cmdDesktopMenu_Regen->setEnabled(false); cmdDesktopMenu_Remove->setEnabled(false); #endif QList<QTreeWidgetItem *> items = optionsTree->findItems (tr("General"), Qt::MatchExactly); if (items.count()>0){ items.at(0)->setExpanded(true); optionsTree->setCurrentItem(items.at(0)); optionsStack->setCurrentIndex(0); tabwGeneral->setCurrentIndex(0); } cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
PrefixSettings::PrefixSettings(QString prefix_name, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f) { // Setup base UI setupUi(this); // Setting class prefix name this->prefix_name=prefix_name; // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); this->addNew=false; this->loadThemeIcons(); setWindowIcon(CoreLib->loadIcon(CoreLib->getSetting("app", "icon", false, "q4wine").toString())); QHash<QString,QString> result = db_prefix.getByName(prefix_name); if (result.value("id").isEmpty()) return; prefix_id=result.value("id"); Version ver; ver.id_ = result.value("version_id"); if (!ver.load()){ ver.clear(); ver.name_ = "Default"; if (!ver.load()){ QMessageBox::critical(this, tr("Error"), tr("Unable to load version by name: %1").arg(ver.name_)); return; } } version_name=ver.name_; txtMountPoint->setText(result.value("mount")); connect(txtMountPoint, SIGNAL(editingFinished()), this, SLOT(getWineCdromLetter())); if (prefix_name=="Default"){ txtPrefixName->setEnabled(false); txtPrefixPath->setEnabled(false); cmdGetPrefixPath->setEnabled(false); txtWineLibs->setText(""); txtWineLoaderBin->setText(""); txtWineServerBin->setText(""); txtWineBin->setText(""); } else { cmdGetPrefixPath->installEventFilter(this); txtWineLibs->setText(result.value("libs")); txtWineLoaderBin->setText(result.value("loader")); txtWineServerBin->setText(result.value("server")); txtWineBin->setText(result.value("bin")); if (!result.value("libs").isEmpty()) cmdClnWineLibs->setEnabled(true); if (!result.value("loader").isEmpty()) cmdClnWineLoaderBin->setEnabled(true); if (!result.value("server").isEmpty()) cmdClnWineServerBin->setEnabled(true); if (!result.value("bin").isEmpty()) cmdClnWineBin->setEnabled(true); } // Hide advanced settings if there are no deprecated settings defined if ((txtWineBin->text().isEmpty()) && (txtWineLoaderBin->text().isEmpty()) && (txtWineServerBin->text().isEmpty()) && (txtWineBin->text().isEmpty())){ widDeprecated->setVisible(false); } if (!result.value("arch").isEmpty()) comboArchList->setCurrentIndex(comboArchList->findText(result.value("arch"))); if (!result.value("mountpoint_windrive").isEmpty()){ comboWinDrive->setCurrentIndex(comboWinDrive->findText(result.value("mountpoint_windrive"))); } else { this->getWineCdromLetter(); } txtPrefixName->setText(prefix_name); txtPrefixPath->setText(result.value("path")); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(cmdClnWineBin, SIGNAL(clicked()), this, SLOT(cmdClnWineBin_Click())); connect(cmdClnWineServerBin, SIGNAL(clicked()), this, SLOT(cmdClnWineServerBin_Click())); connect(cmdClnWineLoaderBin, SIGNAL(clicked()), this, SLOT(cmdClnWineLoaderBin_Click())); connect(cmdClnWineLibs, SIGNAL(clicked()), this, SLOT(cmdClnWineLibs_Click())); connect(comboVersionList, SIGNAL(currentIndexChanged(const QString)), this, SLOT(comboVersionList_Change(const QString))); connect(comboTemplatesList, SIGNAL(currentIndexChanged(const int)), this, SLOT(comboTemplatesList_Change(const int))); connect(cmdAddVersion, SIGNAL(clicked()), this, SLOT(cmdAddVersion_Click())); getVersionsList(); connect(txtRunString, SIGNAL(textChanged()), this, SLOT(txtRunString_Changed())); // comboArchList->setEnabled(false); txtRunString->setText(result.value("run_string")); cmdGetMountPoint->installEventFilter(this); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
PrefixSettings::PrefixSettings(QString prefix_name, QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { // Setup base UI setupUi(this); // Setting class prefix name this->prefix_name=prefix_name; // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); this->addNew=false; this->loadThemeIcons(); QHash<QString,QString> result = db_prefix.getByName(prefix_name); if (result.value("id").isEmpty()) return; prefix_id=result.value("id"); txtMountPoint->setText(result.value("mount")); connect(txtMountPoint, SIGNAL(editingFinished()), this, SLOT(getWineCdromLetter())); if (prefix_name=="Default"){ txtPrefixName->setEnabled(FALSE); txtPrefixPath->setEnabled(FALSE); cmdGetPrefixPath->setEnabled(FALSE); txtWineLibs->setEnabled(FALSE); txtWineLoaderBin->setEnabled(FALSE); txtWineServerBin->setEnabled(FALSE); txtWineBin->setEnabled(FALSE); cmdGetWineLibs->setEnabled(FALSE); cmdGetWineLoaderBin->setEnabled(FALSE); cmdGetWineServerBin->setEnabled(FALSE); cmdGetWineBin->setEnabled(FALSE); txtWineLibs->setText(""); txtWineLoaderBin->setText(""); txtWineServerBin->setText(""); txtWineBin->setText(""); } else { cmdGetPrefixPath->installEventFilter(this); cmdGetWineBin->installEventFilter(this); cmdGetWineServerBin->installEventFilter(this); cmdGetWineLoaderBin->installEventFilter(this); cmdGetWineLibs->installEventFilter(this); txtWineLibs->setText(result.value("libs")); txtWineLoaderBin->setText(result.value("loader")); txtWineServerBin->setText(result.value("server")); txtWineBin->setText(result.value("bin")); } if (!result.value("arch").isEmpty()) comboArchList->setCurrentIndex(comboArchList->findText(result.value("arch"))); if (!result.value("mountpoint_windrive").isEmpty()){ comboWinDrive->setCurrentIndex(comboWinDrive->findText(result.value("mountpoint_windrive"))); } else { this->getWineCdromLetter(); } txtPrefixName->setText(prefix_name); txtPrefixPath->setText(result.value("path")); txtRunString->setText(result.value("run_string")); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); // comboArchList->setEnabled(false); cmdGetMountPoint->installEventFilter(this); cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }
AppSettings::AppSettings(QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setupUi(this); splitter.reset(new QSplitter(widgetContent)); splitter->addWidget(optionsTreeWidget); splitter->addWidget(optionsStack); QList<int> size; size << 150 << 150; splitter->setSizes(size); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); vlayout->addWidget(splitter.release()); vlayout->setMargin(0); vlayout->setSpacing(0); widgetContent->setLayout(vlayout.release()); setWindowTitle(tr("%1 settings").arg(APP_NAME)); lblCaption->setText(tr("%1 settings").arg(APP_NAME)); connect(optionsTree, SIGNAL(itemClicked (QTreeWidgetItem *, int)), this, SLOT(optionsTree_itemClicked ( QTreeWidgetItem *, int))); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString))); //Installing event filters for get buttuns cmdGetWineBin->installEventFilter(this); cmdGetWineServerBin->installEventFilter(this); cmdGetWineLoaderBin->installEventFilter(this); cmdGetWineLibs->installEventFilter(this); cmdGetTarBin->installEventFilter(this); cmdGetMountBin->installEventFilter(this); cmdGetUmountBin->installEventFilter(this); cmdGetSudoBin->installEventFilter(this); cmdGetGuiSudoBin->installEventFilter(this); cmdGetNiceBin->installEventFilter(this); cmdGetReniceBin->installEventFilter(this); cmdGetConsoleBin->installEventFilter(this); cmdGetShBin->installEventFilter(this); QSettings settings(APP_SHORT_NAME, "default"); settings.beginGroup("wine"); txtWineBin->setText(settings.value("WineBin").toString()); txtWineServerBin->setText(settings.value("ServerBin").toString()); txtWineLoaderBin->setText(settings.value("LoaderBin").toString()); txtWineLibs->setText(settings.value("WineLibs").toString()); settings.endGroup(); settings.beginGroup("logging"); connect (cbShowTray, SIGNAL(stateChanged (int)), this, SLOT(cbShowTray_stateChanged (int))); if (settings.value("autoClear", 1).toInt()==1){ cbClearLogs->setCheckState(Qt::Checked); } else { cbClearLogs->setCheckState(Qt::Unchecked); } settings.endGroup(); settings.beginGroup("app"); if (settings.value("showTrareyIcon", 0).toInt()==1){ cbShowTray->setCheckState(Qt::Checked); } else { cbShowTray->setCheckState(Qt::Unchecked); } if (settings.value("showNotifications", 1).toInt()==1){ cbShowNotifications->setCheckState(Qt::Checked); } else { cbShowNotifications->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTray", 0).toInt()==1){ cbMinimizeToTray->setCheckState(Qt::Checked); } else { cbMinimizeToTray->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTrayAtAppStart", 0).toInt()==1){ cbMinimizeToTrayApp->setCheckState(Qt::Checked); } else { cbMinimizeToTrayApp->setCheckState(Qt::Unchecked); } listThemesView->clear(); std::auto_ptr<QListWidgetItem> iconItem (new QListWidgetItem(listThemesView, 0)); iconItem->setText("Default [Aughtor: Xavier Corredor Llano ([email protected]); License: GPL v.2.1]"); iconItem->setIcon(QIcon(":data/wine.png")); iconItem->setToolTip("Default"); listThemesView->setSelectionMode(QAbstractItemView::SingleSelection); QString themeDir=""; themeDir.append(QDir::homePath()); themeDir.append("/.config/"); themeDir.append(APP_SHORT_NAME); themeDir.append("/theme/"); getThemes(settings.value("theme").toString(), themeDir); loadThemeIcons(); if (settings.value("theme").toString()=="Default"){ listThemesView->setCurrentItem(iconItem.release()); } themeDir.clear(); #ifdef _OS_DARWIN_ themeDir.append(QDir::currentPath()); themeDir.append("/"); themeDir.append(APP_SHORT_NAME); themeDir.append(".app/Contents/Resources/theme"); #else themeDir.append(APP_PREF); themeDir.append("/share/"); themeDir.append(APP_SHORT_NAME); themeDir.append("/theme"); #endif getThemes(settings.value("theme").toString(), themeDir); getLangs(); if (settings.value("lang").toString().isEmpty()){ comboLangs->setCurrentIndex(comboLangs->findText(tr("System Default"))); } else { comboLangs->setCurrentIndex(comboLangs->findText(settings.value("lang").toString())); } settings.endGroup(); settings.beginGroup("system"); txtTarBin->setText(settings.value("tar").toString()); txtMountBin->setText(settings.value("mount").toString()); txtUmountBin->setText(settings.value("umount").toString()); txtSudoBin->setText(settings.value("sudo").toString()); txtGuiSudoBin->setText(settings.value("gui_sudo").toString()); txtNiceBin->setText(settings.value("nice").toString()); txtReniceBin->setText(settings.value("renice").toString()); txtShBin->setText(settings.value("sh").toString()); settings.endGroup(); settings.beginGroup("console"); txtConsoleBin->setText(settings.value("bin").toString()); txtConsoleArgs->setText(settings.value("args").toString()); settings.endGroup(); settings.beginGroup("quickmount"); comboMountProfiles->setCurrentIndex(settings.value("type", 0).toInt()); connect(comboMountProfiles, SIGNAL(currentIndexChanged(int)), this, SLOT(comboMountProfiles_currentIndexChanged(int))); if (!settings.value("mount_drive_string").toString().isEmpty()) txtMountString->setText(settings.value("mount_drive_string").toString()); if (!settings.value("mount_image_string").toString().isEmpty()) txtMountImageString->setText(settings.value("mount_image_string").toString()); if (!settings.value("umount_string").toString().isEmpty()) txtUmountString->setText(settings.value("umount_string").toString()); settings.endGroup(); #ifdef WITH_ICOUTILS settings.beginGroup("icotool"); txtWrestoolBin->setText(settings.value("wrestool").toString()); txtIcotoolBin->setText(settings.value("icotool").toString()); settings.endGroup(); cmdGetWrestoolBin->installEventFilter(this); cmdGetIcotoolBin->installEventFilter(this); #else txtWrestoolBin->setEnabled(false); txtIcotoolBin->setEnabled(false); cmdGetWrestoolBin->setEnabled(false); cmdGetIcotoolBin->setEnabled(false); #endif settings.beginGroup("network"); txtProxyHost->setText(settings.value("host").toString()); txtProxyPort->setText(settings.value("port").toString()); txtProxyUser->setText(settings.value("user").toString()); txtProxyPass->setText(settings.value("pass").toString()); comboProxyType->setCurrentIndex(settings.value("type").toInt()); settings.endGroup(); #ifdef _OS_FREEBSD_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); #endif #ifdef _OS_DARWIN_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); this->comboMountProfiles->removeItem(1); this->comboMountProfiles->setItemText(0, tr("generic")); this->txtMountString->setEnabled(false); this->frameMount->setVisible(false); #endif settings.beginGroup("advanced"); if (settings.value("openRunDialog", 0).toInt()==0){ cbOpenRunDialog->setChecked(false); } else { cbOpenRunDialog->setChecked(true); } if (settings.value("useSingleClick", 0).toInt()==0){ cbUseSingleClick->setChecked(false); } else { cbUseSingleClick->setChecked(true); } #if QT_VERSION >= 0x040500 if (settings.value("useNativeFileDialog", 1).toInt()==1){ cbUseNativeDialog->setChecked(true); } else { cbUseNativeDialog->setChecked(false); } #else cbUseNativeDialog->setEnabled(false); #endif QString res = settings.value("defaultDesktopSize").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } settings.endGroup(); settings.beginGroup("DesktopImport"); if (settings.value("remove", 0).toInt()==0){ cbRemoveDesktopFiles->setChecked(false); } else { cbRemoveDesktopFiles->setChecked(true); } if (settings.value("importAtStartup", 0).toInt()==0){ cbImportDesktopFilesAtStartup->setChecked(false); } else { cbImportDesktopFilesAtStartup->setChecked(true); } settings.endGroup(); settings.beginGroup("AppDB"); if (settings.value("useSystemBrowser", 1).toInt()==1){ cbUseSystemBrowser->setChecked(true); } else { cbUseSystemBrowser->setChecked(false); } settings.endGroup(); QList<QTreeWidgetItem *> items = optionsTree->findItems (tr("General"), Qt::MatchExactly); if (items.count()>0){ items.at(0)->setExpanded(true); optionsTree->setCurrentItem(items.at(0)); optionsStack->setCurrentIndex(0); tabwGeneral->setCurrentIndex(0); } cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }