void TabbedOptionsDialog::openFromXML() { QString fileName = QFileDialog::getOpenFileName(this,"Open plant","","Plants (*.plant);;XML files (*.xml)"); if (!(fileName.isEmpty() || fileName.isNull())) { Plant::activePlant = PersistenceManager::readPlant(fileName); Scene::activeScene->initScene(); reloadTabs(); emit cameraChanged(Plant::activePlant->movement.x(), Plant::activePlant->movement.y(), Plant::activePlant->movement.z()); } }
void TabbedOptionsDialog::newPlant() { NewDialog *newDialog = new NewDialog; newDialog->setModal(true); int result = newDialog->exec(); if (result == QDialog::Accepted) { reloadTabs(); emit cameraChanged(Plant::activePlant->movement.x(), Plant::activePlant->movement.y(), Plant::activePlant->movement.z()); } }
/** * \brief Initialization * * Initializes the TabsApplet with default parameters */ void TabsApplet::init() { // applet base initialization Context::Applet::init(); // create the header label enableHeader( true ); setHeaderText( i18nc( "Guitar tablature", "Tabs" ) ); // creates the tab view m_tabsView = new TabsView( this ); // Set the collapse size setCollapseOffHeight( -1 ); setCollapseHeight( m_header->height() ); setMinimumHeight( collapseHeight() ); setPreferredHeight( collapseHeight() ); // create the reload icon QAction* reloadAction = new QAction( this ); reloadAction->setIcon( KIcon( "view-refresh" ) ); reloadAction->setVisible( true ); reloadAction->setEnabled( true ); reloadAction->setText( i18nc( "Guitar tablature", "Reload tabs" ) ); m_reloadIcon = addLeftHeaderAction( reloadAction ); m_reloadIcon.data()->setEnabled( false ); connect( m_reloadIcon.data(), SIGNAL(clicked()), this, SLOT(reloadTabs()) ); // create the settings icon QAction* settingsAction = new QAction( this ); settingsAction->setIcon( KIcon( "preferences-system" ) ); settingsAction->setEnabled( true ); settingsAction->setText( i18n( "Settings" ) ); QWeakPointer<Plasma::IconWidget> settingsIcon = addRightHeaderAction( settingsAction ); connect( settingsIcon.data(), SIGNAL(clicked()), this, SLOT(showConfigurationInterface()) ); m_layout = new QGraphicsLinearLayout( Qt::Vertical ); m_layout->addItem( m_header ); m_layout->addItem( m_tabsView ); setLayout( m_layout ); // read configuration data and update the engine. KConfigGroup config = Amarok::config("Tabs Applet"); m_fetchGuitar = config.readEntry( "FetchGuitar", true ); m_fetchBass = config.readEntry( "FetchBass", true ); Plasma::DataEngine *engine = dataEngine( "amarok-tabs" ); engine->setProperty( "fetchGuitarTabs", m_fetchGuitar ); engine->setProperty( "fetchBassTabs", m_fetchBass ); engine->connectSource( "tabs", this ); updateInterface( InitState ); }
void TabbedOptionsDialog::refreshData() { reloadTabs(); }