Пример #1
0
//
// Get selected channels from channel list view and set them
// to the slider's channel list. Used for both level & submaster modes.
//
void VCDockSliderProperties::extractChannels()
{
  QCheckListItem* item = NULL;
  t_channel ch = 0;
  
  //
  // Clear channel list
  //
  m_slider->channels()->clear();
  
  //
  // Then, add the new submaster channels
  //
  QListViewItemIterator it(m_channelList);
  while (it.current())
    {
      item = static_cast<QCheckListItem*> (it.current());
      
      ch = static_cast<t_channel> 
	(item->text(KColumnDMXChannel).toInt() - 1);
      
      if (item->isOn() && 
	  m_slider->channels()->find(ch) == m_slider->channels()->end())
	{
	  m_slider->channels()->append(ch);
	}
      
      ++it;
    }
}
Пример #2
0
QStringList CheckedListView::checked() const
{
    QStringList strs;
    for ( QCheckListItem *i = (QCheckListItem *) firstChild();
	  i; i = (QCheckListItem *)i->nextSibling() )
	if ( i->isOn() )
	    strs += i->text( 0 );
    return strs;
}
Пример #3
0
void EvaQunMemberPicker::slotClicked(QListViewItem *item)
{
	if(!item) return;
	QCheckListItem *chkItem = dynamic_cast<QCheckListItem *>(item);
	if(!chkItem) return;
	unsigned int id;
	QString txt;
	QString strID;
	bool ok;
	QString nick;
	QPixmap face;
	
	QCheckListItem *child = dynamic_cast<QCheckListItem *>(chkItem->firstChild());
	if(!child){
		txt = chkItem->text(0);
		int index = txt.findRev("(");
		nick = txt.left( index );
		strID = txt.mid(index+1, txt.length() - index - 1 - 1);
		id = strID.toUInt(&ok);
		if(!ok) return;
		
		face = *(chkItem->pixmap(0));
		
		emit memberClicked(id, chkItem->isOn());
	}
	while(child){
		child->setOn(chkItem->isOn());
		
		txt = child->text(0);
		int index = txt.findRev("(");
		nick = txt.left( index );
		strID = txt.mid(index+1, txt.length() - index - 1 - 1);
		id = strID.toUInt(&ok);
		if(!ok) return;
		
		face = *(child->pixmap(0));
		
		emit memberClicked(id, child->isOn());
		child = dynamic_cast<QCheckListItem *>(child->nextSibling());
	}
}
Пример #4
0
QStringList OListEditForm::activeItemLabels() const
{
    QStringList activeItemLabelList;
    for( QCheckListItem *item = (QCheckListItem*)m_listView->firstChild();
         item;
         item = (QCheckListItem*)item->nextSibling() )
    {
        if( item->isOn() )
        {
            activeItemLabelList << item->text( 0 );
        }
    }
    return activeItemLabelList;
}
Пример #5
0
QCheckListItem* VCSliderProperties::levelFixtureNode(t_fixture_id id)
{
	QCheckListItem* item = NULL;

	for (item = static_cast<QCheckListItem*> (m_levelList->firstChild());
	     item != NULL;
	     item = static_cast<QCheckListItem*> (item->nextSibling()))
	{
		if (item->text(KColumnID).toInt() == id)
			return item;
	}

	return NULL;
}
Пример #6
0
QCheckListItem* VCSliderProperties::levelChannelNode(QCheckListItem* parent,
						     t_channel ch)
{
	QCheckListItem* item = NULL;

	for (item = static_cast<QCheckListItem*> (parent->firstChild());
	     item != NULL;
	     item = static_cast<QCheckListItem*> (item->nextSibling()))
	{
		if (item->text(KColumnID).toInt() == ch)
			return item;
	}

	return NULL;
}
Пример #7
0
void MainWindow::slotDownload()
{
    // Retrieve list of packages selected for download (if any)
    QStringList workingPackages;

    for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
          item != 0 ;
          item = static_cast<QCheckListItem *>(item->nextSibling()) )
    {
        if ( item->isOn() )
            workingPackages.append( item->text() );
    }

    if ( workingPackages.isEmpty() )
    {
        QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
        return;
    }
    else
    {
        // Download selected packages
        m_config.setGroup( "settings" );
        QString workingDir = m_config.readEntry( "DownloadDir", "/tmp" );

        bool ok = false;
        QString text = EntryDlg::getText( tr( "Download" ), tr( "Enter path to download package to:" ), workingDir, &ok, this );
        if ( ok && !text.isEmpty() )
            workingDir = text;   // user entered something and pressed ok
        else
            return; // user entered nothing or pressed cancel

        // Store download directory in config file
        m_config.writeEntry( "DownloadDir", workingDir );

        // Get starting directory
        QDir::setCurrent( workingDir );

        // Create package manager output widget
        InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Download packages" ),
                                          OPackage::Download, workingPackages );
        connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );

        // Display widget
        m_widgetStack.addWidget( dlg, 3 );
        m_widgetStack.raiseWidget( dlg );
    }
}
Пример #8
0
	const QStringList & Clean::getCleanlist()
	{
		QStringList templist;

		QCheckListItem *item = (QCheckListItem *)listview->firstChild();
		int i = m_extlist.count() - 1;
		while ( item )
		{
			if ( item->isOn() && item->text(0).endsWith(m_extlist[i]) )
				templist.append(m_extlist[i]);

			item = (QCheckListItem *)item->nextSibling();
			--i;
		}

		m_extlist = templist;
		return m_extlist;
	}
