Пример #1
0
void MythWizard::showPage( QWidget * page )
{
    MythWizardPrivate::Page * p = d->page( page );
    if ( p ) {
        int i;
        for( i = 0; i < d->pages.size() && d->pages[i] != p; i++ );
        bool notFirst( false );

        if (i)
        {
            i--;
            while ((i >= 0) && !notFirst)
            {
                notFirst |= appropriate(d->pages[i]->w);
                i--;
            }
        }
        setBackEnabled( notFirst );
        setNextEnabled( true );
        d->ws->setCurrentWidget(page);
        d->current = p;
    }

    layOut();
    updateButtons();
    emit selected( p ? p->t : QString() );

    if (indexOf(page) == pageCount()-1) {
        // last page
        finishButton()->setEnabled(true);
        finishButton()->setFocus();
    } else {
        nextButton()->setFocus();
    }
}
Пример #2
0
void Wizard::showPage( QWidget* page )
{
    if ( page == page1 ) {
    } else if ( page == page2 ) {
    } else if ( page == page3 ) {
        lKey->setText( key->text() );
        lFirstName->setText( firstName->text() );
        lLastName->setText( lastName->text() );
        lAddress->setText( address->text() );
        lPhone->setText( phone->text() );
        lEmail->setText( email->text() );
    }

    QWizard::showPage(page);

    if ( page == page1 ) {
        keyChanged( key->text() );
        key->setFocus();
    } else if ( page == page2 ) {
        dataChanged( firstName->text() );
        firstName->setFocus();
    } else if ( page == page3 ) {
        finishButton()->setEnabled( TRUE );
        finishButton()->setFocus();
    }
}
Пример #3
0
iqrCRWimpl::iqrCRWimpl(QString _qstrSubject, QString _qstrCoutSumm, QWidget*, const char*):
    qstrSubject(_qstrSubject), qstrCoutSumm(_qstrCoutSumm) {

    
    setFinishEnabled( WizardPage_3, TRUE );
    connect( finishButton() , SIGNAL(clicked()), SLOT(sendReport()) );
    connect( cancelButton() , SIGNAL(clicked()), qApp, SLOT(quit()) );
    finishButton()->setText("&Send");

}
Пример #4
0
StudyMoveCopyWizard::StudyMoveCopyWizard(const QString& action, QWidget* parent, 
	const char* name) : StudyMoveCopyWizardBase(parent, name), catalog_(0) {
    connect(sourceLineEdit, SIGNAL(textChanged(const QString&)),
        this, SLOT(enableFinishButton()));
    connect(destinationLineEdit, SIGNAL(textChanged(const QString&)),
	this, SLOT(enableFinishButton()));
    connect(studiesListBox, SIGNAL(highlighted(int)),
	this, SLOT(enableFinishButton()));
    connect(selectAllButton, SIGNAL(clicked()),
        this, SLOT(enableFinishButton()));
    connect(browseSourceButton, SIGNAL(clicked()),
        this, SLOT(enableFinishButton()));
    connect(browseDestinationButton, SIGNAL(clicked()),
        this, SLOT(enableFinishButton()));

    QString upperCase = action;
    upperCase[0] = action[0].upper();
    setCaption(tr("Study %1 Wizard").arg(upperCase));
    instructionsLabel->setText(instructionsLabel->text().arg(action).arg(action));
    destinationLabel->setText(destinationLabel->text().arg(upperCase));    
    finishButton()->setText(upperCase);
    setHelpEnabled(page(0), false);
    setHelpEnabled(page(1), false);
    studiesListBox->clear();
}
Пример #5
0
void KviRemoteMircServerImportWizard::getListTerminated(bool bSuccess)
{
	if(!m_pRequest)return;
	if(bSuccess)
	{
		m_pOutput->setText(__tr2qs("File downloaded: processing ..."));
		m_pOutput->repaint();

		int iCount = m_pFilter->doImport(m_szTmpFileName);

		QString tmp;
		if(iCount > 0)
			tmp = __tr2qs("%1 servers imported successfully").arg(iCount);
		else
			tmp = __tr2qs("No servers imported");
		m_pOutput->setText(tmp);

		QDir d;
		d.remove(m_szTmpFileName);
	} else m_pOutput->setText(m_pRequest->lastError());

	delete m_pRequest;
	m_pRequest = 0;
	cancelButton()->setEnabled(false);
	finishButton()->setEnabled(true);
}
Пример #6
0
KWizard::KWizard( QWidget *parent, const char *name, bool modal, WFlags f )
            : QWizard( parent, name, modal, f )
{
  bool useIcons = KGlobalSettings::showIconsOnPushButtons();

  if ( useIcons )
  {
    KGuiItem back = KStdGuiItem::back( KStdGuiItem::UseRTL );
    KGuiItem forward = KStdGuiItem::forward( KStdGuiItem::UseRTL );

    backButton()->setIconSet( back.iconSet() );
    nextButton()->setIconSet( forward.iconSet() );

    finishButton()->setIconSet( SmallIconSet( "apply" ) );
    cancelButton()->setIconSet( SmallIconSet( "button_cancel" ) );
    helpButton()->setIconSet( SmallIconSet( "help" ) );

    backButton()->setText( i18n( "&Back" ) );
    nextButton()->setText( i18n( "Opposite to Back","&Next" ) );
  }

  QFont font = titleFont();
  font.setBold( true );
  setTitleFont( font );
}
Пример #7
0
K3Wizard::K3Wizard( QWidget *parent, const char *name, bool modal, Qt::WFlags f )
            : Q3Wizard( parent, name, modal, f )
{
  bool useIcons = KGlobalSettings::showIconsOnPushButtons();

  if ( useIcons )
  {
    KGuiItem back = KStandardGuiItem::back( KStandardGuiItem::UseRTL );
    KGuiItem forward = KStandardGuiItem::forward( KStandardGuiItem::UseRTL );

    backButton()->setIcon( back.icon() );
    nextButton()->setIcon( forward.icon() );

    finishButton()->setIcon( KIcon( "dialog-ok-apply" ) );
    cancelButton()->setIcon( KIcon( "dialog-cancel" ) );
    helpButton()->setIcon( KIcon( "help-contents" ) );

    backButton()->setText( i18n( "&Back" ) );
    nextButton()->setText( i18nc( "Opposite to Back","&Next" ) );
  }

  QFont font = titleFont();
  font.setBold( true );
  setTitleFont( font );
}
void ReportAssistantDialog::currentPageChanged_slot(KPageWidgetItem * current , KPageWidgetItem * before)
{
    //Page changed
    buttonBox()->button(QDialogButtonBox::Cancel)->setEnabled(true);
    m_canClose = false;

    //Save data of the previous page
    if (before) {
        ReportAssistantPage* beforePage = dynamic_cast<ReportAssistantPage*>(before->widget());
        beforePage->aboutToHide();
    }

    //Load data of the current(new) page
    if (current) {
        ReportAssistantPage* currentPage = dynamic_cast<ReportAssistantPage*>(current->widget());
        nextButton()->setEnabled(currentPage->isComplete());
        currentPage->aboutToShow();
    }

    //If the current page is the last one, disable all the buttons until the bug is sent
    if (current->name() == QLatin1String(PAGE_BZSEND_ID)) {
        nextButton()->setEnabled(false);
        backButton()->setEnabled(false);
        finishButton()->setEnabled(false);
    }
}
Пример #9
0
void KPersonalizer::next() {
	if(currentPage()==countrypage) {
		// only restart kp, if the new language is different from the one selected in main.cpp
		// and none of the later pages is dirty
		if ( (countrypage->b_startedLanguageChanged) && !(os_dirty || eye_dirty || style_dirty) ) {
			if ( countrypage->save(countrypage->cb_country, countrypage->cb_language) )
				delayedRestart();
		} else {
			(void)countrypage->save(countrypage->cb_country, countrypage->cb_language);
			QWizard::next();
		}
	}
	else if(currentPage()==ospage){
		os_dirty=true;  // set the dirty flag, changes done that need reverting
		ospage->save();
		QWizard::next();
	}
	else if(currentPage()==eyecandy){
		eye_dirty=true;  // set the dirty flag, changes done that need reverting
		eyecandy->save();
		QTimer::singleShot(0, this, SLOT(slotNext()));
	}
	else if(currentPage()==stylepage){
		style_dirty=true;  // set the dirty flag, changes done that need reverting
		stylepage->save();
		QWizard::next();
	}
	if(currentPage()==refinepage) {
		finishButton()->setFocus();
	}
}
KLFirstDialog::KLFirstDialog(QWidget *parent, const char *name)
	: KWizard(parent, name)
{
	m_welcome = new FDWelcome(this);
	addPage(m_welcome, i18n("Welcome !"));
	
	m_initdb = new FDInitDatabase(this);
	addPage(m_initdb, i18n("Setup database"));
	connect(m_initdb, SIGNAL(enableNext(QWidget*, bool )), this, SLOT(setNextEnabled(QWidget*, bool )));
	connect(m_initdb, SIGNAL(gotoFinish()), this, SLOT(showFinish()));
	
	m_enterprise = new FDSetupEnterprise(this);
	addPage(m_enterprise, i18n("Setup Enterprise"));
	
	m_setupAdmin = new FDSetupAdmin(this);
	addPage(m_setupAdmin, i18n("Setup admin user"));
	
	m_finish = new FDWelcome(this);
	m_finish->setMessage(i18n("<h3><b>Congratulations!</b></h3><br>" +
			i18n("You has configure the system, you can become to use it!")
			       ));
	addPage(m_finish, i18n("All is good!"));
	setFinishEnabled(m_finish, true);
	
	connect( finishButton(), SIGNAL(clicked()), this, SLOT(finished()));
	connect( cancelButton(), SIGNAL(clicked()), this, SLOT(cancel()));
}
Пример #11
0
void ConnectionWizard::setState(bool patch, bool end, bool back, bool next, bool finish)
{
	setAppropriate(pagePatch, patch ? true : false);
	setAppropriate(pageEnd, end ? true : false);
	
	backButton()->setEnabled(back ? true : false);
	nextButton()->setEnabled(next ? true : false);
	finishButton()->setEnabled(finish ? true : false);
}
Пример #12
0
void ReportAssistantDialog::assistantFinished(bool showBack)
{
    //The assistant finished: allow the user to close the dialog normally

    nextButton()->setEnabled(false);
    backButton()->setEnabled(showBack);
    finishButton()->setEnabled(true);
    buttonBox()->button(QDialogButtonBox::Cancel)->setEnabled(false);

    m_canClose = true;
}
Пример #13
0
void KexiCSVExportWizard::next()
{
    if (currentPage() == m_fileSavePage) {
        if (!m_fileSavePage->checkSelectedFile())
            return;
        K3Wizard::next();
        finishButton()->setFocus();
        return;
    }
    K3Wizard::next();
}
Пример #14
0
void KviRemoteMircServerImportWizard::start()
{
	QString url = m_pUrlEdit->text();
	if(url.isEmpty())url = KVI_WWWMIRCCOUK_SERVERSINI;

	finishButton()->setEnabled(false);
	if(m_pRequest)delete m_pRequest;

	m_pRequest = new KviHttpRequest();
	connect(m_pRequest,SIGNAL(terminated(bool)),this,SLOT(getListTerminated(bool)));
	connect(m_pRequest,SIGNAL(status(const QString &)),this,SLOT(getListMessage(const QString &)));

	g_pApp->getTmpFileName(m_szTmpFileName,"servers.ini");
	if(!m_pRequest->get(KviUrl(url),KviHttpRequest::StoreToFile,m_szTmpFileName))
	{
		delete m_pRequest;
		m_pRequest = 0;
		m_pOutput->setText(__tr2qs("Failed to start the server list transfer :("));
		finishButton()->setEnabled(true);
	}
}
Пример #15
0
KPrWebPresentationWizard::KPrWebPresentationWizard( const QString &_config, KPrDocument *_doc,
                                                  KPrView *_view )
    : KWizard( 0, "", false ), config( _config ), webPres( config, _doc, _view )
{
    doc = _doc;
    view = _view;

    setupPage1();
    setupPage2();
    setupPage3();
    setupPage4();
    setupPage5();

    connect( nextButton(), SIGNAL( clicked() ), this, SLOT( pageChanged() ) );
    connect( backButton(), SIGNAL( clicked() ), this, SLOT( pageChanged() ) );
    connect( finishButton(), SIGNAL( clicked() ), this, SLOT( finish() ) );
}
Пример #16
0
KSWizard::KSWizard(QWidget *parent, const char *name)
    :KSWizardWzt(parent, name)
{
  m_mouseNavigation->setChecked(Configuration::mouseNavigation());
  m_scrollBar->setChecked(Configuration::scrollBar());
  m_smoothScroll->setChecked(Configuration::smoothScroll());
//  m_authorName->setText(Configuration::authorName());
//  m_authorEmail->setText(Configuration::authorEmail());

  locateLocal("appdata", "");
  m_downloadProgress->setShown(false);
  m_downloadLabel->setShown(false);
  setFinishEnabled(finish, true);
  connect(finishButton(), SIGNAL(pressed()), this, SLOT(slotFinish()));
  if(QFile::exists(locateLocal("appdata", "languages.ldft", false)))
  {
    languages->setDisabled(true);
    m_remoteLanguages->setChecked(false);
  }
}
Пример #17
0
void NewProtocol::pageChanged(const QString&)
{
    if (currentPage() == m_connectWnd){
        emit apply();
        m_bConnect = true;
        unsigned status = CorePlugin::m_plugin->getManualStatus();
        if (status == STATUS_OFFLINE)
            status = STATUS_ONLINE;
        m_client->setStatus(status, false);
        m_connectWnd->setConnecting(true);
        setBackEnabled(m_connectWnd, false);
        setNextEnabled(currentPage(), false);
        setFinishEnabled(m_connectWnd, false);
    }
    if (m_last && (currentPage() == m_last)){
        setFinishEnabled(m_connectWnd, false);
        cancelButton()->show();
        backButton()->show();
        finishButton()->hide();
        showPage(protocolPage);
        protocolChanged(0);
    }
}
Пример #18
0
void KPrWebPresentationWizard::pageChanged()
{
    if ( currentPage() != page5 )
    {
        QString pathname = path->lineEdit()->text();

        // path doesn't exist. ask user if it should be created.
        if ( !KIO::NetAccess::exists( pathname, true/*write*/,this ) )
        {
            QString msg = i18n( "<qt>The directory <b>%1</b> does not exist.<br>"
                                "Do you want create it?</qt>" );
            if( KMessageBox::questionYesNo( this, msg.arg( pathname ),
                                            i18n( "Directory Not Found" ) )
                == KMessageBox::Yes)
            {
                bool ok = KIO::NetAccess::mkdir( pathname, this );
                if( !ok )
                {
                    KMessageBox::sorry( this,
                                        i18n( "Cannot create directory." ) );
                    // go back to first step
                    showPage( page1 );
                    path->setFocus();
                }

            }
            else
            {
                // go back to first step
                showPage( page1 );
                path->setFocus();
            }
        }
    } else
        finishButton()->setEnabled( true );
}
Пример #19
0
KexiCSVExportWizard::KexiCSVExportWizard(const KexiCSVExport::Options& options,
        QWidget * parent)
        : K3Wizard(parent)
        , m_options(options)
