FormLibraryEditor::FormLibraryEditor(QWidget* parent, Qt::WindowFlags flags)
	: QWidget(parent, flags)
	, ui(new Ui::FormLibraryEditor)
	, ui_user_pwd(new Ui::DialogUserPassword)
	, cwall(QSqlDatabase::database("cwall"))
	, modelDiffucalty(new QSqlTableModel(this, cwall))
	, modelRanges(new QSqlTableModel(this, cwall))
	, modelCompetitionTypes(new QSqlTableModel(this, cwall))
	, modelAgeGroups(new QSqlTableModel(this, cwall))
	, modelTeams(new QSqlTableModel(this, cwall))
	, modelCompetitors(new QSqlRelationalTableModel(this, cwall))
	, modelUser(new QSqlTableModel(this, cwall))
{
	ui->setupUi(this);

	setMinimumWidth(600);
	QAction *actionSeparator = new QAction(this);
	actionSeparator->setSeparator(true);
	QAction *actionSeparator1 = new QAction(this);
	actionSeparator1->setSeparator(true);

	modelDiffucalty->setTable("lib_climbdifficalty");
	ui->listViewDiffucalties->setModel(modelDiffucalty);
	ui->listViewDiffucalties->setModelColumn(modelDiffucalty->fieldIndex("label"));
	modelDiffucalty->sort(modelDiffucalty->fieldIndex("id"), Qt::AscendingOrder);
	modelDiffucalty->select();
	modelDiffucalty->setEditStrategy(QSqlTableModel::OnManualSubmit);
	ui->actionDifficultyCommit->setDisabled(true);
	if (User::current()->isSuperuser() & DialogConfigure::cfg()->registration()) {
		ui->listViewDiffucalties->setContextMenuPolicy(Qt::ActionsContextMenu);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyUpdate);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyCommit);
		ui->listViewDiffucalties->addAction(actionSeparator);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyAdd);
		ui->listViewDiffucalties->addAction(ui->actionDifficultyDelete);
		connect(ui->listViewDiffucalties, SIGNAL(pressed(QModelIndex)), this, SLOT(currentDiffChanged(QModelIndex)));
		connect(ui->listViewDiffucalties, SIGNAL(activated(QModelIndex)), this, SLOT(currentDiffChanged(QModelIndex)));
		connect(modelDiffucalty, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
	} else {
		ui->listViewDiffucalties->setEditTriggers(QAbstractItemView::NoEditTriggers);
	}

	modelRanges->setTable("lib_sportrange");
	ui->listViewSportRanges->setModel(modelRanges);
	ui->listViewSportRanges->setModelColumn(modelRanges->fieldIndex("label"));
	modelRanges->sort(modelRanges->fieldIndex("id"), Qt::AscendingOrder);
	modelRanges->select();
	ui->listViewSportRanges->setEditTriggers(QAbstractItemView::NoEditTriggers);

	modelCompetitionTypes->setTable("lib_competitiontype");
	ui->tableViewCompetitionTypes->setModel(modelCompetitionTypes);
	modelCompetitionTypes->select();
	ui->tableViewCompetitionTypes->hideColumn(modelCompetitionTypes->fieldIndex("prefix"));
	ui->tableViewCompetitionTypes->hideColumn(modelCompetitionTypes->fieldIndex("id"));
	modelCompetitionTypes->setEditStrategy(QSqlTableModel::OnManualSubmit);
	if (User::current()->isSuperuser() & DialogConfigure::cfg()->registration()) {
		ui->tableViewCompetitionTypes->addAction(ui->actionCTypeCommit);
		ui->tableViewCompetitionTypes->addAction(ui->actionCTypeUpdate);
		ui->actionCTypeCommit->setDisabled(true);
		connect(modelCompetitionTypes, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
	} else {
		ui->tableViewCompetitionTypes->setEditTriggers(QAbstractItemView::NoEditTriggers);
	}

	modelAgeGroups->setTable("lib_agegroup");
	ui->tableViewAgeGroups->setModel(modelAgeGroups);
	modelAgeGroups->select();
	ui->tableViewAgeGroups->hideColumn(modelAgeGroups->fieldIndex("id"));
	modelAgeGroups->sort(modelAgeGroups->fieldIndex("id"), Qt::AscendingOrder);
	modelAgeGroups->setEditStrategy(QSqlTableModel::OnManualSubmit);
	if (DialogConfigure::cfg()->registration()) {
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupUpdate);
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupCommit);
		ui->tableViewAgeGroups->addAction(actionSeparator);
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupAdd);
		ui->tableViewAgeGroups->addAction(ui->actionAgeGroupDelete);
		ui->actionAgeGroupCommit->setDisabled(true);
		ui->actionAgeGroupDelete->setDisabled(true);
		connect(modelAgeGroups, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
		connect(ui->tableViewAgeGroups, SIGNAL(activated(QModelIndex)), this, SLOT(currentAgrpChanged(QModelIndex)));
		connect(ui->tableViewAgeGroups, SIGNAL(pressed(QModelIndex)), this, SLOT(currentAgrpChanged(QModelIndex)));
	} else {
		ui->tableViewAgeGroups->setEditTriggers(QAbstractItemView::NoEditTriggers);
	}

	modelTeams->setTable("lib_team");
	ui->tableViewTeams->setModel(modelTeams);
	ui->tableViewTeams->hideColumn(modelTeams->fieldIndex("gid"));
	modelTeams->sort(modelTeams->fieldIndex("gid"), Qt::AscendingOrder);
	modelTeams->select();
	ui->tableViewTeams->addAction(ui->actionTeamCommit);
	ui->tableViewTeams->addAction(ui->actionTeamUpdate);
	ui->tableViewTeams->addAction(actionSeparator);
	ui->tableViewTeams->addAction(ui->actionTeamAdd);
	ui->tableViewTeams->addAction(ui->actionTeamDelete);
	modelTeams->setEditStrategy(QSqlTableModel::OnManualSubmit);
	ui->actionTeamCommit->setDisabled(true);
	ui->actionTeamDelete->setDisabled(true);
	connect(modelTeams, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
	connect(ui->tableViewTeams, SIGNAL(activated(QModelIndex)), this, SLOT(currentTeamChanged(QModelIndex)));
	connect(ui->tableViewTeams, SIGNAL(pressed(QModelIndex)), this, SLOT(currentTeamChanged(QModelIndex)));

	modelCompetitors->setTable("lib_competitor");
	ui->tableViewCompetitors->setModel(modelCompetitors);
	ui->tableViewCompetitors->hideColumn(modelCompetitors->fieldIndex("uid"));
	modelCompetitors->setRelation(modelCompetitors->fieldIndex("team"),QSqlRelation("lib_team", "gid", "title"));
	modelCompetitors->setRelation(modelCompetitors->fieldIndex("range"),QSqlRelation("lib_sportrange", "id", "label"));
	modelCompetitors->select();
	ui->comboBoxCompetitorGender->addItem(tr("Male"), "М");
	ui->comboBoxCompetitorGender->addItem(tr("Female"), "Ж");
	for (int id = 0; id < modelRanges->rowCount(); id++) {
		ui->comboBoxCompetitorRange->addItem(modelRanges->record(id).value("label").toString(), modelRanges->record(id).value("id").toInt());
	}
	for (int id = 0; id < modelTeams->rowCount(); id++) {
		ui->comboBoxCompetitorTeam->addItem(modelTeams->record(id).value("title").toString() + " (" + modelTeams->record(id).value("region").toString() + ")", modelTeams->record(id).value("gid").toInt());
	}
	modelCompetitors->setEditStrategy(QSqlTableModel::OnManualSubmit);
	ui->tableViewCompetitors->addAction(ui->actionCompetitorCommit);
	ui->tableViewCompetitors->addAction(ui->actionComtetitorUpdate);
	ui->tableViewCompetitors->addAction(actionSeparator);
	ui->tableViewCompetitors->addAction(ui->actionCompetitorDelete);
	ui->actionCompetitorDelete->setDisabled(true);
	ui->actionCompetitorCommit->setDisabled(true);
	competitorFieldsPrepare();
	connect(modelCompetitors, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));

	modelUser->setTable("site_user");
	ui->tableViewUsers->setModel(modelUser);
	ui->tableViewUsers->hideColumn(modelUser->fieldIndex("pwdhash"));
	ui->tableViewUsers->hideColumn(modelUser->fieldIndex("uid"));
	modelUser->sort(modelUser->fieldIndex("uid"), Qt::AscendingOrder);
	modelUser->select();
	ui->tableViewUsers->addAction(ui->actionUserUpdate);
	ui->tableViewUsers->addAction(ui->actionUserCommit);

	ui->tableViewUsers->addAction(actionSeparator);
	ui->tableViewUsers->addAction(ui->actionUserChangePasswd);
	ui->tableViewUsers->addAction(ui->actionUserDelete);
	modelUser->setEditStrategy(QSqlTableModel::OnManualSubmit);
	currentUserChanged(QModelIndex());
	ui->pushButtonUserCommit->setDisabled(true);

	ui->listWidgetCatalog->setCurrentItem(0);
	ui->stackedWidget->setCurrentIndex(0);

	if (!User::current()->isSuperuser()) {
		ui->listWidgetCatalog->model()->removeRow(ui->listWidgetCatalog->count()-1);
	}

	connect(modelUser, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(modelChange()));
}
void EntryAttachmentsModel::attachmentChange(const QString& key)
{
    int row = m_entryAttachments->keys().indexOf(key);
    Q_EMIT dataChanged(index(row, 0), index(row, columnCount()-1));
}
Exemple #3
0
void QHexEditPrivate::insert(int index, char ch)
{
    QUndoCommand *charCommand = new CharCommand(&_xData, CharCommand::insert, index, ch);
    _undoStack->push(charCommand);
    emit dataChanged();
}
void PrettyMailboxModel::xtConnectStatusChanged(QModelIndex index)
{
    Q_ASSERT(index.model() == this);
    emit dataChanged(index, index);
}
Exemple #5
0
void HistoryModel::entryUpdated(int offset)
{
    QModelIndex idx = index(offset, 0);
    emit dataChanged(idx, idx);
}
Exemple #6
0
void BookmarksModel::entryChanged(BookmarkNode *item)
{
    QModelIndex idx = index(item);
    emit dataChanged(idx, idx);
}
void QgsGraduatedSymbolRendererV2Model::updateLabels()
{
  emit dataChanged( createIndex( 0, 2 ), createIndex( mRenderer->ranges().size(), 2 ) );
}
Exemple #8
0
// write QSettings values
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
    bool successful = true; /* set to false on parse error */
    if(role == Qt::EditRole)
    {
        QSettings settings;
        switch(index.row())
        {
        case StartAtStartup:
            successful = GUIUtil::SetStartOnSystemStartup(value.toBool());
            break;
        case MinimizeToTray:
            fMinimizeToTray = value.toBool();
            settings.setValue("fMinimizeToTray", fMinimizeToTray);
            break;
        case MapPortUPnP: // core option - can be changed on-the-fly
            settings.setValue("fUseUPnP", value.toBool());
            MapPort(value.toBool());
            break;
        case MinimizeOnClose:
            fMinimizeOnClose = value.toBool();
            settings.setValue("fMinimizeOnClose", fMinimizeOnClose);
            break;

        // default proxy
        case ProxyUse:
            if (settings.value("fUseProxy") != value) {
                settings.setValue("fUseProxy", value.toBool());
                setRestartRequired(true);
            }
            break;
        case ProxyIP: {
            // contains current IP at index 0 and current port at index 1
            QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
            // if that key doesn't exist or has a changed IP
            if (!settings.contains("addrProxy") || strlIpPort.at(0) != value.toString()) {
                // construct new value from new IP and current port
                QString strNewValue = value.toString() + ":" + strlIpPort.at(1);
                settings.setValue("addrProxy", strNewValue);
                setRestartRequired(true);
            }
        }
        break;
        case ProxyPort: {
            // contains current IP at index 0 and current port at index 1
            QStringList strlIpPort = settings.value("addrProxy").toString().split(":", QString::SkipEmptyParts);
            // if that key doesn't exist or has a changed port
            if (!settings.contains("addrProxy") || strlIpPort.at(1) != value.toString()) {
                // construct new value from current IP and new port
                QString strNewValue = strlIpPort.at(0) + ":" + value.toString();
                settings.setValue("addrProxy", strNewValue);
                setRestartRequired(true);
            }
        }
        break;
#ifdef ENABLE_WALLET
        case SpendZeroConfChange:
            if (settings.value("bSpendZeroConfChange") != value) {
                settings.setValue("bSpendZeroConfChange", value);
                setRestartRequired(true);
            }
            break;
#endif
        case DisplayUnit:
            setDisplayUnit(value);
            break;
        case ThirdPartyTxUrls:
            if (strThirdPartyTxUrls != value.toString()) {
                strThirdPartyTxUrls = value.toString();
                settings.setValue("strThirdPartyTxUrls", strThirdPartyTxUrls);
                setRestartRequired(true);
            }
            break;
        case Language:
            if (settings.value("language") != value) {
                settings.setValue("language", value);
                setRestartRequired(true);
            }
            break;
        case CoinControlFeatures:
            fCoinControlFeatures = value.toBool();
            settings.setValue("fCoinControlFeatures", fCoinControlFeatures);
            emit coinControlFeaturesChanged(fCoinControlFeatures);
            break;
        case DatabaseCache:
            if (settings.value("nDatabaseCache") != value) {
                settings.setValue("nDatabaseCache", value);
                setRestartRequired(true);
            }
            break;
        case ThreadsScriptVerif:
            if (settings.value("nThreadsScriptVerif") != value) {
                settings.setValue("nThreadsScriptVerif", value);
                setRestartRequired(true);
            }
            break;
        case Listen:
            if (settings.value("fListen") != value) {
                settings.setValue("fListen", value);
                setRestartRequired(true);
            }
            break;
        case MiningIntensity:
            if (settings.value("nMiningIntensity") != value.toInt()) {
                settings.setValue("nMiningIntensity", value.toInt());
                setRestartRequired(true);
            }
        default:
            break;
        }
    }

    emit dataChanged(index, index);

    return successful;
}
void LinearCurveSegmentModel::on_endChanged()
{
    emit dataChanged();
}
Exemple #10
0
void organicInstrumentView::modelChanged()
{
    organicInstrument * oi = castModel<organicInstrument>();

    const float y=91.0f;
    const float rowHeight = 26.0f;
    const float x=53.0f;
    const float colWidth = 24.0f;

    m_numOscillators = oi->m_numOscillators;

    m_fx1Knob->setModel( &oi->m_fx1Model );
    m_volKnob->setModel( &oi->m_volModel );

    if( m_oscKnobs != NULL )
    {
        delete[] m_oscKnobs;
    }

    m_oscKnobs = new OscillatorKnobs[ m_numOscillators ];

    // Create knobs, now that we know how many to make
    for( int i = 0; i < m_numOscillators; ++i )
    {
        // setup harmonic knob
        knob * harmKnob = new organicKnob( this );
        harmKnob->move( x + i * colWidth, y - rowHeight );
        harmKnob->setObjectName( "harmKnob" );
        connect( &oi->m_osc[i]->m_harmModel, SIGNAL( dataChanged() ),
                 this, SLOT( updateKnobHint() ) );

        // setup waveform-knob
        knob * oscKnob = new organicKnob( this );
        oscKnob->move( x + i * colWidth, y );
        connect( &oi->m_osc[i]->m_oscModel, SIGNAL( dataChanged() ),
                 this, SLOT( updateKnobHint() ) );

        oscKnob->setHintText( tr( "Osc %1 waveform:" ).arg( i + 1 ) + " ", QString() );

        // setup volume-knob
        knob * volKnob = new knob( knobStyled, this );
        volKnob->setVolumeKnob( true );
        volKnob->move( x + i * colWidth, y + rowHeight*1 );
        volKnob->setFixedSize( 21, 21 );
        volKnob->setHintText( tr( "Osc %1 volume:" ).arg(
                                  i + 1 ) + " ", "%" );

        // setup panning-knob
        knob * panKnob = new organicKnob( this );
        panKnob->move( x + i  * colWidth, y + rowHeight*2 );
        panKnob->setHintText( tr("Osc %1 panning:").arg(
                                  i + 1 ) + " ", "" );

        // setup knob for fine-detuning
        knob * detuneKnob = new organicKnob( this );
        detuneKnob->move( x + i * colWidth, y + rowHeight*3 );
        detuneKnob->setHintText( tr( "Osc %1 stereo detuning" ).arg( i + 1 )
                                 + " ", " " +
                                 tr( "cents" ) );

        m_oscKnobs[i] = OscillatorKnobs( harmKnob, volKnob, oscKnob, panKnob, detuneKnob );

        // Attach to models
        m_oscKnobs[i].m_harmKnob->setModel( &oi->m_osc[i]->m_harmModel );
        m_oscKnobs[i].m_volKnob->setModel( &oi->m_osc[i]->m_volModel );
        m_oscKnobs[i].m_oscKnob->setModel( &oi->m_osc[i]->m_oscModel );
        m_oscKnobs[i].m_panKnob->setModel( &oi->m_osc[i]->m_panModel );
        m_oscKnobs[i].m_detuneKnob->setModel( &oi->m_osc[i]->m_detuneModel );
    }
    updateKnobHint();
}
Exemple #11
0
organicInstrument::organicInstrument( InstrumentTrack * _instrument_track ) :
    Instrument( _instrument_track, &organic_plugin_descriptor ),
    m_modulationAlgo( Oscillator::SignalMix, Oscillator::SignalMix, Oscillator::SignalMix),
    m_fx1Model( 0.0f, 0.0f, 0.99f, 0.01f , this, tr( "Distortion" ) ),
    m_volModel( 100.0f, 0.0f, 200.0f, 1.0f, this, tr( "Volume" ) )
{
    m_numOscillators = 8;

    m_osc = new OscillatorObject*[ m_numOscillators ];
    for (int i=0; i < m_numOscillators; i++)
    {
        m_osc[i] = new OscillatorObject( this, i );
        m_osc[i]->m_numOscillators = m_numOscillators;

        // Connect events
        connect( &m_osc[i]->m_oscModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT ( oscButtonChanged() ) );
        connect( &m_osc[i]->m_harmModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateDetuning() ) );
        connect( &m_osc[i]->m_volModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateVolume() ) );
        connect( &m_osc[i]->m_panModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateVolume() ) );
        connect( &m_osc[i]->m_detuneModel, SIGNAL( dataChanged() ),
                 m_osc[i], SLOT( updateDetuning() ) );

        m_osc[i]->updateVolume();

    }

    /*	m_osc[0]->m_harmonic = log2f( 0.5f );	// one octave below
    	m_osc[1]->m_harmonic = log2f( 0.75f );	// a fifth below
    	m_osc[2]->m_harmonic = log2f( 1.0f );	// base freq
    	m_osc[3]->m_harmonic = log2f( 2.0f );	// first overtone
    	m_osc[4]->m_harmonic = log2f( 3.0f );	// second overtone
    	m_osc[5]->m_harmonic = log2f( 4.0f );	// .
    	m_osc[6]->m_harmonic = log2f( 5.0f );	// .
    	m_osc[7]->m_harmonic = log2f( 6.0f );	// .*/

    if( s_harmonics == NULL )
    {
        s_harmonics = new float[ NUM_HARMONICS ];
        s_harmonics[0] = log2f( 0.5f );
        s_harmonics[1] = log2f( 0.75f );
        s_harmonics[2] = log2f( 1.0f );
        s_harmonics[3] = log2f( 2.0f );
        s_harmonics[4] = log2f( 3.0f );
        s_harmonics[5] = log2f( 4.0f );
        s_harmonics[6] = log2f( 5.0f );
        s_harmonics[7] = log2f( 6.0f );
        s_harmonics[8] = log2f( 7.0f );
        s_harmonics[9] = log2f( 8.0f );
        s_harmonics[10] = log2f( 9.0f );
        s_harmonics[11] = log2f( 10.0f );
        s_harmonics[12] = log2f( 11.0f );
        s_harmonics[13] = log2f( 12.0f );
        s_harmonics[14] = log2f( 13.0f );
        s_harmonics[15] = log2f( 14.0f );
        s_harmonics[16] = log2f( 15.0f );
        s_harmonics[17] = log2f( 16.0f );
    }

    for (int i=0; i < m_numOscillators; i++) {
        m_osc[i]->updateVolume();
        m_osc[i]->updateDetuning();
    }


    connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
             this, SLOT( updateAllDetuning() ) );
}
EnvelopeAndLfoParameters::EnvelopeAndLfoParameters(
					float _value_for_zero_amount,
							Model * _parent ) :
	Model( _parent ),
	m_used( false ),
	m_predelayModel( 0.0, 0.0, 2.0, 0.001, this, tr( "Predelay" ) ),
	m_attackModel( 0.0, 0.0, 2.0, 0.001, this, tr( "Attack" ) ),
	m_holdModel( 0.5, 0.0, 2.0, 0.001, this, tr( "Hold" ) ),
	m_decayModel( 0.5, 0.0, 2.0, 0.001, this, tr( "Decay" ) ),
	m_sustainModel( 0.5, 0.0, 1.0, 0.001, this, tr( "Sustain" ) ),
	m_releaseModel( 0.1, 0.0, 2.0, 0.001, this, tr( "Release" ) ),
	m_amountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "Modulation" ) ),
	m_valueForZeroAmount( _value_for_zero_amount ),
	m_pahdFrames( 0 ),
	m_rFrames( 0 ),
	m_pahdEnv( NULL ),
	m_rEnv( NULL ),
	m_pahdBufSize( 0 ),
	m_rBufSize( 0 ),
	m_lfoPredelayModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO Predelay" ) ),
	m_lfoAttackModel( 0.0, 0.0, 1.0, 0.001, this, tr( "LFO Attack" ) ),
	m_lfoSpeedModel( 0.1, 0.001, 1.0, 0.0001,
				SECS_PER_LFO_OSCILLATION * 1000.0, this,
							tr( "LFO speed" ) ),
	m_lfoAmountModel( 0.0, -1.0, 1.0, 0.005, this, tr( "LFO Modulation" ) ),
	m_lfoWaveModel( SineWave, 0, NumLfoShapes, this, tr( "LFO Wave Shape" ) ),
	m_x100Model( false, this, tr( "Freq x 100" ) ),
	m_controlEnvAmountModel( false, this, tr( "Modulate Env-Amount" ) ),
	m_lfoFrame( 0 ),
	m_lfoAmountIsZero( false ),
	m_lfoShapeData( NULL )
{
	m_amountModel.setCenterValue( 0 );
	m_lfoAmountModel.setCenterValue( 0 );

	if( s_lfoInstances == NULL )
	{
		s_lfoInstances = new LfoInstances();
	}

	instances()->add( this );

	connect( &m_predelayModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_attackModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_holdModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_decayModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_sustainModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_releaseModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_amountModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );

	connect( &m_lfoPredelayModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoAttackModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoSpeedModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoAmountModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_lfoWaveModel, SIGNAL( dataChanged() ),
			this, SLOT( updateSampleVars() ) );
	connect( &m_x100Model, SIGNAL( dataChanged() ),
				this, SLOT( updateSampleVars() ) );

	connect( engine::mixer(), SIGNAL( sampleRateChanged() ),
				this, SLOT( updateSampleVars() ) );


	m_lfoShapeData =
		new sample_t[engine::mixer()->framesPerPeriod()];

	updateSampleVars();
}
void EnvelopeAndLfoParameters::updateSampleVars()
{
	const float frames_per_env_seg = SECS_PER_ENV_SEGMENT *
				engine::mixer()->processingSampleRate();
	// TODO: Remove the expKnobVals, time should be linear
	const f_cnt_t predelay_frames = static_cast<f_cnt_t>(
							frames_per_env_seg *
					expKnobVal( m_predelayModel.value() ) );

	const f_cnt_t attack_frames = static_cast<f_cnt_t>( frames_per_env_seg *
					expKnobVal( m_attackModel.value() ) );

	const f_cnt_t hold_frames = static_cast<f_cnt_t>( frames_per_env_seg *
					expKnobVal( m_holdModel.value() ) );

	const f_cnt_t decay_frames = static_cast<f_cnt_t>( frames_per_env_seg *
					expKnobVal( m_decayModel.value() *
						( 1 - m_sustainModel.value() ) ) );

	m_sustainLevel = m_sustainModel.value();
	m_amount = m_amountModel.value();
	if( m_amount >= 0 )
	{
		m_amountAdd = ( 1.0f - m_amount ) * m_valueForZeroAmount;
	}
	else
	{
		m_amountAdd = m_valueForZeroAmount;
	}

	m_pahdFrames = predelay_frames + attack_frames + hold_frames +
								decay_frames;
	m_rFrames = static_cast<f_cnt_t>( frames_per_env_seg *
					expKnobVal( m_releaseModel.value() ) );

	if( static_cast<int>( floorf( m_amount * 1000.0f ) ) == 0 )
	{
		m_rFrames = 0;
	}

	// if the buffers are too small, make bigger ones - so we only alloc new memory when necessary
	if( m_pahdBufSize < m_pahdFrames )
	{
		sample_t * tmp = m_pahdEnv;
		m_pahdEnv = new sample_t[m_pahdFrames];
		delete tmp;
		m_pahdBufSize = m_pahdFrames;
	}
	if( m_rBufSize < m_rFrames )
	{
		sample_t * tmp = m_rEnv;
		m_rEnv = new sample_t[m_rFrames];
		delete tmp;
		m_rBufSize = m_rFrames;
	}

	const float aa = m_amountAdd;
	for( f_cnt_t i = 0; i < predelay_frames; ++i )
	{
		m_pahdEnv[i] = aa;
	}

	f_cnt_t add = predelay_frames;

	const float afI = ( 1.0f / attack_frames ) * m_amount;
	for( f_cnt_t i = 0; i < attack_frames; ++i )
	{
		m_pahdEnv[add+i] = i * afI + aa;
	}

	add += attack_frames;
	const float amsum = m_amount + m_amountAdd;
	for( f_cnt_t i = 0; i < hold_frames; ++i )
	{
		m_pahdEnv[add + i] = amsum;
	}

	add += hold_frames;
	const float dfI = ( 1.0 / decay_frames ) * ( m_sustainLevel -1 ) * m_amount;
	for( f_cnt_t i = 0; i < decay_frames; ++i )
	{
/*
		m_pahdEnv[add + i] = ( m_sustainLevel + ( 1.0f -
						(float)i / decay_frames ) *
						( 1.0f - m_sustainLevel ) ) *
							m_amount + m_amountAdd;
*/
		m_pahdEnv[add + i] = amsum + i*dfI;
	}

	const float rfI = ( 1.0f / m_rFrames ) * m_amount;
	for( f_cnt_t i = 0; i < m_rFrames; ++i )
	{
		m_rEnv[i] = (float)( m_rFrames - i ) * rfI;
	}

	// save this calculation in real-time-part
	m_sustainLevel = m_sustainLevel * m_amount + m_amountAdd;


	const float frames_per_lfo_oscillation = SECS_PER_LFO_OSCILLATION *
				engine::mixer()->processingSampleRate();
	m_lfoPredelayFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
				expKnobVal( m_lfoPredelayModel.value() ) );
	m_lfoAttackFrames = static_cast<f_cnt_t>( frames_per_lfo_oscillation *
				expKnobVal( m_lfoAttackModel.value() ) );
	m_lfoOscillationFrames = static_cast<f_cnt_t>(
						frames_per_lfo_oscillation *
						m_lfoSpeedModel.value() );
	if( m_x100Model.value() )
	{
		m_lfoOscillationFrames /= 100;
	}
	m_lfoAmount = m_lfoAmountModel.value() * 0.5f;

	m_used = true;
	if( static_cast<int>( floorf( m_lfoAmount * 1000.0f ) ) == 0 )
	{
		m_lfoAmountIsZero = true;
		if( static_cast<int>( floorf( m_amount * 1000.0f ) ) == 0 )
		{
			m_used = false;
		}
	}
	else
	{
		m_lfoAmountIsZero = false;
	}

	m_bad_lfoShapeData = true;

	emit dataChanged();

}
Exemple #14
0
bool SoilProfile::setData(const QModelIndex &index, const QVariant &value, int role)
{
    if(index.parent()!=QModelIndex() || m_readOnly)
        return false;

    if (role == Qt::EditRole) {
        switch (index.column()) {
        case ThicknessColumn:
            if (index.row() < (rowCount() - 1)) {
                // Soil layers
                bool success;
                const double d = value.toDouble(&success);

                if (!success)
                    return false;

                m_soilLayers.at(index.row())->setThickness(d);
                updateDepths();
                emit dataChanged(this->index(index.row(), DepthColumn),
                                 this->index(rowCount(), DepthColumn));
                break;
            } else {
                // Rock layer
                return false;
            }
        case SoilTypeColumn:
            // Check if it is the final layer and if the SoilType can be identified
            if (index.row() < (rowCount() - 1)) {
                 if (SoilType* st = m_soilTypeCatalog->soilTypeOf(value)) {
                    m_soilLayers.at(index.row())->setSoilType(st);
                    break;
                }
            } else {
                return false;
            }
        case VelocityColumn:
        case StdevColumn:
                {
                    bool success;
                    const double d = value.toDouble(&success);

                    if (!success)
                        return false;

                    if (index.column() == VelocityColumn)
                        velocityLayer(index.row())->setAvg(d);
                    else if (index.column() == StdevColumn)
                        velocityLayer(index.row())->setStdev(d);
                    break;
                }
        case MinColumn:
        case MaxColumn:
                {
                    bool success;
                    const double d = value.toDouble(&success);

                    if (!success)
                        return false;

                    if (index.column() == MinColumn)
                        velocityLayer(index.row())->setMin(d);
                    else if(index.column() == MaxColumn)
                        velocityLayer(index.row())->setMax(d);
                    break;
                }
        case DepthColumn:
        case VariedColumn:
        default:
            return false;
        }
    } else if(role == Qt::CheckStateRole) {
        switch (index.column()) {
        case MinColumn:
            velocityLayer(index.row())->setHasMin(value.toBool());
            break;
        case MaxColumn:
            velocityLayer(index.row())->setHasMax(value.toBool());
            break;
        case VariedColumn:
            velocityLayer(index.row())->setIsVaried(value.toBool());
            break;
        }
    }

    emit dataChanged(index, index);
    return true;
}
Exemple #15
0
void IxModel::raiseEvent_dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight, const QVector<int> & roles /* = QVector<int>() */) { Q_EMIT dataChanged(topLeft, bottomRight, roles); }
QHexEditDataReader::QHexEditDataReader(QHexEditData *hexeditdata, QObject *parent): QObject(parent), _dirtybuffer(false), _bufferpos(-1), _hexeditdata(hexeditdata)
{
    connect(hexeditdata, SIGNAL(dataChanged(qint64,qint64,QHexEditData::ActionType)), this, SLOT(onDataChanged(qint64,qint64,QHexEditData::ActionType)));
    this->_buffereddata.resize(QHexEditData::BUFFER_SIZE);
}
Exemple #17
0
void IxModel::raiseEvent_dataChanged(const QModelIndex & topLeft, const QModelIndex & bottomRight) { Q_EMIT dataChanged(topLeft, bottomRight); }
Exemple #18
0
void VersionData::setSoftName(const QString &value)
{
    m_softName = value;
    emit dataChanged();
}
Exemple #19
0
WorkflowEditor::WorkflowEditor(WorkflowView *p)
    : QWidget(p),
      owner(p),
      custom(NULL),
      customWidget(NULL),
      subject(NULL),
      actor(NULL),
      onFirstTableShow(true)
{
    GCOUNTER( cvar, tvar, "WorkflowEditor" );
    setupUi(this);

    specialParameters = new SpecialParametersPanel(this);
    tableSplitter->insertWidget(0, specialParameters);
    specialParameters->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Maximum);
    table->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    specialParameters->hide();