Пример #9
0
void CheckedListView::setChecked( const QStringList &checked )
{
    // iterate over all items
    bool showingChecked = FALSE;
    for ( QCheckListItem *i = (QCheckListItem *) firstChild();
	  i; i = (QCheckListItem *)i->nextSibling() )
	// see if the item should be checked by searching the
	// checked list
	if ( checked.find( i->text( 0 ) ) != checked.end() ) {
	   i->setOn( TRUE );
	   // make sure it is showing at least one checked item
	   if ( !showingChecked ) {
	       ensureItemVisible( i );
	       showingChecked = TRUE;
	   }
	}
       else
	   i->setOn( FALSE );
}
Пример #10
0
void LinkerOptionsDlg::accept()
{
	hide();
	
	QStringList linkedInternal;
	for ( QListViewItemIterator internalIt( m_pWidget->m_pInternalLibraries ); internalIt.current(); ++internalIt )
	{
		QCheckListItem * item = static_cast<QCheckListItem*>(internalIt.current());
		if ( item->isOn() )
			linkedInternal << item->text();
	}
	m_pLinkerOptions->setLinkedInternal( linkedInternal );
	
	m_pLinkerOptions->setLinkedExternal( m_pWidget->m_pExternalLibraries->items() );
	m_pLinkerOptions->setHexFormat( (LinkerOptions::HexFormat::type) m_pWidget->m_pHexFormat->currentItem() );
	m_pLinkerOptions->setOutputMapFile( m_pWidget->m_pOutputMap->isChecked() );
	m_pLinkerOptions->setLibraryDir( m_pWidget->m_pLibraryDir->text() );
	m_pLinkerOptions->setLinkerScript( m_pWidget->m_pLinkerScript->text() );
	m_pLinkerOptions->setLinkerOther( m_pWidget->m_pOther->text() );
}
Пример #11
0
void VCSliderProperties::levelSelectChannelsByGroup(QString group)
{
	QCheckListItem* fxiNode = NULL;
	QCheckListItem* chNode = NULL;

	for (fxiNode = static_cast<QCheckListItem*> (m_levelList->firstChild());
	     fxiNode != NULL;
	     fxiNode = static_cast<QCheckListItem*> (fxiNode->nextSibling()))
	{
		for (chNode = static_cast<QCheckListItem*> (fxiNode->firstChild());
		     chNode != NULL;
		     chNode = static_cast<QCheckListItem*> (chNode->nextSibling()))
		{
			if (chNode->text(KColumnType) == group)
				chNode->setOn(true);
			else
				chNode->setOn(false);
		}
	}
}
Пример #12
0
void MainWindow::searchForPackage( const QString &text )
{
    if ( !text.isEmpty() )
    {
        // look through package list for text startng at current position
        QCheckListItem *start = static_cast<QCheckListItem *>(m_packageList.currentItem());
        if ( start == 0 )
            start = static_cast<QCheckListItem *>(m_packageList.firstChild());

//        for ( QCheckListItem *item = static_cast<QCheckListItem *>(start->nextSibling()); item != 0 ;
        for ( QCheckListItem *item = static_cast<QCheckListItem *>(start); item != 0 ;
              item = static_cast<QCheckListItem *>(item->nextSibling()) )
        {
            if ( item->text().lower().find( text ) != -1 )
            {
                m_packageList.ensureItemVisible( item );
                m_packageList.setCurrentItem( item );
                break;
            }
        }
    }
}
Пример #13
0
void MainWindow::slotApply()
{
    QStringList removeList;
    QStringList installList;
    QStringList upgradeList;

    for ( QCheckListItem *item = static_cast<QCheckListItem *>(m_packageList.firstChild());
          item != 0 ;
          item = static_cast<QCheckListItem *>(item->nextSibling()) )
    {
        if ( item->isOn() )
        {
            OPackage *package = m_packman.findPackage( item->text() );
            if ( package )
            {
                if ( !package->versionInstalled().isNull() )
                {
                    if ( m_packman.compareVersions( package->version(), package->versionInstalled() ) == 1 )
                    {
                        // Remove/upgrade package
                        int answer =  PromptDlg::ask( tr( "Remove or upgrade" ),
                                      tr( QString( "Do you wish to remove or upgrade\n%1?" ).arg( item->text() ) ),
                                      tr( "Remove" ), tr( "Upgrade" ), this );
                        if ( answer == 1 )  // Remove
                        {
                            removeList.append( item->text() );
                        }
                        else if ( answer == 2 )  // Upgrade
                        {
                            upgradeList.append( item->text() );
                        }
                    }
                    else
                    {
                        // Remove/reinstall package
                        int answer =  PromptDlg::ask( tr( "Remove or reinstall" ),
                                      tr( QString( "Do you wish to remove or reinstall\n%1?" ).arg( item->text() ) ),
                                      tr( "Remove" ), tr( "Reinstall" ), this );
                        if ( answer == 1 )  // Remove
                        {
                            removeList.append( item->text() );
                        }
                        else if ( answer == 2 )  // Reinstall
                        {
                            installList.append( item->text() );
                        }
                    }
                }
                else
                {
                    // Install package
                    installList.append( item->text() );
                }
            }
        }
    }

    // If nothing is selected, display message and exit
    if ( removeList.isEmpty() && installList.isEmpty() && upgradeList.isEmpty() )
    {
        QMessageBox::information( this, tr( "Nothing to do" ), tr( "No packages selected" ), tr( "OK" ) );
        return;
    }

    // Send command only if there are packages to process
    OPackage::Command removeCmd = !removeList.isEmpty() ? OPackage::Remove
                                                        : OPackage::NotDefined;
    OPackage::Command installCmd = !installList.isEmpty() ? OPackage::Install
                                                          : OPackage::NotDefined;
    OPackage::Command upgradeCmd = !upgradeList.isEmpty() ? OPackage::Upgrade
                                                          : OPackage::NotDefined;

    // Create package manager output widget
    InstallDlg *dlg = new InstallDlg( this, &m_packman, tr( "Apply changes" ),
                                      removeCmd, removeList,
                                      installCmd, installList,
                                      upgradeCmd, upgradeList );
    connect( dlg, SIGNAL(closeInstallDlg()), this, SLOT(slotCloseDlg()) );

    // Display widget
    m_widgetStack.addWidget( dlg, 3 );
    m_widgetStack.raiseWidget( dlg );
}
Пример #14
0
void PreferencesDialog::accept() {
    cancelSetAccelKey();

    if( !isRevealingSequenceSelectionValid() ) {
        tab->showPage( quizPage ); 
        QMessageBox::warning( this, QObject::tr( "Warning" ), tr( "RevealingOrderMandatory" ) );
        return;
    }

    if( !isStudyLanguageSelectionValid() ) {
        tab->showPage( languagePage ); 
        QMessageBox::warning( this, QObject::tr( "Warning" ), tr( "StudyLanguagesMandatory" ) );
        return;
    }

    if( quizAlgoOriginalRadioButton->isChecked() )
        prefs->setQuizAlgorithm( Preferences::ORIGINAL );
    else if( quizAlgoSuperMemo2RadioButton->isChecked() )
        prefs->setQuizAlgorithm( Preferences::SUPERMEMO2 );

    prefs->setQuizCharacterImageLocation( quizCharacterImageLocationField->text() );
    prefs->setQuizCharacterImagesAnimated( quizCharacterImageTypeCheckbox->isOn() );
    prefs->setQuizLength( quizLengthSlider->value() );

    prefs->clearRevealingSequences();
    for( SequenceListItem* item = (SequenceListItem*)sequencesView->firstChild(); item; item = (SequenceListItem*)item->nextSibling() )
        prefs->addRevealingSequence( item->getSequence() );

    prefs->setLabelsFontFamily( labelsFontFamilyComboBox->text( labelsFontFamilyComboBox->currentItem() ) );
    int fontSizeNameListLength = sizeof( fontSizeNameList ) / sizeof( QString );
    int labelsFontSizeModifier =  labelsFontSizeComboBox->currentItem() - ( fontSizeNameListLength - 1 ) / 2;
    prefs->setLabelsFontSizeModifier( labelsFontSizeModifier );

    prefs->setFontFamily( fontFamilyComboBox->text( fontFamilyComboBox->currentItem() ) );
    int fontSizeModifier =  fontSizeComboBox->currentItem() - ( fontSizeNameListLength - 1 ) / 2;
    prefs->setFontSizeModifier( fontSizeModifier );

    prefs->clearFontOverrideFamilies();
    prefs->clearFontOverrideSizes();
    int fontOverrideCount = fontOverrideLabels.count();
    for( int i = 0; i < fontOverrideCount; i++ ) {
        const QString& language = Util::getLanguageCode( fontOverrideLabels.at( i )->text() );
        if( fontOverrideFamilyComboBoxes.at( i )->currentItem() > 0 )
            prefs->setFontOverrideFamily( language, fontOverrideFamilyComboBoxes.at( i )->currentText() );
        if( fontOverrideSizeComboBoxes.at( i )->currentItem() > 0 ) {
            int fontSizeModifier =  ( fontOverrideSizeComboBoxes.at( i )->currentItem() - 1 ) - ( fontSizeNameListLength - 1 ) / 2;
            prefs->setFontOverrideSize( language, fontSizeModifier );
        }
    }

    bool firstLanguageExists = false;
    bool testLanguageExists = false;
    prefs->clearStudyLanguages();
    for( QCheckListItem* item = (QCheckListItem*)studyLanguagesListView->firstChild(); item; item = (QCheckListItem*)item->nextSibling() ) {
        if( item->isOn() ) {
            QString langCode( Util::getLanguageCode( item->text() ) );
            prefs->addStudyLanguage( langCode );
            if( !firstLanguageExists )
                firstLanguageExists = ( prefs->getFirstLanguage() == langCode );
            if( !testLanguageExists )
                testLanguageExists = (prefs->getTestLanguage() == langCode );
        }
    }
    if( !firstLanguageExists )
        prefs->setFirstLanguage( QString::null );
    if( !testLanguageExists )
        prefs->setTestLanguage( QString::null );

    prefs->setDigraphEnabled( digraphCheckBox->isOn() );
    prefs->setQuizButtonsHidden( hideQuizButtonCheckBox->isOn() );
    prefs->setAltInTermListShown( showAltTextInTermListCheckBox->isOn() );

    if( keyboardAccelModified ) {
        for( KeyActionListViewItem* item = (KeyActionListViewItem*)keyboardAccelListView->firstChild(); item ; 
            item = (KeyActionListViewItem*)item->nextSibling() ) {
            QAction *action = item->getAction();
            action->setAccel( item->getKey() );
            prefs->setAccelerator( item->getActionIndex(), item->getKey() );
        }
    }

    QDialog::accept();
}