Esempio n. 1
0
void JumpToDialog::checkValidity(void)
{
	QValidator::State state = QValidator::Acceptable;

	int i;

	const QValidator *vldr = cbFunctions->validator();
	QString s = cbFunctions->currentText();
	int pos = 0;
	if (vldr->validate(s, pos) != QValidator::Acceptable) {
		state = QValidator::Invalid;
	}

	/* Find OK button */
	QAbstractButton *okButton = NULL;
	QList<QAbstractButton*> buttonList;
	buttonList = buttonBox->buttons();
	for (i = 0; i < buttonList.size(); i++) {
		if (buttonBox->buttonRole(buttonList[i])
				== QDialogButtonBox::AcceptRole) {
			okButton = buttonList[i];
		}
	}

	if (!okButton) {
		return;
	}

	if (state == QValidator::Acceptable) {
		okButton->setEnabled(true);
	} else {
		okButton->setEnabled(false);
	}
}
void
PluginsInstallPage::initializePage()
{
    setTitle( tr( "Your plugins are now being installed" ) );

    wizard()->setCommitPage( true );

    QAbstractButton* continueButton = wizard()->setButton( FirstRunWizard::NextButton, tr( "Continue" ) );
    if ( wizard()->canGoBack() )
        wizard()->setButton( FirstRunWizard::BackButton, tr( "<< Back" ) );

#ifdef Q_OS_WIN32
    if ( wizard()->pluginList()->installList().count() > 0 )
    {
        // get the install to happen a bit later so that
        // we actually show this page of the wizard
        // and the user has time to read what's happening
        QTimer::singleShot( 1000, this, SLOT(install()) );
        continueButton->setEnabled( false );
    }
    else
    {
        continueButton->click();
    }
#endif
}
Esempio n. 3
0
void TaskDatumParameters::updateRefButton(int idx)
{
    QAbstractButton* b;
    switch(idx){
        case 0: b = ui->buttonRef1; break;
        case 1: b = ui->buttonRef2; break;
        case 2: b = ui->buttonRef3; break;
        case 3: b = ui->buttonRef4; break;
        default: throw Base::Exception("button index out of range");
    }

    Part::Datum* pcDatum = static_cast<Part::Datum*>(DatumView->getObject());
    std::vector<App::DocumentObject*> refs = pcDatum->Support.getValues();

    int numrefs = refs.size();
    bool enable = true;
    if (idx > numrefs)
        enable = false;
    if (idx == numrefs && this->lastSuggestResult.nextRefTypeHint.size() == 0)
        enable = false;
    b->setEnabled(enable);

    b->setChecked(iActiveRef == idx);

    if (iActiveRef == idx) {
        b->setText(tr("Selecting..."));
    } else if (idx < static_cast<int>(this->lastSuggestResult.references_Types.size())){
        b->setText(AttacherGui::getShapeTypeText(this->lastSuggestResult.references_Types[idx]));
    } else {
        b->setText(tr("Reference%1").arg(idx+1));
    }
}
PreferencesDialog::PreferencesDialog( QMenuBar* menuBar, QWidget* parent )
    :unicorn::MainWindow( menuBar, parent ),
    ui( new Ui::PreferencesDialog )
{
    // Disable the minimize and maximize buttons.
    Qt::WindowFlags flags = this->windowFlags();
    flags &= ~Qt::WindowMinMaxButtonsHint;
    setWindowFlags(flags);

    ui->setupUi( this );

    setAttribute( Qt::WA_DeleteOnClose, true );

    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionGeneral ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionScrobbling ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionDevices ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAccounts ) )->setAutoExclusive( true );
    static_cast<QAbstractButton*>( ui->toolBar->widgetForAction( ui->actionAdvanced ) )->setAutoExclusive( true );

    connect( ui->toolBar->widgetForAction( ui->actionGeneral ), SIGNAL(toggled(bool)), ui->actionGeneral, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionScrobbling ), SIGNAL(toggled(bool)), ui->actionScrobbling, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionDevices ), SIGNAL(toggled(bool)), ui->actionDevices, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionAccounts ), SIGNAL(toggled(bool)), ui->actionAccounts, SLOT(setChecked(bool)) );
    connect( ui->toolBar->widgetForAction( ui->actionAdvanced ), SIGNAL(toggled(bool)), ui->actionAdvanced, SLOT(setChecked(bool)) );

    connect( this, SIGNAL( saveNeeded() ), ui->general, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->scrobbling, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->ipod, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->accounts, SLOT( saveSettings() ) );
    connect( this, SIGNAL( saveNeeded() ), ui->advanced, SLOT( saveSettings() ) );

    connect( ui->general, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->scrobbling, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->ipod, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->accounts, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );
    connect( ui->advanced, SIGNAL( settingsChanged() ), SLOT( onSettingsChanged() ) );

    connect( ui->actionGeneral, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionScrobbling, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionDevices, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionAccounts, SIGNAL(triggered()), SLOT(onTabButtonClicked()));
    connect( ui->actionAdvanced, SIGNAL(triggered()), SLOT(onTabButtonClicked()));

    connect( ui->stackedWidget, SIGNAL(currentChanged(int)), this, SLOT(onStackCurrentChanged(int)), Qt::QueuedConnection );