#ifdef Q_OS_MAC
    QString style("QGroupBox::title {margin-top: 1px; margin-left: 15px;}");
    editorBox->setStyleSheet(style);
#endif

    QVBoxLayout *inputScrollAreaContainerLayout = new QVBoxLayout();
    inputScrollAreaContainerLayout->setContentsMargins(0, 0, 0, 0);
    inputScrollAreaContainerLayout->setSpacing(0);
    inputScrollAreaContainerLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
    inputScrollAreaContainer->setLayout(inputScrollAreaContainerLayout);

    inputPortBox->setEnabled(false);
    inputPortBox->setVisible(true);
    connect(inputPortBox, SIGNAL(toggled(bool)), SLOT(sl_changeVisibleInput(bool)));

    QVBoxLayout *outputScrollAreaContainerLayout = new QVBoxLayout();
    outputScrollAreaContainerLayout->setContentsMargins(0, 0, 0, 0);
    outputScrollAreaContainerLayout->setSpacing(0);
    outputScrollAreaContainerLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
    outputScrollAreaContainer->setLayout(outputScrollAreaContainerLayout);

    outputPortBox->setEnabled(false);
    outputPortBox->setVisible(true);
    connect(outputPortBox, SIGNAL(toggled(bool)), SLOT(sl_changeVisibleOutput(bool)));

    caption->setMinimumHeight(nameEdit->sizeHint().height());

    actorModel = new ActorCfgModel(this, owner);
    proxyModel = new ActorCfgFilterProxyModel(this);
    proxyModel->setSourceModel(actorModel);
    table->setModel(proxyModel);

    table->horizontalHeader()->setSectionsClickable(false);
    table->horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);

    table->verticalHeader()->hide();
    table->verticalHeader()->setDefaultSectionSize(QFontMetrics(QFont()).height() + 6);
    table->setItemDelegate(new SuperDelegate(this));
    table->installEventFilter(this);

    reset();

    doc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    propDoc->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    doc->installEventFilter(this);

    connect(nameEdit, SIGNAL(editingFinished()), SLOT(editingLabelFinished()));

    connect(table->selectionModel(), SIGNAL(currentChanged(QModelIndex, QModelIndex)), SLOT(sl_showPropDoc()));
    connect(table->model(), SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(handleDataChanged(QModelIndex, QModelIndex)));
    // FIXME
    //connect(doc, SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(sl_contextMenuForDoc(const QPoint &)));
    table->setTabKeyNavigation(true);
}
Exemple #20
0
void VersionData::setMinVersion(const int value)
{
    m_minVersion = value;
    emit dataChanged();
}
Exemple #21
0
bool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)
{
    bool successful = true; /* set to false on parse error */
    if(role == Qt::EditRole)
    {
        CWalletDB walletdb(wallet->strWalletFile);
        switch(index.row())
        {
        case StartAtStartup:
            successful = SetStartOnSystemStartup(value.toBool());
            break;
        case MinimizeToTray:
            fMinimizeToTray = value.toBool();
            walletdb.WriteSetting("fMinimizeToTray", fMinimizeToTray);
            break;
        case MapPortUPnP:
            fUseUPnP = value.toBool();
            walletdb.WriteSetting("fUseUPnP", fUseUPnP);
#ifdef USE_UPNP
            MapPort(fUseUPnP);
#endif
            break;
        case MinimizeOnClose:
            fMinimizeOnClose = value.toBool();
            walletdb.WriteSetting("fMinimizeOnClose", fMinimizeOnClose);
            break;
        case ConnectSOCKS4:
            fUseProxy = value.toBool();
            walletdb.WriteSetting("fUseProxy", fUseProxy);
            break;
        case ProxyIP:
            {
                // Use CAddress to parse and check IP
                CAddress addr(value.toString().toStdString() + ":1");
                if (addr.IsValid())
                {
                    addrProxy.SetIP(addr);
                    walletdb.WriteSetting("addrProxy", addrProxy);
                }
                else
                {
                    successful = false;
                }
            }
            break;
        case ProxyPort:
            {
                int nPort = atoi(value.toString().toAscii().data());
                if (nPort > 0 && nPort < std::numeric_limits<unsigned short>::max())
                {
                    addrProxy.SetPort(nPort);
                    walletdb.WriteSetting("addrProxy", addrProxy);
                }
                else
                {
                    successful = false;
                }
            }
            break;
        case Fee: {
            nTransactionFee = value.toLongLong();
            walletdb.WriteSetting("nTransactionFee", nTransactionFee);
            }
            break;
        case DisplayUnit: {
            int unit = value.toInt();
            nDisplayUnit = unit;
            walletdb.WriteSetting("nDisplayUnit", nDisplayUnit);
            emit displayUnitChanged(unit);
            }
        case DisplayAddresses: {
            bDisplayAddresses = value.toBool();
            walletdb.WriteSetting("bDisplayAddresses", bDisplayAddresses);
            }
        default:
            break;
        }
    }
    emit dataChanged(index, index);

    return successful;
}
Exemple #22
0
void VersionData::setPatVersion(const int value)
{
    m_patVersion = value;
    emit dataChanged();
}
DivePlannerGraphics::DivePlannerGraphics(QWidget* parent): QGraphicsView(parent), activeDraggedHandler(0)
{
	fill_profile_color();
	setBackgroundBrush(profile_color[BACKGROUND].at(0));
	setMouseTracking(true);
	setScene(new QGraphicsScene());
	scene()->setSceneRect(0,0,1920,1080);

	verticalLine = new QGraphicsLineItem(
		fromPercent(0, Qt::Horizontal),
		fromPercent(0, Qt::Vertical),
		fromPercent(0, Qt::Horizontal),
		fromPercent(100, Qt::Vertical)
	);

	verticalLine->setPen(QPen(Qt::DotLine));
	scene()->addItem(verticalLine);

	horizontalLine = new QGraphicsLineItem(
		fromPercent(0, Qt::Horizontal),
		fromPercent(0, Qt::Vertical),
		fromPercent(100, Qt::Horizontal),
		fromPercent(0, Qt::Vertical)
	);

	horizontalLine->setPen(QPen(Qt::DotLine));
	scene()->addItem(horizontalLine);

	timeLine = new Ruler();
	timeLine->setMinimum(0);
	timeLine->setMaximum(TIME_INITIAL_MAX);
	timeLine->setTickInterval(10);
	timeLine->setColor(getColor(TIME_GRID));
	timeLine->setLine(
		fromPercent(10, Qt::Horizontal),
		fromPercent(90, Qt::Vertical),
		fromPercent(90, Qt::Horizontal),
		fromPercent(90, Qt::Vertical)
	);
	timeLine->setOrientation(Qt::Horizontal);
	timeLine->setTickSize(fromPercent(1, Qt::Vertical));
	timeLine->setTextColor(getColor(TIME_TEXT));
	timeLine->updateTicks();
	scene()->addItem(timeLine);

	depthLine = new Ruler();
	depthLine->setMinimum(0);
	depthLine->setMaximum(M_OR_FT(40,120));
	depthLine->setTickInterval(M_OR_FT(10,30));
	depthLine->setLine(
		fromPercent(10, Qt::Horizontal),
		fromPercent(10, Qt::Vertical),
		fromPercent(10, Qt::Horizontal),
		fromPercent(90, Qt::Vertical)
	);
	depthLine->setOrientation(Qt::Vertical);
	depthLine->setTickSize(fromPercent(1, Qt::Horizontal));
	depthLine->setColor(getColor(DEPTH_GRID));
	depthLine->setTextColor(getColor(SAMPLE_DEEP));
	depthLine->updateTicks();
	scene()->addItem(depthLine);

	timeString = new QGraphicsSimpleTextItem();
	timeString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
	timeString->setBrush(profile_color[TIME_TEXT].at(0));
	scene()->addItem(timeString);

	depthString = new QGraphicsSimpleTextItem();
	depthString->setFlag(QGraphicsItem::ItemIgnoresTransformations);
	depthString->setBrush(profile_color[SAMPLE_DEEP].at(0));
	scene()->addItem(depthString);

	diveBg = new QGraphicsPolygonItem();
	diveBg->setPen(QPen(QBrush(),0));
	scene()->addItem(diveBg);

#define ADDBTN(obj, icon, text, horizontal, vertical, tooltip, value, slot) \
	obj = new Button(); \
	obj->setPixmap(QPixmap(icon)); \
	obj->setPos(fromPercent(horizontal, Qt::Horizontal), fromPercent(vertical, Qt::Vertical)); \
	obj->setToolTip(QString(tooltip.arg(value))); \
	scene()->addItem(obj); \
	connect(obj, SIGNAL(clicked()), this, SLOT(slot));

	QString incrText;
	if (prefs.units.length == units::METERS)
		incrText = tr("10m");
	else
		incrText = tr("30ft");
	ADDBTN(plusDepth, ":plus",   ""  , 5,  5, tr("Increase maximum depth by %1"), incrText, increaseDepth());
	ADDBTN(lessDepth, ":minimum",""  , 2,  5, tr("Decreases maximum depth by %1"), incrText, decreaseDepth());
	ADDBTN(plusTime,  ":plus",   ""  , 95, 95, tr("Increase minimum time by %1"), tr("10min"), increaseTime());
	ADDBTN(lessTime,  ":minimum",""  , 92, 95, tr("Decreases minimum time by %1"), tr("10min"), decreaseTime());
#undef ADDBTN
	minMinutes = TIME_INITIAL_MAX;

	QAction *action = NULL;

#define ADD_ACTION( SHORTCUT, Slot ) \
	action = new QAction(this); \
	action->setShortcut( SHORTCUT ); \
	action->setShortcutContext(Qt::WindowShortcut); \
	addAction(action); \
	connect(action, SIGNAL(triggered(bool)), this, SLOT( Slot ))

	ADD_ACTION(Qt::Key_Escape, keyEscAction());
	ADD_ACTION(Qt::Key_Delete, keyDeleteAction());
	ADD_ACTION(Qt::Key_Up, keyUpAction());
	ADD_ACTION(Qt::Key_Down, keyDownAction());
	ADD_ACTION(Qt::Key_Left, keyLeftAction());
	ADD_ACTION(Qt::Key_Right, keyRightAction());
#undef ADD_ACTION

	// Prepare the stuff for the gas-choices.
	gasListView = new QListView();
	gasListView->setWindowFlags(Qt::Popup);
	gasListView->setModel(airTypes());
	gasListView->hide();
	gasListView->installEventFilter(this);

	connect(gasListView, SIGNAL(activated(QModelIndex)), this, SLOT(selectGas(QModelIndex)));
	connect(plannerModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(drawProfile()));

	connect(plannerModel, SIGNAL(rowsInserted(const QModelIndex&,int,int)),
			this, SLOT(pointInserted(const QModelIndex&, int, int)));
	connect(plannerModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
			this, SLOT(pointsRemoved(const QModelIndex&, int, int)));
	setRenderHint(QPainter::Antialiasing);
}
void QHexEdit::dataChangedPrivate(int)
{
    _modified = _undoStack->index() != 0;
    adjust();
    emit dataChanged();
}
Exemple #25
0
void HistoryFilterModel::sourceDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
{
    emit dataChanged(mapFromSource(topLeft), mapFromSource(bottomRight));
}
Exemple #26
0
/**************************************************************************
  Notifies that row has been changed
**************************************************************************/
void plr_model::notify_plr_changed(int row)
{
  emit dataChanged(index(row, 0), index(row, columnCount() - 1));
}
void TorrentListModel::refresh(){
    if(m_Info->size() > m_OldRowCount) insertRows(0,m_Info->size() - m_OldRowCount);
    m_OldRowCount = rowCount();
    emit dataChanged(index(0,0), index(rowCount(), columnCount()));
}
Exemple #28
0
BBEditor::BBEditor( BBTrackContainer* tc ) :
	Editor(false),
	m_trackContainerView( new BBTrackContainerView(tc) )
{
	setWindowIcon( embed::getIconPixmap( "bb_track_btn" ) );
	setWindowTitle( tr( "Beat+Bassline Editor" ) );
	setCentralWidget(m_trackContainerView);

	setAcceptDrops(true);
	m_toolBar->setAcceptDrops(true);
	connect(m_toolBar, SIGNAL(dragEntered(QDragEnterEvent*)), m_trackContainerView, SLOT(dragEnterEvent(QDragEnterEvent*)));
	connect(m_toolBar, SIGNAL(dropped(QDropEvent*)), m_trackContainerView, SLOT(dropEvent(QDropEvent*)));

	// TODO: Use style sheet
	if( ConfigManager::inst()->value( "ui",
					  "compacttrackbuttons" ).toInt() )
	{
		setMinimumWidth( TRACK_OP_WIDTH_COMPACT + DEFAULT_SETTINGS_WIDGET_WIDTH_COMPACT
			     + 2 * TCO_BORDER_WIDTH + 264 );
	}
	else
	{
		setMinimumWidth( TRACK_OP_WIDTH + DEFAULT_SETTINGS_WIDGET_WIDTH
			     + 2 * TCO_BORDER_WIDTH + 264 );
	}


	m_playAction->setToolTip(tr( "Play/pause current beat/bassline (Space)" ));
	m_stopAction->setToolTip(tr( "Stop playback of current beat/bassline (Space)" ));

	m_playAction->setWhatsThis(
		tr( "Click here to play the current "
			"beat/bassline.  The beat/bassline is automatically "
			"looped when its end is reached." ) );
	m_stopAction->setWhatsThis(
		tr( "Click here to stop playing of current "
							"beat/bassline." ) );


	// Beat selector
	DropToolBar *beatSelectionToolBar = addDropToolBarToTop(tr("Beat selector"));

	m_bbComboBox = new ComboBox( m_toolBar );
	m_bbComboBox->setFixedSize( 200, 22 );
	m_bbComboBox->setModel( &tc->m_bbComboBoxModel );

	beatSelectionToolBar->addWidget( m_bbComboBox );


	// Track actions
	DropToolBar *trackAndStepActionsToolBar = addDropToolBarToTop(tr("Track and step actions"));


	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"),
						 Engine::getSong(), SLOT(addBBTrack()));
	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_automation"), tr("Add automation-track"),
						 m_trackContainerView, SLOT(addAutomationTrack()));

	QWidget* stretch = new QWidget(m_toolBar);
	stretch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
	trackAndStepActionsToolBar->addWidget(stretch);


	// Step actions
	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_remove"), tr("Remove steps"),
						 m_trackContainerView, SLOT(removeSteps()));
	trackAndStepActionsToolBar->addAction(embed::getIconPixmap("step_btn_add"), tr("Add steps"),
						 m_trackContainerView, SLOT( addSteps()));
	trackAndStepActionsToolBar->addAction( embed::getIconPixmap( "step_btn_duplicate" ), tr( "Clone Steps" ),
						  m_trackContainerView, SLOT( cloneSteps() ) );

	connect( &tc->m_bbComboBoxModel, SIGNAL( dataChanged() ),
			m_trackContainerView, SLOT( updatePosition() ) );


	QAction* viewNext = new QAction(this);
	connect(viewNext, SIGNAL(triggered()), m_bbComboBox, SLOT(selectNext()));
	viewNext->setShortcut(Qt::Key_Plus);
	addAction(viewNext);

	QAction* viewPrevious = new QAction(this);
	connect(viewPrevious, SIGNAL(triggered()), m_bbComboBox, SLOT(selectPrevious()));
	viewPrevious->setShortcut(Qt::Key_Minus);
	addAction(viewPrevious);
}
Exemple #29
0
/*!
    \since 5.0

    Refreshes \a row in the model with values from the database table row matching
    on primary key values. Without a primary key, all column values must match. If
    no matching row is found, the model will show an empty row.

    Returns \c true if successful; otherwise returns \c false.

    \sa select()
*/
bool QSqlTableModel::selectRow(int row)
{
    Q_D(QSqlTableModel);

    if (row < 0 || row >= rowCount())
        return false;

    const int table_sort_col = d->sortColumn;
    d->sortColumn = -1;
    const QString table_filter = d->filter;
    d->filter = d->db.driver()->sqlStatement(QSqlDriver::WhereStatement,
                                              d->tableName,
                                              primaryValues(row),
                                              false);
    static const QString wh = Sql::where() + Sql::sp();
    if (d->filter.startsWith(wh, Qt::CaseInsensitive))
        d->filter.remove(0, wh.length());

    QString stmt;

    if (!d->filter.isEmpty())
        stmt = selectStatement();

    d->sortColumn = table_sort_col;
    d->filter = table_filter;

    if (stmt.isEmpty())
        return false;

    bool exists;
    QSqlRecord newValues;

    {
        QSqlQuery q(d->db);
        q.setForwardOnly(true);
        if (!q.exec(stmt))
            return false;

        exists = q.next();
        newValues = q.record();
    }

    bool needsAddingToCache = !exists || d->cache.contains(row);

    if (!needsAddingToCache) {
        const QSqlRecord curValues = record(row);
        needsAddingToCache = curValues.count() != newValues.count();
        if (!needsAddingToCache) {
            // Look for changed values. Primary key fields are customarily first
            // and probably change less often than other fields, so start at the end.
            for (int f = curValues.count() - 1; f >= 0; --f) {
                if (curValues.value(f) != newValues.value(f)) {
                    needsAddingToCache = true;
                    break;
                }
            }
        }
    }

    if (needsAddingToCache) {
        d->cache[row].refresh(exists, newValues);
        emit headerDataChanged(Qt::Vertical, row, row);
        emit dataChanged(createIndex(row, 0), createIndex(row, columnCount() - 1));
    }

    return true;
}
HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) :
    HbView(parent),
    mForm(new HbDataForm(this)),
    mModel(new HbDataFormModel(this)),
    mContentReady(false),
    mUpdateWidgetSize(true)
{
    HbAction *backAction = new HbAction(Hb::BackNaviAction);
    connect(backAction, SIGNAL(triggered()), SIGNAL(optionsClosed()));
    setNavigationAction(backAction);

    HbDataFormModelItem *item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, WIDGET_TYPE);
    item->setContentWidgetData(QString("items"), QStringList("Grid") << "Coverflow" << "T-Bone");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, SCROLLBAR_VISIBILITY);
    item->setContentWidgetData(QString("items"), QStringList("Autohide") << "Always on" << "Always off");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, INTERACTIVE_SCROLLBAR);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, MODEL_IMAGE_TYPE);
    item->setContentWidgetData(QString("items"), QStringList("QImage") << "HbIcon" << "QIcon" << "QPixmap");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::TextItem, WIDGET_HEIGHT);
    item->setContentWidgetData(QString("text"), QString("0"));
    item->setContentWidgetData(QString("inputMethodHints"), Qt::ImhDigitsOnly);

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::TextItem, WIDGET_WIDTH);
    item->setContentWidgetData(QString("text"), QString("0"));
    item->setContentWidgetData(QString("inputMethodHints"), Qt::ImhDigitsOnly);

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, LOW_RES_IMAGES);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, TITLE_FONT);
    item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ComboBoxItem, DESCRIPTION_FONT);
    item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital");

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, REFLECTIONS_ENABLED);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));

    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, EFFECT3D_ENABLED);
    item->setContentWidgetData(QString("text"), QString("no"));
    item->setContentWidgetData(QString("additionalText"), QString("yes"));
    
    item = mModel->appendDataFormItem(
        HbDataFormModelItem::ToggleValueItem, ITEM_SIZE_POLICY);
    item->setContentWidgetData(QString("text"), QString("User defined"));
    item->setContentWidgetData(QString("additionalText"), QString("Automatic"));

    connect(mModel, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(updateData(QModelIndex, QModelIndex)));
    mForm->setModel(mModel);

    setupData();
    mContentReady = true;

    QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
    layout->addItem(mForm);
    setLayout(layout);
}