void TestSqlTrack::testSetAllValuesBatch() { { Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/IDoNotExist.mp3" ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); QSignalSpy spy( m_collection, SIGNAL(updated())); MetaNotificationSpy metaSpy; metaSpy.subscribeTo( track1 ); sqlTrack1->beginUpdate(); setAllValues( sqlTrack1 ); QCOMPARE( metaSpy.notificationsFromTracks().count(), 1 ); // add label does one notify sqlTrack1->endUpdate(); QCOMPARE( metaSpy.notificationsFromTracks().count(), 2 ); // only one notificate for all the changes getAllValues( sqlTrack1 ); } // and also after empty cache m_collection->registry()->emptyCache(); { Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/new_url" ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); QVERIFY( track1 ); getAllValues( sqlTrack1 ); } }
void TestSqlTrack::testSetAllValuesSingleNotExisting() { { // get a new track Meta::TrackPtr track1 = m_collection->registry()->getTrack( -1, "./IamANewTrack.mp3", 1, "1e34fb213489" ); QSignalSpy spy( m_collection, SIGNAL(updated())); MetaNotificationSpy metaSpy; metaSpy.subscribeTo( track1 ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); setAllValues( sqlTrack1 ); getAllValues( sqlTrack1 ); // new track should have an up-to-date create time (not more than 3 seconds old) QVERIFY( track1->createDate().secsTo(QDateTime::currentDateTime()) < 3 ); QVERIFY( metaSpy.notificationsFromTracks().count() > 1 ); // we should be notified about the changes } // and also after empty cache m_collection->registry()->emptyCache(); { Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/new_url" ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); QVERIFY( track1 ); getAllValues( sqlTrack1 ); } }
FullInterface::FullInterface(mopo::control_map controls, mopo::output_map modulation_sources, mopo::output_map mono_modulations, mopo::output_map poly_modulations, MidiKeyboardState* keyboard_state) : SynthSection("full_interface") { addSubSection(synthesis_interface_ = new SynthesisInterface(controls, keyboard_state)); addSubSection(arp_section_ = new ArpSection("ARP")); addSlider(beats_per_minute_ = new SynthSlider("beats_per_minute")); beats_per_minute_->setSliderStyle(Slider::LinearBar); beats_per_minute_->setTextBoxStyle(Slider::TextBoxAbove, false, 150, 20); beats_per_minute_->setColour(Slider::textBoxTextColourId, Colours::white); addAndMakeVisible(global_tool_tip_ = new GlobalToolTip()); addAndMakeVisible(patch_selector_ = new PatchSelector()); addAndMakeVisible(oscilloscope_ = new Oscilloscope()); setAllValues(controls); createModulationSliders(modulation_sources, mono_modulations, poly_modulations); logo_button_ = new ImageButton("logo_button"); const Desktop::Displays::Display& display = Desktop::getInstance().getDisplays().getMainDisplay(); if (display.scale > 1.5) { Image helm = ImageCache::getFromMemory(BinaryData::helm_icon_128_2x_png, BinaryData::helm_icon_128_2x_pngSize); logo_button_->setImages(false, true, false, helm, 1.0, Colours::transparentBlack, helm, 1.0, Colour(0x11ffffff), helm, 1.0, Colour(0x11000000)); } else { Image helm_small = ImageCache::getFromMemory(BinaryData::helm_icon_32_2x_png, BinaryData::helm_icon_32_2x_pngSize); logo_button_->setImages(false, true, false, helm_small, 1.0, Colours::transparentBlack, helm_small, 1.0, Colour(0x11ffffff), helm_small, 1.0, Colour(0x11000000)); } addAndMakeVisible(logo_button_); logo_button_->addListener(this); addChildComponent(patch_browser_ = new PatchBrowser()); patch_selector_->setBrowser(patch_browser_); addChildComponent(save_section_ = new SaveSection("save_section")); patch_browser_->setSaveSection(save_section_); patch_selector_->setSaveSection(save_section_); addChildComponent(delete_section_ = new DeleteSection("delete_section")); patch_browser_->setDeleteSection(delete_section_); about_section_ = new AboutSection("about"); addChildComponent(about_section_); update_check_section_ = new UpdateCheckSection("update_check"); addChildComponent(update_check_section_); setOpaque(true); }
CHolonomicPathNode::CHolonomicPathNode(int theType, const C7Vector& conf, const C4Vector& rotAxisRot, const C4Vector& rotAxisRotInv) { _rotAxisRot = rotAxisRot; _rotAxisRotInv = rotAxisRotInv; parent = NULL; _nodeType = theType; values = NULL; int s = getSize(); values = new float[s]; setAllValues(conf.X, conf.Q); }
void VoxelField::setSpheres( float phase ) { setAllValues( -0.5f ); float x = 0.3 * getSizeX() * sin(phase*0.1) + 0.5 * getSizeX(); float y = 0.3 * getSizeY() * cos(phase*0.2) + 0.5 * getSizeY(); float z = 0.3 * getSizeZ() * sin(1+phase*0.15) + 0.5 * getSizeZ(); float rad = getSizeX() / 3; addSphere( x, y, z, rad ); addSphere( y, z, x, rad ); addSphere( z, x, y, rad ); addSphere( z, y, x, rad ); addSphere( y, x, z, rad ); addSphere( x, z, y, rad ); }
void TestSqlTrack::testUnsetValues() { { Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/IDoNotExist.mp3" ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); setAllValues( sqlTrack1 ); // now unset the values again sqlTrack1->setAlbum( "" ); sqlTrack1->setArtist( "" ); sqlTrack1->setComposer( "" ); sqlTrack1->setYear( 0 ); // it is not clear what an empty year exactly is sqlTrack1->setGenre( "" ); // note: Amarok is still not clear if an empty artist means track->artist() == 0 QVERIFY( !track1->album() || track1->album()->name().isEmpty() ); QVERIFY( !track1->artist() || track1->artist()->name().isEmpty() ); QVERIFY( !track1->composer() || track1->composer()->name().isEmpty() ); QVERIFY( !track1->year() || track1->year()->year() == 0 ); QVERIFY( !track1->genre() || track1->genre()->name().isEmpty() ); } // and also after empty cache m_collection->registry()->emptyCache(); { Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/new_url" ); QVERIFY( track1 ); QVERIFY( !track1->album() || track1->album()->name().isEmpty() ); QVERIFY( !track1->artist() || track1->artist()->name().isEmpty() ); QVERIFY( !track1->composer() || track1->composer()->name().isEmpty() ); QVERIFY( !track1->year() || track1->year()->year() == 0 ); QVERIFY( !track1->genre() || track1->genre()->name().isEmpty() ); } }
/// Send a signal to set all parameters to the value in the editor. void LocalParameterEditor::setAll() { double value = m_editor->text().toDouble(); emit setAllValues(value); }
/** Set all track values but before that create them in the registry. */ void TestSqlTrack::testSetAllValuesSingleExisting() { { Meta::GenrePtr genre = m_collection->registry()->getGenre( "New Genre" ); Meta::ComposerPtr composer = m_collection->registry()->getComposer( "New Composer" ); Meta::YearPtr year = m_collection->registry()->getYear( 1999 ); Meta::AlbumPtr album = m_collection->registry()->getAlbum( "New Album", "New Artist" ); m_collection->registry()->getLabel( "New Label" ); Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/IDoNotExist.mp3" ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); setAllValues( sqlTrack1 ); getAllValues( sqlTrack1 ); // check that the existing object are really updated with the new tracklist QCOMPARE( genre->tracks().count(), 1 ); QCOMPARE( genre->tracks().first().data(), track1.data() ); QCOMPARE( composer->tracks().count(), 1 ); QCOMPARE( composer->tracks().first().data(), track1.data() ); QCOMPARE( year->tracks().count(), 1 ); QCOMPARE( year->tracks().first().data(), track1.data() ); // the logic, how renaming the track artist influences its album is still // unfinished. For sure the track must be in an album with the defined // name QCOMPARE( sqlTrack1->album()->name(), QString("New Album") ); QCOMPARE( sqlTrack1->album()->tracks().count(), 1 ); QCOMPARE( sqlTrack1->album()->tracks().first().data(), track1.data() ); } // and also after empty cache m_collection->registry()->emptyCache(); { Meta::TrackPtr track1 = m_collection->registry()->getTrack( "/new_url" ); Meta::SqlTrack *sqlTrack1 = static_cast<Meta::SqlTrack*>( track1.data() ); QVERIFY( track1 ); getAllValues( sqlTrack1 ); Meta::GenrePtr genre = m_collection->registry()->getGenre( "New Genre" ); Meta::ComposerPtr composer = m_collection->registry()->getComposer( "New Composer" ); Meta::YearPtr year = m_collection->registry()->getYear( 1999 ); Meta::AlbumPtr album = m_collection->registry()->getAlbum( "New Album", "New Artist" ); // check that the existing object are really updated with the new tracklist QCOMPARE( genre->tracks().count(), 1 ); QCOMPARE( genre->tracks().first().data(), track1.data() ); QCOMPARE( composer->tracks().count(), 1 ); QCOMPARE( composer->tracks().first().data(), track1.data() ); QCOMPARE( year->tracks().count(), 1 ); QCOMPARE( year->tracks().first().data(), track1.data() ); // the logic, how renaming the track artist influences its album is still // unfinished. For sure the track must be in an album with the defined // name QCOMPARE( sqlTrack1->album()->name(), QString("New Album") ); QCOMPARE( sqlTrack1->album()->tracks().count(), 1 ); QCOMPARE( sqlTrack1->album()->tracks().first().data(), track1.data() ); } }