#ifdef Q_OS_MAC
    ui->buttonBox->hide();
#endif
    connect( ui->buttonBox, SIGNAL( accepted() ), SLOT( onAccepted() ) );
    connect( ui->buttonBox, SIGNAL( rejected() ), SLOT( onRejected() ) );

    QAbstractButton* applyButton = ui->buttonBox->button( QDialogButtonBox::Apply );
    applyButton->setEnabled( false );
    connect( applyButton, SIGNAL( clicked() ), SLOT( onApplyButtonClicked() ) );

    setFixedWidth( 550 );

    ui->stackedWidget->setCurrentWidget( ui->accounts );
    ui->actionGeneral->trigger();
}
Esempio n. 5
0
bool wxRadioBox::Enable(unsigned int n, bool enable)
{
    QAbstractButton *qtButton = GetButtonAt( m_qtButtonGroup, n );
    CHECK_BUTTON( qtButton, false );

    qtButton->setEnabled( enable );
    return true;
}
void ExportWizard::xmlWorkFinish()
{
    QAbstractButton *finishButton = button(QWizard::FinishButton);
    finishButton->setEnabled(true);
    setButtonText(QWizard::FinishButton, tr("Finish"));
    setOption(QWizard::DisabledBackButtonOnLastPage, false);
    delete xmlWorkThread;
}
Esempio n. 7
0
void EditCallDialog::checkValidity(void)
{
    QValidator::State state = QValidator::Acceptable;
    
    int i;
    for (i=0; i<m_qObjects.size(); i++) {
        const FunctionCall::Argument *arg = m_pChangedCall->getArgument(i);
        switch (arg->iType) {
            case DBG_TYPE_ENUM:
                {
                    QComboBox *cb = (QComboBox*)m_qObjects[i];
                    const QValidator *vldr = cb->validator();
                    QString s = cb->currentText();
                    int pos = 0;
                    if (vldr->validate(s, pos) != QValidator::Acceptable) {
                        state = QValidator::Invalid;
                    }
                    break;
                }
            default:
                break;
        }
    }

    /* Find OK button */
    QAbstractButton *okButton = NULL;
    QList<QAbstractButton*> buttonList;
    buttonList = buttonBox->buttons();
    for(i=0; i<buttonList.size(); i++) {
        if (buttonBox->buttonRole(buttonList[i]) == 
                QDialogButtonBox::AcceptRole) {
            okButton = buttonList[i];
        }
    }

    if (!okButton) {
        return;
    }

    if (state == QValidator::Acceptable) {
        okButton->setEnabled(true);
    } else {
        okButton->setEnabled(false);
    }
}
void ExportWizard::excelWorkFinish()
{
    QAbstractButton *finishButton = button(QWizard::FinishButton);
    finishButton->setEnabled(true);
    setButtonText(QWizard::FinishButton, tr("Finish"));
    setOption(QWizard::DisabledBackButtonOnLastPage, false);
    QSqlDatabase::removeDatabase("ExportExcel");
    delete excelWorkThread;  
}
Esempio n. 9
0
bool LoadObjectsProgressPage::validatePage()
{
	// Re-Enable cancel button for the next step
	QAbstractButton* cancel = wizard()->button(QWizard::CancelButton);
	if(cancel)
	{
		cancel->setEnabled(true);
	}
	return true;
}
void ExportWizard::workFinish()
{
    QAbstractButton *finishButton = button(QWizard::FinishButton);
    finishButton->setEnabled(true);
    setButtonText(QWizard::FinishButton, tr("Finish"));
    setOption(QWizard::DisabledBackButtonOnLastPage, false);
//    progressPage->progressBar->setMaximum(1);
    delete workThread;
    QSqlDatabase::removeDatabase("QODBCTempConnect");
}
Esempio n. 11
0
void StartPage::handle_selectionChanged()
{
    QItemSelectionModel * sel_model = qobject_cast<QItemSelectionModel *>(sender());
    Q_ASSERT(sel_model);
    QAbstractItemView * area = area_of(sel_model->model());
    Q_ASSERT(area);
    QString button_name = area->property("open_button_name").toString();
    QAbstractButton * button = findChild<QAbstractButton *>(button_name);
    Q_ASSERT(button);
    button->setEnabled( area->currentIndex().isValid() );
}
Esempio n. 12
0
/**
  * @brief the current tab changed
  */