// , m_mode(mode)
// , m_itemId(itemId)
        , m_fileSavePage(0)
        , m_defaultsBtn(0)
        , m_importExportGroup(KGlobal::config()->group("ImportExport"))
        , m_rowCount(-1)
        , m_rowCountDetermined(false)
        , m_cancelled(false)
{
    if (m_options.mode == KexiCSVExport::Clipboard) {
        finishButton()->setText(i18n("Copy"));
        backButton()->hide();
    } else {
        finishButton()->setText(i18n("Export"));
    }
    helpButton()->hide();

    QString infoLblFromText;
    KexiGUIMessageHandler msgh(this);
    m_tableOrQuery = new KexiDB::TableOrQuerySchema(
        KexiMainWindowIface::global()->project()->dbConnection(), m_options.itemId);
    if (m_tableOrQuery->table()) {
        if (m_options.mode == KexiCSVExport::Clipboard) {
            setWindowTitle(i18n("Copy Data From Table to Clipboard"));
            infoLblFromText = i18n("Copying data from table:");
        } else {
            setWindowTitle(i18n("Export Data From Table to CSV File"));
            infoLblFromText = i18n("Exporting data from table:");
        }
    } else if (m_tableOrQuery->query()) {
        if (m_options.mode == KexiCSVExport::Clipboard) {
            setWindowTitle(i18n("Copy Data From Query to Clipboard"));
            infoLblFromText = i18n("Copying data from table:");
        } else {
            setWindowTitle(i18n("Export Data From Query to CSV File"));
            infoLblFromText = i18n("Exporting data from query:");
        }
    } else {
        msgh.showErrorMessage(KexiMainWindowIface::global()->project()->dbConnection(),
                              i18n("Could not open data for exporting."));
        m_cancelled = true;
        return;
    }
    // OK, source data found.

    // Setup pages

    // 1. File Save Page
    if (m_options.mode == KexiCSVExport::File) {
        m_fileSavePage = new KexiStartupFileWidget(
            KUrl("kfiledialog:///CSVImportExport"), //startDir
            KexiStartupFileWidget::Custom | KexiStartupFileWidget::SavingFileBasedDB,
            this);
        m_fileSavePage->setObjectName("m_fileSavePage");
        m_fileSavePage->setMinimumHeight(kapp->desktop()->availableGeometry().height() / 2);
        m_fileSavePage->setAdditionalFilters(csvMimeTypes().toSet());
        m_fileSavePage->setDefaultExtension("csv");
        m_fileSavePage->setLocationText(
            KexiUtils::stringToFileName(m_tableOrQuery->captionOrName()));
        connect(m_fileSavePage, SIGNAL(rejected()), this, SLOT(reject()));
        addPage(m_fileSavePage, i18n("Enter Name of File You Want to Save Data To"));
    }

    // 2. Export options
    m_exportOptionsPage = new QWidget(this);
    m_exportOptionsPage->setObjectName("m_exportOptionsPage");
    QGridLayout *exportOptionsLyr = new QGridLayout(m_exportOptionsPage);
    exportOptionsLyr->setObjectName("exportOptionsLyr");
    m_infoLblFrom = new KexiCSVInfoLabel(infoLblFromText, m_exportOptionsPage);
    KexiPart::Info *partInfo = Kexi::partManager().infoForClass(
            QString("org.kexi-project.%1").arg(m_tableOrQuery->table() ? "table" : "query"));
    if (partInfo)
        m_infoLblFrom->setIcon(partInfo->itemIcon());
    m_infoLblFrom->separator()->hide();
    exportOptionsLyr->addWidget(m_infoLblFrom, 0, 0, 0, 2);

    m_infoLblTo = new KexiCSVInfoLabel(
        (m_options.mode == KexiCSVExport::File) ? i18n("To CSV file:") : i18n("To clipboard:"),
        m_exportOptionsPage
    );
    if (m_options.mode == KexiCSVExport::Clipboard)
        m_infoLblTo->setIcon("edit-paste");
    exportOptionsLyr->addWidget(m_infoLblTo, 1, 0, 1, 3);

    m_showOptionsButton = new KPushButton(KGuiItem(i18n("Show Options >>"), "configure"),
                                          m_exportOptionsPage);
    connect(m_showOptionsButton, SIGNAL(clicked()), this, SLOT(slotShowOptionsButtonClicked()));
    exportOptionsLyr->addWidget(m_showOptionsButton, 2, 2, 0, 0);
    m_showOptionsButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);

    // -<options section>
    m_exportOptionsSection = new Q3GroupBox(1, Qt::Vertical, i18n("Options"), m_exportOptionsPage);
    m_exportOptionsSection->setObjectName("m_exportOptionsSection");
    m_exportOptionsSection->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    exportOptionsLyr->addWidget(m_exportOptionsSection, 3, 3, 0, 1);
    QWidget *exportOptionsSectionWidget
    = new QWidget(m_exportOptionsSection);
    exportOptionsSectionWidget->setObjectName("exportOptionsSectionWidget");
    QGridLayout *exportOptionsSectionLyr = new QGridLayout(exportOptionsSectionWidget);
    exportOptionsLyr->setObjectName("exportOptionsLyr");

    // -delimiter
    m_delimiterWidget = new KexiCSVDelimiterWidget(false, //!lineEditOnBottom
            exportOptionsSectionWidget);
    m_delimiterWidget->setDelimiter(defaultDelimiter());
    exportOptionsSectionLyr->addWidget(m_delimiterWidget, 0, 1);
    QLabel *delimiterLabel = new QLabel(i18n("Delimiter:"), exportOptionsSectionWidget);
    delimiterLabel->setBuddy(m_delimiterWidget);
    exportOptionsSectionLyr->addWidget(delimiterLabel, 0, 0);

    // -text quote
    QWidget *textQuoteWidget = new QWidget(exportOptionsSectionWidget);
    QHBoxLayout *textQuoteLyr = new QHBoxLayout(textQuoteWidget);
    exportOptionsSectionLyr->addWidget(textQuoteWidget, 1, 1);
    m_textQuote = new KexiCSVTextQuoteComboBox(textQuoteWidget);
    m_textQuote->setTextQuote(defaultTextQuote());
    textQuoteLyr->addWidget(m_textQuote);
    textQuoteLyr->addStretch(0);
    QLabel *textQuoteLabel = new QLabel(i18n("Text quote:"), exportOptionsSectionWidget);
    textQuoteLabel->setBuddy(m_textQuote);
    exportOptionsSectionLyr->addWidget(textQuoteLabel, 1, 0);

    // - character encoding
    m_characterEncodingCombo = new KexiCharacterEncodingComboBox(exportOptionsSectionWidget);
    m_characterEncodingCombo->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    exportOptionsSectionLyr->addWidget(m_characterEncodingCombo, 2, 1);
    QLabel *characterEncodingLabel = new QLabel(i18n("Text encoding:"), exportOptionsSectionWidget);
    characterEncodingLabel->setBuddy(m_characterEncodingCombo);
    exportOptionsSectionLyr->addWidget(characterEncodingLabel, 2, 0);

    // - checkboxes
    m_addColumnNamesCheckBox = new QCheckBox(i18n("Add column names as the first row"),
            exportOptionsSectionWidget);
    m_addColumnNamesCheckBox->setChecked(true);
    exportOptionsSectionLyr->addWidget(m_addColumnNamesCheckBox, 3, 1);
