예제 #1
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;
}
예제 #2
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;
}