void OpenNIC::tabChanged(int tab)
{
	QDialogButtonBox* buttonBox = ui->buttonBox;
	QList<QAbstractButton *> buttons = buttonBox->buttons();
	for(int n=0; n < buttons.count(); n++)
	{
		QAbstractButton* button = buttons.at(n);
		if (buttonBox->buttonRole(button) == QDialogButtonBox::ApplyRole || buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
		{
			if ( tab == 1 || tab == 5 )
			{
				button->setEnabled(true);
			}
			else
			{
				button->setEnabled(false);
			}
		}
	}
}
void
PluginsInstallPage::install()
{
#ifdef Q_OS_WIN32
    foreach( IPluginInfo* plugin, wizard()->pluginList()->installList() )
        plugin->doInstall();
#endif

    QAbstractButton* continueButton = wizard()->setButton( FirstRunWizard::NextButton, tr( "Continue" ) );
    continueButton->setEnabled( true );
    QTimer::singleShot( 1000, continueButton, SLOT(click()) );
}
Esempio n. 14
0
void TicTacToe::on_buttonNewGame_clicked()
{
	QListIterator<QAbstractButton *> i(gameField->buttons());
	while (i.hasNext())
	{
		QAbstractButton *qab = i.next();
		qab->setEnabled(true);
		qab->setIcon(QIcon());
		qab->setWhatsThis("");
	}
	buttonNewGame->setEnabled(false);
	switchPlayer();
}
void PsdSettingsPopup::onModeChanged(const QString &mode) {
  if (mode == "Single Image") {
    m_mode = FLAT;
    m_modeDescription->setText(modesDescription[0]);
    m_createSubXSheet->setEnabled(false);
    m_levelNameType->setEnabled(false);
    QList<QAbstractButton *> buttons = m_psdFolderOptions->buttons();
    while (!buttons.isEmpty()) {
      QAbstractButton *btn = buttons.takeFirst();
      btn->setEnabled(false);
    }
  } else if (mode == "Frames") {
    m_mode = FRAMES;
    m_modeDescription->setText(modesDescription[1]);
    m_createSubXSheet->setEnabled(false);
    m_levelNameType->setEnabled(false);
    QList<QAbstractButton *> buttons = m_psdFolderOptions->buttons();
    while (!buttons.isEmpty()) {
      QAbstractButton *btn = buttons.takeFirst();
      btn->setEnabled(false);
    }
  } else if (mode == "Columns") {
    if (m_psdFolderOptions->checkedId() == 2 ||
        m_psdFolderOptions->checkedId() == 1)
      m_mode = FOLDER;
    else
      m_mode = COLUMNS;
    m_modeDescription->setText(modesDescription[2]);
    m_createSubXSheet->setEnabled(true);
    m_levelNameType->setEnabled(true);
    QList<QAbstractButton *> buttons = m_psdFolderOptions->buttons();
    while (!buttons.isEmpty()) {
      QAbstractButton *btn = buttons.takeFirst();
      btn->setEnabled(true);
    }
  } else {
    assert(false);
  }
}
Esempio n. 16
0
void EmailAccountWizardAccountPage::enableButtons()
{
    EmailAccountWizard* w = static_cast<EmailAccountWizard*>(wizard());
    Q_ASSERT(w);
    if (!w)
        return;

    QAbstractButton* nextButton = w->button(QWizard::NextButton);
    Q_ASSERT(nextButton);
    if (!nextButton)
        return;

    nextButton->setEnabled(true);
}
Esempio n. 17
0
void TicTacToe::on_gameField_buttonClicked(QAbstractButton *button)
{
	switch(_currPlayer)
	{
	case 1:
		button->setIcon(QPixmap::fromImage(*_player1));
		button->setWhatsThis("1");
		break;
	case 2:
		button->setIcon(QPixmap::fromImage(*_player2));
		button->setWhatsThis("2");
		break;
	}
	button->setEnabled(false);
	bool won = checkWin();
	if(won || full())
	{
		if(won)
		{
			QListIterator<QAbstractButton *> i(gameField->buttons());
			while (i.hasNext())
			{
				QAbstractButton *qab = i.next();
				qab->setEnabled(false);
			}
			switch(_currPlayer)
			{
			case 1:
				scorePlayer1->setText(QString::number(++_score1));
				printInfo("Player 1 wins!");
				break;
			case 2:
				scorePlayer2->setText(QString::number(++_score2));
				printInfo("Player 2 wins!");
				break;
			}
		}
		turnPlayer1->setText("");
		turnPlayer2->setText("");
		buttonNewGame->setEnabled(true);
	}
	else
	{
		switchPlayer();
	}
}
Esempio n. 18
0
void GetObjectsProgressPage::initializePage()
{
	// Disable cancel button for this step
	QAbstractButton* cancel = wizard()->button(QWizard::CancelButton);
	if(cancel)
	{
		cancel->setEnabled(false);
	}

	// Creating searching tasklet
	ThreeDSSearchingTasklet* tasklet = new ThreeDSSearchingTasklet();
	((FileImporterWizard*)wizard())->setContext(tasklet);
	connect(tasklet, SIGNAL(ended(kint)), SLOT(ended(kint)));
	connect(tasklet, SIGNAL(progress(const QString&)), SLOT(progress(const QString&)));
	connect(tasklet, SIGNAL(progress(kuint64,kuint64)), SLOT(progress(kuint64,kuint64)));

	// Running searching tasklet
	_ended = Tasklet::NotStarted;
	tasklet->setFile(((FileImporterWizard*)wizard())->file());
	KoreEngine::RunTasklet(tasklet, TaskletRunner::Asynchronous);
	emit completeChanged();
}
Esempio n. 19
0
void LoadObjectsProgressPage::initializePage()
{
	// Disable cancel button for this step
	QAbstractButton* cancel = wizard()->button(QWizard::CancelButton);
	if(cancel)
	{
		cancel->setEnabled(false);
	}

	// Check if a searching tasklet is still created
	ThreeDSSearchingTasklet* searchingTasklet = (ThreeDSSearchingTasklet*)((FileImporterWizard*)wizard())->context();
	if(searchingTasklet)
	{
		// Check if we have some objects to import
		const QList<ThreeDSContext*> listObjects = searchingTasklet->objects();
		if(listObjects.size() > 0)
		{
			// Run import tasklet
			_ended = Tasklet::NotStarted;
			K_ASSERT( PantinEngine::ActiveManager()->rootInstance()->fastInherits<Project>() ) // It has to be a Project !
			_tasklet = new ThreeDSImportTasklet(((FileImporterWizard*)wizard())->file(), searchingTasklet);
			connect(_tasklet, SIGNAL(ended(kint)), SLOT(ended(kint)));
			connect(_tasklet, SIGNAL(progress(const QString&)), SLOT(progress(const QString&)));
			connect(_tasklet, SIGNAL(progress(kuint64,kuint64)), SLOT(progress(kuint64,kuint64)));
			KoreEngine::RunTasklet(_tasklet, TaskletRunner::Asynchronous);
		}
		else
		{
			_ended = Tasklet::Completed;
		}
	}
	else
	{
		_ended = Tasklet::Failed;
	}
	emit completeChanged();
}
Esempio n. 20
0
void DatabaseBox::doActivePopup(PlaylistTitle *item_ptr)
{
    if (active_popup)
        return;

    //  Popup for active playlist
    active_popup = new MythPopupBox(GetMythMainWindow(),
                                    "active_popup");
    active_pl_edit = new MythRemoteLineEdit(active_popup);
    active_popup->addWidget(active_pl_edit);
    active_pl_edit->setFocus();

    active_popup->addButton(tr("Copy To New Playlist"), this,
                            SLOT(copyNewPlaylist()));

    active_popup->addButton(tr("Clear the Active Play Queue"), this,
                            SLOT(clearActive()));

    QAbstractButton *pb = active_popup->addButton(tr("Save Back to Playlist Tree"),
                                          this, SLOT(popBackPlaylist()));

    // CD writing

    bool cdwriter = false;

    if (gCoreContext->GetNumSetting("CDWriterEnabled"))
    {
        QString scsidev = MediaMonitor::defaultCDWriter();
        if (!scsidev.isEmpty())
            cdwriter = true;
    }

    QAbstractButton *cdaudiob = NULL;
    QAbstractButton *cdmp3b = NULL;

    if (cdwriter)
    {
#if 0
        /*
         Disabled as Playlist::CreateCDAudio() is empty,
         it is called by CreateCDAudio()
        */
        cdaudiob = active_popup->addButton(tr("Create Audio CD from "
                                               "Playlist"), this,
                                               SLOT(CreateCDAudio()));
#endif

        cdmp3b = active_popup->addButton(tr("Create MP3 CD from Playlist"),
                                         this, SLOT(CreateCDMP3()));

        active_popup->addButton(tr("Clear CD-RW Disk"), this,
                                SLOT(BlankCDRW()));

        double size_in_MB = 0.0;
        double size_in_sec = 0.0;
        active_playlist->computeSize(size_in_MB, size_in_sec);

        int disksize = gCoreContext->GetNumSetting("CDDiskSize", 2);

        double max_size_in_MB;
        double max_size_in_min;

        if (disksize == 1)
        {
            max_size_in_MB = 650;
            max_size_in_min = 75;
        }
        else
        {
            max_size_in_MB = 700;
            max_size_in_min = 80;
        }

        double ratio_MB = 100.0 * size_in_MB / max_size_in_MB;
        double ratio_sec = 100.0 * size_in_sec / 60.0 / 1000.0 / max_size_in_min;

        QString label1;
        QString label2;

        label1.sprintf("Size: %dMB (%02d%%)", (int)(size_in_MB),
                       (int)(ratio_MB));
        label2.sprintf("Duration: %3dmin (%02d%%)",
                       (int)(size_in_sec / 60.0 / 1000.0), (int)(ratio_sec));

        active_popup->addLabel(label1);
        active_popup->addLabel(label2);

        cdmp3b->setEnabled((ratio_MB <= 100.0));

        if (cdaudiob)
        {
            cdaudiob->setEnabled((ratio_sec <= 100.0));
            cdaudiob->setEnabled(false);
        }
    }

    (void)item_ptr;

    active_pl_edit->setText("");

    active_popup->ShowPopup(this, SLOT(closeActivePopup()));

    if (gMusicData->all_playlists->pendingWriteback())
        pb->setEnabled(true);
    else
        pb->setEnabled(false);
}
Esempio n. 21
0
void Dialog::enableButton(ButtonCode button, bool enable) {
    QAbstractButton *b = getButton(button);
    if (b) {
        b->setEnabled(enable);
    }
}
void InstallProcessPage::prepareInstallation() {

    progressBarInstallation->setValue( 5 );
    listWidgetDosBoxProcessStatus->addItem( tr( "dboxfe: prepare installation ..." ) );

    // Make a application thread
    qApp->processEvents();

    // Get the wizard next-button
    QAbstractButton *buttonNext = GameWizard::instance()->button( QWizard::NextButton );

    if ( buttonNext ) {

        buttonNext->setEnabled( false );
    }

    progressBarInstallation->setValue( 10 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        get required fields" ) );

    // Get dosbox binary and setup settings
    dosBoxBinary = field( "dosBoxBinary" ).toString();
    installSetupFile = field( "installSetupFile" ).toString();
    installFolder = field( "installFolder" ).toString();

    progressBarInstallation->setValue( 15 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        open installation.conf" ) );

    // Get installation config
    QString m_installConf = ":/install_conf";

    QFile installConf( m_installConf );

    // Open installation config
    if ( !installConf.open( QFile::ReadOnly | QFile::Text ) ) {
        QMessageBox::information( 0, tr( "Game Wizard" ), tr( "Can not read " ) + installConf.fileName() );
        return;
    }

    // Read installation config
    QTextStream installTextStream( &installConf );
    QString m_conf = installTextStream.readAll();

    QString keyboardLayout = QLocale::languageToString( QLocale::system().language() );
    if( keyboardLayout == "German" ) {
        keyboardLayout = "GR";

    } else {
        keyboardLayout = "none";
    }

    progressBarInstallation->setValue( 20 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        replace installation.conf variables" ) );

    QFileInfo dvdDirectory( installSetupFile );

    m_conf.replace( "$(KEYBOARD_LAYOUT)", keyboardLayout );
    m_conf.replace( "$(DVD_CD_DIRECTORY)", dvdDirectory.absolutePath() );
    m_conf.replace( "$(INSTALLATION_DIRECTORY)", installFolder );
    m_conf.replace( "$(SETUP_EXECUTABLE)", dvdDirectory.fileName() );

    progressBarInstallation->setValue( 25 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        close installation.conf" ) );
    // Close install config
    installConf.flush();
    installConf.close();

    progressBarInstallation->setValue( 30 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        create required directories" ) );

    // Set real installation config for save on hard disc
    m_installConf = "";
    m_installConf = QDir::homePath();
    m_installConf.append( "/.dboxfe" );

    // create profile directory if this not exists
    QDir profileDir( m_installConf );

    if ( !profileDir.exists() ) {
        profileDir.mkpath( m_installConf );
    }

    progressBarInstallation->setValue( 40 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        open installation.conf again" ) );

    // Append the installation config file
    m_installConf.append( "/installation.conf" );

    QFile realInstallConf( m_installConf );

    // Open real installation config
    if ( !realInstallConf.open( QFile::WriteOnly | QFile::Text ) ) {
        QMessageBox::information( 0, tr( "Game Wizard" ), tr( "Can not read " ) + realInstallConf.fileName() );
        progressBarInstallation->setValue( 0 );
        listWidgetDosBoxProcessStatus->addItem( tr( "       ERROR - Can not read %1" ).arg( realInstallConf.fileName() ) );
        return;
    }

    // Read real installation config
    QTextStream realInstallTextStream( &realInstallConf );

    realInstallTextStream << m_conf;

    progressBarInstallation->setValue( 45 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        save installation.conf" ) );

    // Close and write real install config
    realInstallTextStream.flush();
    installConf.flush();
    installConf.close();

    progressBarInstallation->setValue( 50 );
    listWidgetDosBoxProcessStatus->addItem( tr( "        finish" ) );
    listWidgetDosBoxProcessStatus->addItem( tr( "" ) );

    progressBarInstallation->setValue( 55 );
    listWidgetDosBoxProcessStatus->addItem( tr( "dboxfe: begin installation ..." ) );

    install( dosBoxBinary, "-conf", """" + realInstallConf.fileName() + """", buttonNext );
}
Esempio n. 23
0
SlideShow::SlideShow(QWidget *parent)
    : QWidget(parent)
    , imageViewer(0)
    , playlist(0)
    , statusLabel(0)
    , countdownLabel(0)
    , playButton(0)
    , stopButton(0)
    , viewerLayout(0)
{
    imageViewer = new QMediaImageViewer(this);

    connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)),
            this, SLOT(stateChanged(QMediaImageViewer::State)));
    connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
            this, SLOT(statusChanged(QMediaImageViewer::MediaStatus)));
    connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int)));

    playlist = new QMediaPlaylist;
    imageViewer->bind(playlist);

    connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded()));
    connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed()));

    connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded()));
    connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed()));

    QVideoWidget *videoWidget = new QVideoWidget;
    imageViewer->bind(videoWidget);

    statusLabel = new QLabel(tr("%1 Images").arg(0));
    statusLabel->setAlignment(Qt::AlignCenter);

    viewerLayout = new QStackedLayout;
    viewerLayout->setStackingMode(QStackedLayout::StackAll);
    viewerLayout->addWidget(videoWidget);
    viewerLayout->addWidget(statusLabel);

    statusLabel = new QLabel(tr("%1 Images").arg(0));
    statusLabel->setAlignment(Qt::AlignCenter);

    viewerLayout = new QStackedLayout;
    viewerLayout->setStackingMode(QStackedLayout::StackAll);
    viewerLayout->addWidget(videoWidget);
    viewerLayout->addWidget(statusLabel);

    QMenu *openMenu = new QMenu(this);
    openMenu->addAction(tr("Directory..."), this, SLOT(openDirectory()));
    openMenu->addAction(tr("Playlist..."), this, SLOT(openPlaylist()));

    QToolButton *openButton = new QToolButton;
    openButton->setIcon(style()->standardIcon(QStyle::SP_DialogOpenButton));
    openButton->setMenu(openMenu);
    openButton->setPopupMode(QToolButton::InstantPopup);

    playButton = new QToolButton;
    playButton->setIcon(style()->standardIcon(QStyle::SP_MediaPlay));
    playButton->setEnabled(false);

    connect(playButton, SIGNAL(clicked()), this, SLOT(play()));
    connect(this, SIGNAL(enableButtons(bool)), playButton, SLOT(setEnabled(bool)));

    stopButton = new QToolButton;
    stopButton->setIcon(style()->standardIcon(QStyle::SP_MediaStop));
    stopButton->setEnabled(false);

    connect(stopButton, SIGNAL(clicked()), imageViewer, SLOT(stop()));

    QAbstractButton *nextButton = new QToolButton;
    nextButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipForward));
    nextButton->setEnabled(false);

    connect(nextButton, SIGNAL(clicked()), playlist, SLOT(next()));
    connect(this, SIGNAL(enableButtons(bool)), nextButton, SLOT(setEnabled(bool)));

    QAbstractButton *previousButton = new QToolButton;
    previousButton->setIcon(style()->standardIcon(QStyle::SP_MediaSkipBackward));
    previousButton->setEnabled(false);

    connect(previousButton, SIGNAL(clicked()), playlist, SLOT(previous()));
    connect(this, SIGNAL(enableButtons(bool)), previousButton, SLOT(setEnabled(bool)));

    countdownLabel = new QLabel;

    QBoxLayout *controlLayout = new QHBoxLayout;
    controlLayout->setMargin(0);
    controlLayout->addWidget(openButton);
    controlLayout->addStretch(1);
    controlLayout->addWidget(previousButton);
    controlLayout->addWidget(stopButton);
    controlLayout->addWidget(playButton);
    controlLayout->addWidget(nextButton);
    controlLayout->addStretch(1);
    controlLayout->addWidget(countdownLabel);

    QBoxLayout *layout = new QVBoxLayout;
    layout->addLayout(viewerLayout);
    layout->addLayout(controlLayout);

    setLayout(layout);

}