Logo Search packages:      
Sourcecode: q4wine version File versions  Download package

Wizard::Wizard ( int  WizardType,
QString  var1 = "",
QWidget *  parent = 0,
Qt::WFlags  f = 0 
)

This is class constructor.

Parameters:
WizardType Type of wizard scenario.
var1 This variable used for different scenarion actions.

Definition at line 124 of file wizard.cpp.

References changeBoxState(), cmdHelp_Click(), comboProxyType_indexChanged(), db_prefix, Prefix::getMountPoint(), Prefix::getPath(), libq4wine, loadThemeIcons(), nextWizardPage(), previosWizardPage(), Registry::readExcludedKeys(), Registry::readKeys(), and updateScena().

                                                                         : QDialog(parent, f)
{
      /*
            Note: var1 is optional data, used for different scene actions ;)
      */

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

      widgetCreatePrefix0->setVisible(FALSE);

      Scena=WizardType;
      Page=1;
      QString console_w;

      loadThemeIcons(Scena);

      QString pic="", line="", prefixPath="";
      std::auto_ptr<DriveListWidgetItem> item;

      switch (Scena){
 case 0:
            TotalPage=5;

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

            connect (cbCreafeFake, SIGNAL(stateChanged (int)), this, SLOT(changeBoxState(int)));

            cmdGetPrefixPath->installEventFilter(this);
            cmdGetWineBin->installEventFilter(this);
            cmdGetWineServerBin->installEventFilter(this);
            cmdGetWineLoaderBin->installEventFilter(this);
            cmdGetWineDllPath->installEventFilter(this);
            cmdGetMountPoint->installEventFilter(this);

            combSourceDevice->addItems(CoreLib->getCdromDevices());
            break;
 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);

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

            if (QDir("/usr/lib/wine").exists())
                  txtWineDllPath->setText("/usr/lib/wine");

            if (QDir("/local/usr/lib/wine").exists())
                  txtWineDllPath->setText("/local/usr/lib/wine");

            if (QDir("/usr/local/lib/wine").exists())
                  txtWineDllPath->setText("/usr/local/lib/wine");

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

            txtGuiSudoBin->setText(CoreLib->getWhichOut("kdesu", FALSE));
            if (txtGuiSudoBin->text().isEmpty()){
                  txtGuiSudoBin->setText(CoreLib->getWhichOut("gksudo", FALSE));
                  if (txtGuiSudoBin->text().isEmpty()){
                        txtGuiSudoBin->setText(CoreLib->getWhichOut("gksu", FALSE));
                        if (txtGuiSudoBin->text().isEmpty()){
                              txtGuiSudoBin->setText(CoreLib->getWhichOut("sudo", FALSE));
                        }
                  }
            }

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

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

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

            break;
      case 2:
        TotalPage=10;
            this->var1=var1;
            setWindowTitle(tr("Fake drive creation wizard"));
            lblCaption->setText(tr("<b>Fake drive creation wizard</b>"));
            lblStep->setText(tr("<b>Step %1 of %2</b>").arg(Page).arg(TotalPage));
            lblWizardInfo->setText(Wizard::tr("<p>Welcome to fake drive creation wizard.</p><p>This wizard helps you to make all necessary steps for successful fake drive creation.</p><p>Please, press the <b>Next</b> button to go to the next wizard's page. Or press <b>Back</b> button for return.</p>"));

            cmdGetWineDesktop->installEventFilter(this);
            cmdGetWineDesktopDoc->installEventFilter(this);
            cmdGetWineDesktopPic->installEventFilter(this);
            cmdGetWineDesktopMus->installEventFilter(this);
            cmdGetWineDesktopVid->installEventFilter(this);

            item.reset(new DriveListWidgetItem(listWineDrives));
            item->setDrive("C:", "../drive_c", "auto");
            listWineDrives->addItem(item.release());

        if (!db_prefix.getMountPoint(var1).isEmpty()){
                  item.reset(new DriveListWidgetItem(listWineDrives));
            item->setDrive("D:", db_prefix.getMountPoint(var1), "cdrom");
                  listWineDrives->addItem(item.release());
            }

            item.reset(new DriveListWidgetItem(listWineDrives));
            item->setDrive("Z:", "/", "auto");
            listWineDrives->addItem(item.release());

            item.reset(new DriveListWidgetItem(listWineDrives));
            item->setDrive("H:", QString("%1/.config/q4wine/tmp").arg(QDir::homePath()), "auto");
            listWineDrives->addItem(item.release());

        txtWineDesktop->setText(QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
            txtWineDesktopDoc->setText(QDir::homePath());
            txtWineDesktopMus->setText(QDir::homePath());
            txtWineDesktopPic->setText(QDir::homePath());
            txtWineDesktopVid->setText(QDir::homePath());

            break;
      case 3:
            TotalPage=10;
            this->var1=var1;

            prefixPath = db_prefix.getPath(var1);
            if (prefixPath.isEmpty()){
                  qDebug()<<" [EE] Cant get prefix path: "<<var1;
                  return;
            }

            Registry reg(prefixPath);

            QStringList list;
            list << "\"RegisteredOrganization\"" << "\"RegisteredOwner\"";
            list = reg.readKeys("system", "Software\\Microsoft\\Windows NT\\CurrentVersion", list);
            //HKEY_CURRENT_USER\\Software\\Wine]\n\"Version

            if (list.count()>0){
                  txtOrganization->setText(list.at(0));
                  txtOwner->setText(list.at(1));
            }

            list.clear();
            list << "\"Browsers\"" << "\"Mailers\"";
            list = reg.readKeys("user", "Software\\Wine\\WineBrowser", list);

            if (list.count()>0){
                  txtFakeBrowsers->setText(list.at(0));
                  txtFakeMailers->setText(list.at(1));
            }

            list.clear();
            list << "\"Multisampling\"" << "\"DirectDrawRenderer\"" << "\"RenderTargetLockMode\"" << "\"OffscreenRenderingMode\"" << "\"UseGLSL\"" << "\"VideoMemorySize\"" << "\"VideoDescription\"" << "\"VideoDriver\"" << "\"SoftwareEmulation\"" << "\"PixelShaderMode\"" << "\"VertexShaderMode\"";
            list = reg.readKeys("user", "Software\\Wine\\Direct3D", list);

            if (list.count()>0){
                  if (!list.at(0).isEmpty())
                        comboFakeD3D_Multi->setCurrentIndex(comboFakeD3D_Multi->findText(list.at(0)));

                  if (!list.at(1).isEmpty())
                        comboFakeD3D_Render->setCurrentIndex(comboFakeD3D_Render->findText(list.at(1)));

                  if (!list.at(2).isEmpty())
                        comboFakeD3D_LMode->setCurrentIndex(comboFakeD3D_LMode->findText(list.at(2)));

                  if (!list.at(3).isEmpty())
                        comboFakeD3D_Offscreen->setCurrentIndex(comboFakeD3D_Offscreen->findText(list.at(3)));

                  if (!list.at(4).isEmpty())
                        comboFakeD3D_GLSL->setCurrentIndex(comboFakeD3D_GLSL->findText(list.at(4)));

                  txtFakeVideoMemory->setText(list.at(5));
                  txtFakeVideoDescription->setText(list.at(6));
                  txtFakeVideoDriver->setText(list.at(7));

                  if (!list.at(8).isEmpty())
                        comboFakeSoftwareEmulation->setCurrentIndex(comboFakeSoftwareEmulation->findText(list.at(8)));

                  if (!list.at(9).isEmpty())
                        comboFakePixelShaderMode->setCurrentIndex(comboFakePixelShaderMode->findText(list.at(9)));

                  if (!list.at(10).isEmpty())
                        comboFakeVertexShaderMode->setCurrentIndex(comboFakeVertexShaderMode->findText(list.at(10)));

            }

            list.clear();
            list << "\"DisabledExtensions\"";
            list = reg.readKeys("user", "Software\\Wine\\OpenGL", list);

            if (list.count()>0){
                  txtFakeDisabledExtensions->setText(list.at(0));
            }

            list.clear();
            list << "\"MouseWarpOverride\"";
            list = reg.readKeys("user", "Software\\Wine\\DirectInput", list);

            if (list.count()>0){
                  if (!list.at(0).isEmpty())
                        comboFakeMouseWarp->setCurrentIndex(comboFakeMouseWarp->findText(list.at(0)));
            }

            list.clear();
            list << "\"MouseWarpOverride\"";
            list = reg.readExcludedKeys("user", "Software\\Wine\\DirectInput", list, 10);

            if (list.count()>0){
                  listJoystickAxesMappings->insertItems (0, list);
            }

            list.clear();
            list << "\"ClientSideWithRender\"" << "\"ClientSideAntiAliasWithRender\"" << "\"ClientSideAntiAliasWithCore\"" << "\"UseXRandR\"" << "\"UseXVidMode\"";
            list = reg.readKeys("user", "Software\\Wine\\X11 Driver", list);

            if (list.count()>0){
                  if (!list.at(0).isEmpty())
                        comboFakeX11_WR->setCurrentIndex(comboFakeX11_WR->findText(list.at(0)));

                  if (!list.at(1).isEmpty())
                        comboFakeX11_AAR->setCurrentIndex(comboFakeX11_AAR->findText(list.at(1)));

                  if (!list.at(2).isEmpty())
                        comboFakeX11_AAC->setCurrentIndex(comboFakeX11_AAC->findText(list.at(2)));

                  if (!list.at(3).isEmpty())
                        comboFakeX11_XRandr->setCurrentIndex(comboFakeX11_XRandr->findText(list.at(3)));

                  if (!list.at(4).isEmpty())
                        comboFakeX11_XVid->setCurrentIndex(comboFakeX11_XVid->findText(list.at(4)));
            }

            QDir wineDriveDir;
            wineDriveDir.setFilter(QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot  );

            prefixPath.append("/dosdevices/");
            if (!wineDriveDir.cd(prefixPath)){
                  qDebug()<<"Cannot cd to prefix directory: "<<prefixPath;
            } else {

                  QFileInfoList drivelist = wineDriveDir.entryInfoList();
                  for (int i = 0; i < drivelist.size(); ++i) {
                        QFileInfo fileInfo = drivelist.at(i);
                        QString path = "";
                        if (fileInfo.fileName().toUpper()=="C:"){
                              path = "../drive_c";
                        } else {
                              path = fileInfo.symLinkTarget();
                        }

                        list.clear();
                        list<<QString("\"%1\"").arg(fileInfo.fileName());
                        list = reg.readKeys("system", "Software\\Wine\\Drives", list);

                        item.reset(new DriveListWidgetItem(listWineDrives));
                        item->setDrive(fileInfo.fileName().toUpper(), path, list.at(0));
                        listWineDrives->addItem(item.release());
                  }
            }

            prefixPath.append("c:/users/");
            prefixPath.append(getenv("USER"));

            if (!wineDriveDir.cd(prefixPath)){
                  qDebug()<<"Cannot cd to prefix directory: "<<prefixPath;
            } else {
                  QFileInfo fileinfo(QString("%1/Desktop").arg(prefixPath));
                  if (fileinfo.isSymLink()){
                        txtWineDesktop->setText(fileinfo.symLinkTarget());
                  } else {
                        txtWineDesktop->setText(fileinfo.filePath());
                  }

                  fileinfo.setFile(QString("%1/My Documents").arg(prefixPath));
                  if (fileinfo.isSymLink()){
                        txtWineDesktopDoc->setText(fileinfo.symLinkTarget());
                  } else {
                        txtWineDesktopDoc->setText(fileinfo.filePath());
                  }

                  fileinfo.setFile(QString("%1/My Music").arg(prefixPath));
                  if (fileinfo.isSymLink()){
                        txtWineDesktopMus->setText(fileinfo.symLinkTarget());
                  } else {
                        txtWineDesktopMus->setText(fileinfo.filePath());
                  }

                  fileinfo.setFile(QString("%1/My Pictures").arg(prefixPath));
                  if (fileinfo.isSymLink()){
                        txtWineDesktopPic->setText(fileinfo.symLinkTarget());
                  } else {
                        txtWineDesktopPic->setText(fileinfo.filePath());
                  }

                  fileinfo.setFile(QString("%1/My Videos").arg(prefixPath));
                  if (fileinfo.isSymLink()){
                        txtWineDesktopVid->setText(fileinfo.symLinkTarget());
                  } else {
                        txtWineDesktopVid->setText(fileinfo.filePath());
                  }
            }

            setWindowTitle(tr("Fake drive update wizard"));
            lblCaption->setText(tr("<b>Fake drive update wizard</b>"));
            lblStep->setText(tr("<b>Step %1 of %2</b>").arg(Page).arg(TotalPage));
            lblWizardInfo->setText(Wizard::tr("<p>Welcome to fake drive update wizard.</p><p>This wizard helps you to make all necessary steps for successful fake drive creation.</p><p>Please, press the <b>Next</b> button to go to the next wizard's page. Or press <b>Back</b> button for return.</p>"));
            Scena=2;

            cmdGetWineDesktop->installEventFilter(this);
            cmdGetWineDesktopDoc->installEventFilter(this);
            cmdGetWineDesktopPic->installEventFilter(this);
            cmdGetWineDesktopMus->installEventFilter(this);
            cmdGetWineDesktopVid->installEventFilter(this);
            break;
      }

      connect(cmdCancel, SIGNAL(clicked()), this, SLOT(reject ()));
      connect(cmdNext, SIGNAL(clicked()), this, SLOT(nextWizardPage()));
      connect(cmdBack, SIGNAL(clicked()), this, SLOT(previosWizardPage()));
      connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click()));
      connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString)));

      widgetCreatePrefix0->setVisible(FALSE);
      widgetCreatePrefix1->setVisible(FALSE);
      widgetCreatePrefix2->setVisible(FALSE);

      widgetCreateFakeDrive0->setVisible(FALSE);
      widgetCreateFakeDrive1->setVisible(FALSE);
      widgetCreateFakeDrive2->setVisible(FALSE);
      widgetCreateFakeDrive3->setVisible(FALSE);
      widgetCreateFakeDrive4->setVisible(FALSE);
      widgetCreateFakeDrive5->setVisible(FALSE);
      widgetCreateFakeDrive6->setVisible(FALSE);
      widgetCreateFakeDrive7->setVisible(FALSE);


      widgetFirstStartup0->setVisible(FALSE);
      widgetFirstStartup1->setVisible(FALSE);
      widgetFirstStartup2->setVisible(FALSE);
      widgetFirstStartup3->setVisible(FALSE);
      widgetFirstStartup4->setVisible(FALSE);

      widgetInfo->setVisible(FALSE);

      updateScena();

      this->installEventFilter(this);

      return;
}


Generated by  Doxygen 1.6.0   Back to index