示例#1
0
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;
}
示例#2
0
WineObject::WineObject(QObject *parent) : QObject(parent)
{
    // Loading libq4wine-core.so
#ifdef RELEASE
    libq4wine.setFileName(_CORELIB_PATH_);
#else
    libq4wine.setFileName(QString("%1/q4wine-lib/libq4wine-core").arg(APP_BUILD));
#endif

    if (!libq4wine.load()){
        libq4wine.load();
    }

    // Getting corelib calss pointer
    CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib");
    CoreLib.reset((corelib *)CoreLibClassPointer(true));

    this->programNice = 0;
    this->prefixId = 0;
    this->useConsole=false;
    this->logEnabled = CoreLib->getSetting("logging", "enable", false, 1).toBool();

    this->user = getenv("USER");

    return;
}
示例#3
0
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;
}
示例#4
0
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;
}
示例#5
0
PrefixControlWidget::PrefixControlWidget(QWidget *parent) :
    QWidget(parent)
{
    // 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->createActions();

    std::auto_ptr<QToolBar> toolBar (new QToolBar(this));
    toolBar->setIconSize(QSize(24, 24));
    toolBar->addAction(prefixAdd.get());
    toolBar->addSeparator ();
    toolBar->addAction(prefixImport.get());
    toolBar->addAction(prefixExport.get());
    toolBar->addSeparator ();
    toolBar->addAction(prefixDelete.get());
    toolBar->addSeparator ();
    toolBar->addAction(prefixSettings.get());
    toolBar->addSeparator ();
    toolBar->addAction(prefixSetup.get());

    prefixTable.reset(new QTableView(this));
    connect(prefixTable.get(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequested(const QPoint &)));
    connect(prefixTable.get(), SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)));

    prefixTable->setContextMenuPolicy(Qt::CustomContextMenu);

    std::auto_ptr<QVBoxLayout> layout (new QVBoxLayout(this));
    layout->setSpacing(0);
    layout->setContentsMargins(0,0,0,0);
    layout->addWidget(toolBar.release());
    layout->addWidget(prefixTable.get());

    model.reset(new QSqlQueryModel());

    prefixTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    prefixTable->setSelectionMode(QAbstractItemView::SingleSelection);

    this->setLayout(layout.release());

    this->updateTableModel();
    return;
}
示例#6
0
Registry::Registry(){
	// 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));
	return;
}
示例#7
0
Progress::Progress(int action, QString path, 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));

    this->max=0;
    this->current=0;
    this->action=action;
    this->path=path;

    t.reset(new QTimer(this));
    connect(t.get(), SIGNAL(timeout()), this, SLOT(runAction()));
    connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click()));

    if (action==0){
        lblInfo->setText(tr("Importing Wine desktop icons from:<br>\"%1\"<br><br>This can take a while...<br><br><b>Note:</b> To remove processed files see Q4Wine options dialog.").arg(path));
        setWindowTitle(tr("Importing Wine desktop icons: %1 of %2").arg(0).arg(max));

        this->max = importIcons(path);

        t->start(0);
    } else if (action==1){
        this->max = 0;
        int cur = CoreLib->getWineProcessList(path).count();
        lblInfo->setText(QString("%1<br>%2<br><br>%3").arg(tr("Waiting for Wine process to finish...")).arg(tr("There are %1 processes running for prefix %2.").arg(cur).arg(path)).arg(tr("If the processes keep running -- end them manually.")));
        setWindowTitle(tr("Running process: %1").arg(cur));
        t->start(1000);
    }


    progressBar->setMaximum(this->max);




    return;
}
示例#8
0
IconListToolbar::IconListToolbar(QWidget *parent) :
    QWidget(parent)
{
    // 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->sort_order = CoreLib->getSetting("IconWidget", "IconSort", false, D_SORT_TYPE_BY_DATE_ASC).toInt();
    this->view_mode = CoreLib->getSetting("IconWidget", "ViewMode", false, D_VIEW_MODE_ICON).toInt();
    this->createActions();

    std::auto_ptr<QToolBar> toolBar (new QToolBar(this));

    toolBar->setIconSize(QSize(24, 24));
    toolBar->addAction(searchClear.get());

    searchField.reset (new QLineEdit(this));
    connect(searchField.get(), SIGNAL(textChanged(QString)), this, SIGNAL(searchFilterChange(QString)));

    toolBar->addWidget(searchField.get());

    toolBar->addSeparator();
    toolBar->addAction(viewMode.get());
    toolBar->addSeparator();
    toolBar->addAction(zoomIn.get());
    toolBar->addAction(zoomOut.get());
    toolBar->addSeparator();
    toolBar->addAction(sortAlpha.get());
    toolBar->addAction(sortCreation.get());

    std::auto_ptr<QVBoxLayout> layout (new QVBoxLayout(this));
    layout->setSpacing(0);
    layout->setContentsMargins(0,0,0,0);
    layout->addWidget(toolBar.release());

    this->setLayout(layout.release());


}
示例#9
0
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);
}
示例#10
0
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;
}
示例#11
0
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;
}
示例#12
0
HttpCore::HttpCore()
{
    http.reset(new QHttp(this));

    connect(http.get(), SIGNAL(requestFinished(int, bool)),
                 this, SLOT(httpRequestFinished(int, bool)));
    connect(http.get(), SIGNAL(dataReadProgress(int, int)),
                 this, SIGNAL(updateDataReadProgress(int, int)));
    connect(http.get(), SIGNAL(stateChanged(int)),
                 this, SIGNAL(stateChanged(int)));
    connect(http.get(), SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)),
                 this, SLOT(readResponseHeader(const QHttpResponseHeader &)));

    // 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));

    int type = CoreLib->getSetting("network", "type", false).toInt();

    if (type!=0){
        QString proxyUser, proxyPass, proxyHost;
        int proxyPort;

        proxyHost = CoreLib->getSetting("network", "host", false).toString();
        proxyPort = CoreLib->getSetting("network", "port", false).toInt();
        proxyUser = CoreLib->getSetting("network", "user", false).toString();
        proxyPass = CoreLib->getSetting("network", "pass", false).toString();
        http->setProxy(proxyHost, proxyPort, proxyUser, proxyPass);
    }

    //Create user_agent string
    user_agent=QString("%1/%2 (X11; %3 %4) xmlparser/%5").arg(APP_SHORT_NAME).arg(APP_VERS).arg(APP_HOST).arg(APP_ARCH).arg(APPDB_EXPORT_VERSION);
}
示例#13
0
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);

}
示例#14
0
文件: sysmenu.cpp 项目: tgeer1/q4wine
system_menu::system_menu()
{
    // 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));

    QString home_path = QDir::homePath();

    base_directory = QString("%1/.local/share/desktop-directories").arg(home_path);
    base_icon = QString("%1/.local/share/applications").arg(home_path);
    base_menu = QString("%1/.config/menus/applications-merged/%2.menu").arg(home_path).arg(APP_SHORT_NAME);
}
示例#15
0
PrefixTreeToolbar::PrefixTreeToolbar(QWidget *parent) :
    QWidget(parent)
{
    // 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->tree_state = CoreLib->getSetting("TreeWidget", "State", false, D_TREE_EXPAND).toInt();
    this->createActions();

    std::auto_ptr<QToolBar> toolBar (new QToolBar(this));

    toolBar->setIconSize(QSize(24, 24));
    toolBar->addAction(treeState.get());
    toolBar->addSeparator();
    toolBar->addAction(prefixExport.get());
    toolBar->addAction(prefixImport.get());

    std::auto_ptr<QVBoxLayout> layout (new QVBoxLayout(this));
    layout->setSpacing(0);
    layout->setContentsMargins(0,0,0,0);
    layout->addWidget(toolBar.release());

    this->setLayout(layout.release());
}
示例#16
0
AppDBWidget::AppDBWidget(QWidget *parent) : QWidget(parent)
{

    // 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));

    //Init AppDB Core Classes
    xmlparser.reset(new XmlParser());
    httpcore.reset(new HttpCore());

    //Init delay timer
    timer.reset(new QTimer(this));

    this->createActions();

    std::auto_ptr<QToolBar> toolbar (new QToolBar());
    toolbar->setIconSize(QSize(24, 24));
    toolbar->addAction(appdbOpen.get());
    toolbar->addAction(appdbAppPage.get());
    toolbar->addSeparator();
    toolbar->addAction(appdbCat.get());
    toolbar->addSeparator();
    toolbar->addAction(appdbClear.get());
    toolbar->addAction(appdbClearSearch.get());
    searchField.reset (new QLineEdit(this));
    connect(searchField.get(), SIGNAL(returnPressed()), this, SLOT(appdbSearch_Click()));

    toolbar->addWidget(searchField.get());
    toolbar->addAction(appdbSearch.get());

    //Init custom widgets
    appdbHeader.reset(new AppDBHeaderWidget());
    connect(appdbHeader.get(), SIGNAL(itemTrigged(short int, QString, int, int, int)), this, SLOT(itemTrigged(short int, QString, int, int, int)));
    appdbScrollArea.reset(new AppDBScrollWidget());
    connect(appdbScrollArea.get(), SIGNAL(itemTrigged(short int, QString, int, int, int)), this, SLOT(itemTrigged(short int, QString, int, int, int)));

    //Add custom widgets to mail layout
    std::auto_ptr<QVBoxLayout> contentLayout(new QVBoxLayout(this));
    contentLayout->setMargin(0);
    contentLayout->setSpacing(0);
    contentLayout->addWidget(toolbar.release());
    contentLayout->addWidget(appdbHeader.get());
    contentLayout->addWidget(appdbScrollArea.get());
    this->setLayout(contentLayout.release());

    //Connect slots and signals
    connect(timer.get(), SIGNAL(timeout()), this, SLOT(timer_timeout()));
    connect(httpcore.get(), SIGNAL(pageReaded()), this, SLOT(httpcore_pageDownloaded()));
    connect(httpcore.get(), SIGNAL(requestError(QString)), this, SLOT(requestError(QString)));
    connect(httpcore.get(), SIGNAL(updateDataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int)));
    connect(httpcore.get(), SIGNAL(stateChanged(int)), this, SLOT(stateChanged(int)));

    this->appdbHeader->addLabel(tr("Status: Ready"));
    timer->stop();

    return;
}
示例#17
0
MainWindow::MainWindow(int startState, QString run_binary, QWidget * parent, Qt::WindowFlags f) : QMainWindow(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 class pointer
    CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib");
    CoreLib.reset((corelib *)CoreLibClassPointer(true));

    clearTmp();

    db_prefix.fixPrefixPath();

    if (CoreLib->getSetting("DesktopImport", "importAtStartup", false, 0)==1){
        Progress progress(0, "");
        progress.exec();
    }

    //  importIcons(QString("%1/.local/share/applications/wine/").arg(QDir::homePath()));

    //exportProcess.close();
    // Base GUI setup
    setupUi(this);

    if (!this->createSocket()){
        this->close();
        return;
     }

    if (startState == 1)
        this->showMinimized();

    setWindowTitle(tr("%1 :. Qt GUI for Wine v%2").arg(APP_NAME) .arg(APP_VERS));

    std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout);

    std::auto_ptr<PrefixConfigWidget> configWidget (new PrefixConfigWidget(tabPrefixSeup));
    connect(configWidget.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems()));
    connect(configWidget.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int)));
    connect(this, SIGNAL(updateDatabaseConnections()), configWidget.get(), SLOT(getPrefixes()));

    std::auto_ptr<LoggingWidget> logWidget (new LoggingWidget(tabLogging));
    connect (this, SIGNAL(reloadLogData()), logWidget.get(), SLOT(getLogRecords()));

    logWidget->getLogRecords();

    logLayout->addWidget(logWidget.release());

    std::auto_ptr<IconListWidget> lstIcons (new IconListWidget(tabPrograms));
    connect(this, SIGNAL(runProgramRequest(QString)), lstIcons.get(), SLOT(runProgramRequest(QString)));
    connect(lstIcons.get(), SIGNAL(iconItemClick(QString, QString, QString, QString, QString)), this, SLOT(updateIconDesc(QString, QString, QString, QString, QString)));
    connect(lstIcons.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString)));
    connect(lstIcons.get(), SIGNAL(appRunned(bool)), this, SLOT(setMeVisible(bool)));

    std::auto_ptr<PrefixTreeWidget> twPrograms (new PrefixTreeWidget(tabPrograms));
    connect(twPrograms.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems()));
    connect(this, SIGNAL(updateDatabaseConnections()), twPrograms.get(), SLOT(getPrefixes()));
    connect(twPrograms.get(), SIGNAL(showFolderContents(QString, QString)), lstIcons.get(), SLOT(showFolderContents(QString, QString)));
    connect(twPrograms.get(), SIGNAL(setSearchFocus()), this, SLOT(setSearchFocus()));
    connect(twPrograms.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString)));
    connect(this, SIGNAL(setDefaultFocus(QString, QString)), twPrograms.get(), SLOT(setDefaultFocus(QString, QString)));
    connect(configWidget.get(), SIGNAL(prefixIndexChanged(QString)), twPrograms.get(), SLOT(setDefaultFocus(QString)));
    connect(twPrograms.get(), SIGNAL(prefixIndexChanged(QString)), configWidget.get(), SLOT(setPrefix(QString)));
    connect(twPrograms.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int)));

    connect(twPrograms.get(), SIGNAL(pasteAction()), lstIcons.get(), SLOT(iconPaste_Click()));


    std::auto_ptr<WineProcessWidget> procWidget (new WineProcessWidget(tabProcess));
    connect(this, SIGNAL(stopProcTimer()), procWidget.get(), SLOT(stopTimer()));
    connect(this, SIGNAL(startProcTimer()), procWidget.get(), SLOT(startTimer()));
    connect(procWidget.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString)));
    tabProcessLayout->addWidget(procWidget.release());

    std::auto_ptr<PrefixControlWidget> prefixWidget (new PrefixControlWidget(tabPrefix));
    connect(prefixWidget.get(), SIGNAL(updateDatabaseConnections()), twPrograms.get(), SLOT(getPrefixes()));
    connect(prefixWidget.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems()));
    connect(configWidget.get(), SIGNAL(prefixIndexChanged(QString)), prefixWidget.get(), SLOT(setDefaultFocus(QString)));
    connect(prefixWidget.get(), SIGNAL(prefixIndexChanged(QString)), configWidget.get(), SLOT(setPrefix(QString)));
    connect(prefixWidget.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int)));
    connect(twPrograms.get(), SIGNAL(updateDatabaseConnections()), prefixWidget.get(), SLOT(updateDtabaseItems()));

    std::auto_ptr<IconListToolbar> iconToolBar (new IconListToolbar(tabPrograms));
    connect(iconToolBar.get(), SIGNAL(searchFilterChange(QString)), lstIcons.get(), SLOT(setFilterString(QString)));
    connect(iconToolBar.get(), SIGNAL(changeView(int)), lstIcons.get(), SLOT(changeView(int)));

    std::auto_ptr<PrefixTreeToolbar> prefixToolBar (new PrefixTreeToolbar(tabPrograms));
    connect(prefixToolBar.get(), SIGNAL(expandTree()), twPrograms.get(), SLOT(expandTree()));
    connect(prefixToolBar.get(), SIGNAL(collapseTree()), twPrograms.get(), SLOT(collapseTree()));
    connect(prefixToolBar.get(), SIGNAL(updatePrefixTree()), this, SLOT(updateDtabaseConnectedItems()));
    connect(prefixToolBar.get(), SIGNAL(updatePrefixTree()), prefixWidget.get(), SLOT(updateDtabaseItems()));

    vlayout.reset(new QVBoxLayout);
    vlayout->addWidget(prefixToolBar.release());
    vlayout->addWidget(twPrograms.release());
    vlayout->setMargin(0);
    vlayout->setSpacing(0);
    std::auto_ptr<QWidget> wid (new QWidget(tabPrograms));
    wid->setLayout(vlayout.release());

    splitter.reset(new QSplitter(tabPrograms));
    splitter->addWidget(wid.release());

    vlayout.reset(new QVBoxLayout);
    vlayout->addWidget(iconToolBar.release());
    vlayout->addWidget(lstIcons.release());
    vlayout->setMargin(0);
    vlayout->setSpacing(0);
    //vlayout->setContentsMargins(0,0,0,0);
    wid.reset(new QWidget(tabPrograms));
    wid->setLayout(vlayout.release());

    splitter->addWidget(wid.release());

    vlayout.reset(new QVBoxLayout);
    vlayout->addWidget(splitter.get());
    vlayout->addWidget(gbInfo);

    vlayout->setContentsMargins(3,0,3,3);
    tabPrograms->setLayout(vlayout.release());
    tabPrefixLayout->addWidget(prefixWidget.release());
    setupLayout->addWidget(configWidget.release());

    // Updating database connected items
    updateDtabaseConnectedItems();

    // Getting settings from config file
    this->createTrayIcon();
    this->getSettings();

    connect(tbwGeneral, SIGNAL(currentChanged(int)), this, SLOT(tbwGeneral_CurrentTabChange(int)));
    //connect(cmdCreateFake, SIGNAL(clicked()), this, SLOT(cmdCreateFake_Click()));
    //connect(cmdUpdateFake, SIGNAL(clicked()), this, SLOT(cmdUpdateFake_Click()));

    //Main menu actions connection to slots
    connect(mainRun, SIGNAL(triggered()), this, SLOT(mainRun_Click()));
    connect(mainPrograms, SIGNAL(triggered()), this, SLOT(mainPrograms_Click()));
    connect(mainLogging, SIGNAL(triggered()), this, SLOT(mainLogging_Click()));
    connect(mainProcess, SIGNAL(triggered()), this, SLOT(mainProcess_Click()));
    connect(mainSetup, SIGNAL(triggered()), this, SLOT(mainSetup_Click()));
    connect(mainPrefix, SIGNAL(triggered()), this, SLOT(mainPrefix_Click()));
    connect(mainImageManage, SIGNAL(triggered()), this, SLOT(mainImageManager_Click()));
    connect(mainAbout, SIGNAL(triggered()), this, SLOT(mainAbout_Click()));
    connect(mainAboutQt, SIGNAL(triggered()), this, SLOT(mainAboutQt_Click()));
    connect(mainExportIcons, SIGNAL(triggered()), this, SLOT(mainExportIcons_Click()));
    connect(mainOptions, SIGNAL(triggered()), this, SLOT(mainOptions_Click()));
    connect(mainInstall, SIGNAL(triggered()), this, SLOT(mainInstall_Click()));
    connect(mainExit, SIGNAL(triggered()), this, SLOT(mainExit_Click()));
    connect(mainImportWineIcons, SIGNAL(triggered()), this, SLOT(mainImportWineIcons_Click()));
    connect(mainVersionManager, SIGNAL(triggered()), this, SLOT(mainVersionManager_Click()));

    CoreLib->runAutostart();

