Beispiel #1
0
/*******************************************************************************
    initScene
*******************************************************************************/
void SettingsScene::initScene()
{
    // create pages
    m_pages[SETTINGS::GENERAL]   = new PageGeneral(parentView());
    m_pages[SETTINGS::PLAYER]    = new PagePlayer(parentView());
    m_pages[SETTINGS::LIBRARY]   = new PageLibrary(parentView());
    m_pages[SETTINGS::SHORTCUT]  = new PageShortcut(parentView());
    m_pages[SETTINGS::SCROBBLER] = new PageScrobbler(parentView());
    m_pages[SETTINGS::SONGINFO]  = new PageSongInfo(parentView());

    /* first init => always restore settings */
    restore_settings();
    
    /*  layout */
    m_layout    = new QGraphicsLinearLayout(Qt::Vertical);
    m_layout->setSpacing(10);
    m_layout->addItem( m_pages.value(SETTINGS::GENERAL) );
    m_layout->addItem( m_pages.value(SETTINGS::PLAYER) );
    m_layout->addItem( m_pages.value(SETTINGS::LIBRARY) );
    m_layout->addItem( m_pages.value(SETTINGS::SHORTCUT) );
    m_layout->addItem( m_pages.value(SETTINGS::SONGINFO) );
    m_layout->addItem( m_pages.value(SETTINGS::SCROBBLER) );

    m_container = new QGraphicsWidget();
    m_container->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    m_container->setLayout(m_layout);
    m_container->setPos(0,0);
    this->addItem(m_container);

    /* il faut interdire la modification des parametres de collection si un database builder est en cours */
    connect(ThreadManager::instance(), SIGNAL(dbBuildStart()), this, SLOT(slot_dbBuilder_stateChange()));
    connect(ThreadManager::instance(), SIGNAL(dbBuildFinished()), this, SLOT(slot_dbBuilder_stateChange()));

    connect(Database::instance(), SIGNAL(settingsChanged()), this, SLOT(slot_database_settingsChanged()));
    
    connect(MainLeftWidget::instance(), SIGNAL(dbNameChanged()), this, SLOT(slot_database_settingsChanged()));
    connect(MainLeftWidget::instance(), SIGNAL(settings_save_clicked()), this, SLOT(slot_apply_settings()));
    connect(MainLeftWidget::instance(), SIGNAL(settings_cancel_clicked()), this, SLOT(slot_cancel_settings()));
        
    
    connect(m_pages[SETTINGS::GENERAL], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::PLAYER], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::LIBRARY], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SHORTCUT], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SCROBBLER], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SONGINFO], SIGNAL(layout_changed()), this, SLOT(populateScene()));    
    
    setInit(true);
}
Beispiel #2
0
/*******************************************************************************
    initScene
*******************************************************************************/
void SettingsScene::initScene()
{
    // create pages
    m_pages[SETTINGS::GENERAL]   = new PageGeneral(parentView());
    m_pages[SETTINGS::PLAYER]    = new PagePlayer(parentView());
    m_pages[SETTINGS::LIBRARY]   = new PageLibrary(parentView());
    m_pages[SETTINGS::SHORTCUT]  = new PageShortcut(parentView());
    m_pages[SETTINGS::SCROBBLER] = new PageScrobbler(parentView());
    m_pages[SETTINGS::SONGINFO]  = new PageSongInfo(parentView());

    connect(m_pages[SETTINGS::GENERAL], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::PLAYER], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::LIBRARY], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SHORTCUT], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SCROBBLER], SIGNAL(layout_changed()), this, SLOT(populateScene()));
    connect(m_pages[SETTINGS::SONGINFO], SIGNAL(layout_changed()), this, SLOT(populateScene()));

    m_header = new HeaderItem(qobject_cast<QGraphicsView*> (parentView())->viewport());
    m_header->setText( tr("Settings") );

    /* bottom widget */
    m_bottomWidget  = new BottomWidget();
    connect(m_bottomWidget, SIGNAL(save_clicked()), this, SLOT(slot_apply_settings()));
    connect(m_bottomWidget, SIGNAL(cancel_clicked()), this, SLOT(slot_cancel_settings()));
    
    
    this->addItem(m_header);
    this->addItem(m_pages.value(SETTINGS::GENERAL));
    this->addItem(m_pages.value(SETTINGS::PLAYER));
    this->addItem(m_pages.value(SETTINGS::LIBRARY));
    this->addItem(m_pages.value(SETTINGS::SHORTCUT));
    this->addItem(m_pages.value(SETTINGS::SCROBBLER));
    this->addItem(m_pages.value(SETTINGS::SONGINFO));

    /* first init => always restore settings */
    restore_settings();

    /* il faut interdire la modification des parametres de collection si un database builder est en cours */
    connect(ThreadManager::instance(), SIGNAL(dbBuildStart()), this, SLOT(slot_dbBuilder_stateChange()));
    connect(ThreadManager::instance(), SIGNAL(dbBuildFinished()), this, SLOT(slot_dbBuilder_stateChange()));
    
    setInit(true);
}