//! @todo 1.1: for copying use "Always use above options for copying" string
    m_alwaysUseCheckBox = new QCheckBox(i18n("Always use above options for exporting"),
                                        m_exportOptionsPage);
    exportOptionsLyr->addWidget(m_alwaysUseCheckBox, 4, 4, 0, 1);
// exportOptionsSectionLyr->addWidget( m_alwaysUseCheckBox, 4, 1 );
    m_exportOptionsSection->hide();
    m_alwaysUseCheckBox->hide();
    // -</options section>

// exportOptionsLyr->setColumnStretch(3, 1);
    exportOptionsLyr->addItem(
        new QSpacerItem(0, 0, QSizePolicy::Preferred, QSizePolicy::MinimumExpanding), 5, 0, 1, 2);

// addPage(m_exportOptionsPage, i18n("Set Export Options"));
    addPage(m_exportOptionsPage,
            m_options.mode == KexiCSVExport::Clipboard ? i18n("Copying") : i18n("Exporting"));
    setFinishEnabled(m_exportOptionsPage, true);

    // load settings
    if (m_options.mode != KexiCSVExport::Clipboard
            && readBoolEntry("ShowOptionsInCSVExportDialog", false)) {
        show();
        slotShowOptionsButtonClicked();
    }
    if (readBoolEntry("StoreOptionsForCSVExportDialog", false)) {
        // load defaults:
        m_alwaysUseCheckBox->setChecked(true);
        QString s = readEntry("DefaultDelimiterForExportingCSVFiles", defaultDelimiter());
        if (!s.isEmpty())
            m_delimiterWidget->setDelimiter(s);
        s = readEntry("DefaultTextQuoteForExportingCSVFiles", defaultTextQuote());
        m_textQuote->setTextQuote(s); //will be invaliudated here, so not a problem
        s = readEntry("DefaultEncodingForExportingCSVFiles");
        if (!s.isEmpty())
            m_characterEncodingCombo->setSelectedEncoding(s);
        m_addColumnNamesCheckBox->setChecked(
            readBoolEntry("AddColumnNamesForExportingCSVFiles", true));
    }

    updateGeometry();

    // -keep widths equal on page #2:
    int width = qMax(m_infoLblFrom->leftLabel()->sizeHint().width(),
                     m_infoLblTo->leftLabel()->sizeHint().width());
    m_infoLblFrom->leftLabel()->setFixedWidth(width);
    m_infoLblTo->leftLabel()->setFixedWidth(width);
}
Пример #20
0
ConnectionWizard::ConnectionWizard(bool o, StrGlobal *g, RouteInfo *r)
	: ConnectionWizardBase()
{
	out = o;
	global = g;
	route = *r;
	rptr = r;
	
	rtype = None;
	pto = NULL;
	
	RSItemIO *io = r->getToIO();
	
	if (io)
	{
		RSItemBaseWithType *owner = (RSItemBaseWithType *)io->getOwner();
		switch (owner->type())
		{
			case RSItemBaseWithType::In:
				rtype = In;
				break;
			case RSItemBaseWithType::Out:
				rtype = Out;
				break;
			case RSItemBaseWithType::FX:
				rtype = FX;
				break;
			case RSItemBaseWithType::Patch:
				if (io->isOutput())
					rtype = POut;
				else
					rtype = PIn;
				pto = (StrPatch *)owner;
				break;
			default:
				break;
		}
	}

	if (!out)
	{
		rbOutput->hide();
	}
	else
	{
		rbFX->hide();
		rbInput->hide();
	}
	
	StrPatch *patch;
	
	lbPatch->clear();
	for(patch = global->Patches.first(); patch; patch = global->Patches.next() )
	{
		lbPatch->insertItem(patch->name());
		patchList.append(patch);
	}
	
	connect(rbNone, SIGNAL(clicked()), this, SLOT(noneClicked()));
	connect(rbFX, SIGNAL(clicked()), this, SLOT(fxClicked()));
	connect(rbInput, SIGNAL(clicked()), this, SLOT(inClicked()));
	connect(rbOutput, SIGNAL(clicked()), this, SLOT(outClicked()));
	connect(rbPatch, SIGNAL(clicked()), this, SLOT(patchClicked()));
	
	connect(lbPatch, SIGNAL(clicked(QListBoxItem *)), this, SLOT(patchListClicked(QListBoxItem *)));
	connect(lbEnd, SIGNAL(clicked(QListBoxItem *)), this, SLOT(endListClicked(QListBoxItem *)));
	
	connect(finishButton(), SIGNAL(clicked()), this, SLOT(finishClicked()));
	
	connect(this, SIGNAL(selected(const QString &)), this, SLOT(selected(const QString &)));
	helpButton()->hide();
	
	setFinishEnabled(pageType, true);
	setNextEnabled(pageType, true);
	setFinishEnabled(pagePatch, true);
	setNextEnabled(pagePatch, true);
	setFinishEnabled(pageEnd, true);
	setNextEnabled(pageEnd, true);
}
Пример #21
0
void ConnectionWizard::selected(const QString &page)
{
	if (page == "Connection target")
	{
		switch (rtype)
		{
			case None:
				rbNone->setChecked(true);
				setState(false, false, false, false, true);
				break;
			case FX:
				rbFX->setChecked(true);
				setState(false, true, false, true, false);
				break;
			case In:
				rbInput->setChecked(true);
				setState(false, true, false, true, false);
				break;
			case Out:
				rbOutput->setChecked(true);
				setState(false, true, false, true, false);
				break;
			case PIn:
			case POut:
				rbPatch->setChecked(true);
				setState(true, true, false, true, false);
				break;
		}
	}
	else if (page == "Patch")
	{
		finishButton()->setEnabled(false);
		if (pto)
		{
			// find patch
			lbPatch->setCurrentItem(patchList.find(pto));
			nextButton()->setEnabled(true);
		}
		else
		{
			QListBoxItem *si = lbPatch->selectedItem();
			if (si)
				lbPatch->setSelected(si, false);
			lbPatch->setCurrentItem(-1);
			nextButton()->setEnabled(false);
		}

		cbMulti->setChecked(route.getMulti());
		cbSimple->setChecked(route.getSimple());
	}
	else if (page == "End")
	{
		nextButton()->setEnabled(false);
		switch (rtype)
		{
			case None:
				break;
			case FX:
			case In:
			case Out:
				loadEnd(rtype);
				break;
			case PIn:
			case POut:
				// load patch in or out
				ios.clear();
				lbEnd->clear();

				for (int i = 0; i < (int)pto->getMaxIOIdx(out); i++)
				{
					RSItemIO *io = pto->getIO(out, i);
					if (io)
					{
						ios.append(io);
						lbEnd->insertItem(io->getDesc());
					}
				}
				
				route.setMulti(cbMulti->isChecked());
				route.setSimple(cbSimple->isChecked());
				break;
		}

		if (route.getToIO())
		{
			lbEnd->setCurrentItem(ios.find(route.getToIO()));
			finishButton()->setEnabled(true);
		}
		else
		{
			QListBoxItem *si = lbEnd->selectedItem();
			if (si)
				lbEnd->setSelected(si, false);
			lbEnd->setCurrentItem(-1);
			finishButton()->setEnabled(false);
		}
	}
}
Пример #22
0
void ConnectionWizard::endListClicked(QListBoxItem *item)
{
	route.setToIO(ios.at(lbEnd->index(item)));
	finishButton()->setEnabled(true);
}