#ifndef WITH_ICOUTILS
    mainExportIcons->setEnabled(false);
#endif

    if (!run_binary.isEmpty())
        messageReceived(run_binary);

    if (!trayIcon->isVisible())
        show();

    return;
}
示例#18
0
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;
}
示例#19
0
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;
}
示例#20
0
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;
}
示例#21
0
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;
}
示例#22
0
WineProcessWidget::WineProcessWidget(QWidget *parent) : QWidget(parent)
{
    // 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));

    this->createActions();

    std::auto_ptr<QToolBar> toolBar (new QToolBar(this));
    toolBar->addAction(procKillSelected.get());
    toolBar->addAction(procKillWine.get());
    toolBar->addSeparator();
    toolBar->addAction(procRefresh.get());

    procTable.reset(new QTableView(this));

    model.reset(new QStandardItemModel());
    model->setColumnCount(4);
    model->setHeaderData(0, Qt::Horizontal, tr("PID"), Qt::DisplayRole);
    model->setHeaderData(1, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
    model->setHeaderData(2, Qt::Horizontal, tr("Ni"), Qt::DisplayRole);
    model->setHeaderData(3, Qt::Horizontal, tr("Prefix path"), Qt::DisplayRole);

    procTable->setContextMenuPolicy(Qt::CustomContextMenu);
    procTable->setModel(model.get());

    connect(procTable.get(), SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(customContextMenuRequested(const QPoint &)));
    connect(procTable.get(), SIGNAL(clicked(const QModelIndex &)), this, SLOT(itemClicked(const QModelIndex &)));

    procTable->resizeColumnsToContents();
    procTable->resizeRowsToContents();
    procTable->horizontalHeader()->setStretchLastSection(true);
    procTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    procTable->setSelectionMode(QAbstractItemView::ExtendedSelection);

    lblInfo.reset(new QLabel(tr("Total process count: %1").arg(0), this));
    lblInfo->setContentsMargins(2,2,2,2);


    std::auto_ptr<QVBoxLayout> layout (new QVBoxLayout(this));
    layout->setSpacing(0);
    layout->setContentsMargins(0,0,0,0);
    layout->addWidget(toolBar.release());
    layout->addWidget(procTable.get());
    layout->addWidget(lblInfo.get());

    this->setLayout(layout.release());

    timer.reset(new QTimer());
    timer->start(1000);

    // Connecting signals and slots
    connect(timer.get(), SIGNAL(timeout()), this, SLOT(getWineProcesssInfo()));
    return;
}
示例#23
0
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;
}
示例#24
0
文件: wizard.cpp 项目: Vdragon/q4wine
Wizard::Wizard(int WizardType, QString var1, QWidget * parent, Qt::WindowFlags f) : QDialog(parent, f)
{
    /*
        Note: var1 is optional data, used for different scene actions ;)
    */

    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));

    Scena=WizardType;
    Page=1;
    QString console_w;

    loadThemeIcons(Scena);

    connect(cmdCancel, SIGNAL(clicked()), this, SLOT(reject ()));
    connect(cmdNext, SIGNAL(clicked()), this, SLOT(nextWizardPage()));
    connect(cmdBack, SIGNAL(clicked()), this, SLOT(previosWizardPage()));
    connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString)));
    connect(comboMountProfiles, SIGNAL(currentIndexChanged(int)), this, SLOT(comboMountProfiles_currentIndexChanged(int)));

    switch (Scena){
 case 1:
        TotalPage=8;

        setWindowTitle(tr("First startup wizard"));
        lblCaption->setText(tr("<b>First startup wizard</b>"));
        lblStep->setText(tr("<b>Step %1 of %2</b>").arg(Page).arg(TotalPage));

        cmdGetWineBin->installEventFilter(this);
        cmdGetWineServerBin->installEventFilter(this);
        cmdGetWineLoaderBin->installEventFilter(this);
        cmdGetWineDllPath->installEventFilter(this);
        cmdGetWineDllPath64->installEventFilter(this);

        cmdGetTarBin->installEventFilter(this);
        cmdGetMountBin->installEventFilter(this);
        cmdGetUmountBin->installEventFilter(this);
        cmdGetSudoBin->installEventFilter(this);
        cmdGetGuiSudoBin->installEventFilter(this);
        cmdGetNiceBin->installEventFilter(this);
        cmdGetReniceBin->installEventFilter(this);
        cmdGetShBin->installEventFilter(this);

        cmdGetConsoleBin->installEventFilter(this);

        txtWineBin->setText(CoreLib->getWhichOut("wine"));
        txtWineServerBin->setText(CoreLib->getWhichOut("wineserver"));
        txtWineLoaderBin->setText(CoreLib->getWhichOut("wine"));


        QStringList libs_path = CoreLib->getWineLibsPath();
        /*
        if (libs_path.isEmpty()){
            QStringList libs_loc, libs_arch;
            libs_loc << "/usr/lib" << "/usr/local/lib" << "/local/usr/lib";
            libs_arch << "64" << "32" << "";

            foreach (QString loc, libs_loc){
                foreach (QString arch, libs_arch){
                    libs_path = loc;
                    libs_path.append(arch);
                    QString libwine_path = libs_path;
                    libwine_path.append("/libwine.so");
                    if (QFile(libwine_path).exists()){
                        break;
                        libs_path.append("/wine`");
                    }
                }
            }
        }*/
        txtWineDllPath->setText(libs_path.at(0));
        txtWineDllPath64->setText(libs_path.at(1));

        txtTarBin->setText(CoreLib->getWhichOut("tar"));
        txtMountBin->setText(CoreLib->getWhichOut("mount"));
        txtUmountBin->setText(CoreLib->getWhichOut("umount"));
        txtSudoBin->setText(CoreLib->getWhichOut("sudo"));

        QStringList guisudo;
#ifdef _OS_DARWIN_
        guisudo << "osascript";
#else
        guisudo << "kdesudo" << "kdesu" << "gksudo" << "gksu" << "sudo";
#endif
        foreach (QString bin, guisudo){
            QString path = CoreLib->getWhichOut(bin, false);
            if (!path.isEmpty()){
                txtGuiSudoBin->setText(path);
                break;
            }
        }

        txtNiceBin->setText(CoreLib->getWhichOut("nice"));
        txtReniceBin->setText(CoreLib->getWhichOut("renice"));
        txtShBin->setText(CoreLib->getWhichOut("sh"));

#ifdef _OS_DARWIN_
        txtConsoleBin->setText("/usr/X11/bin/xterm");
        txtConsoleArgs->setText("-e");
#else
        console_w = CoreLib->getWhichOut("konsole", false);
        if (!console_w.isEmpty()){
            txtConsoleBin->setText(console_w);
            txtConsoleArgs->setText("--noclose -e");
        } else {
            console_w = CoreLib->getWhichOut("xterm", false);
            if (!console_w.isEmpty()){
                txtConsoleBin->setText(console_w);
                txtConsoleArgs->setText("-e");
            }
        }
#endif

#ifdef WITH_ICOUTILS
        txtWrestoolBin->setText(CoreLib->getWhichOut("wrestool"));
        txtIcotoolBin->setText(CoreLib->getWhichOut("icotool"));
        cmdGetWrestoolBin->installEventFilter(this);
        cmdGetIcotoolBin->installEventFilter(this);
#else
        cmdGetWrestoolBin->setEnabled(false);
        cmdGetIcotoolBin->setEnabled(false);
        txtWrestoolBin->setEnabled(false);
        txtIcotoolBin->setEnabled(false);
#endif

#ifdef _OS_DARWIN_
        this->comboMountProfiles->setCurrentIndex(0);
        this->comboMountProfiles_currentIndexChanged(0);
#else
        if (CoreLib->getWhichOut("fuseiso", false).isEmpty()){
            this->comboMountProfiles->setCurrentIndex(0);
        } else {
            this->comboMountProfiles->setCurrentIndex(2);
        }
#endif

        break;
    }
示例#25
0
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;
}