コード例 #1
0
KMixWindow::KMixWindow(bool invisible) :
    KXmlGuiWindow(0, Qt::WindowContextHelpButtonHint),
    m_multiDriverMode(false), // -<- I never-ever want the multi-drivermode to be activated by accident
    m_dockWidget(), m_dsm(0), m_dontSetDefaultCardOnStart(false)
{
  setObjectName(QLatin1String("KMixWindow"));
  // disable delete-on-close because KMix might just sit in the background waiting for cards to be plugged in
  setAttribute(Qt::WA_DeleteOnClose, false);

  initActions(); // init actions first, so we can use them in the loadConfig() already
  loadConfig(); // Load config before initMixer(), e.g. due to "MultiDriver" keyword
  initActionsLate(); // init actions that require a loaded config
  KGlobal::locale()->insertCatalog(QLatin1String("kmix-controls"));
  initWidgets();
  initPrefDlg();
  DBusMixSetWrapper::initialize(this, "/Mixers");
  MixerToolBox::instance()->initMixer(m_multiDriverMode, m_backendFilter,
      m_hwInfoString);
  KMixDeviceManager *theKMixDeviceManager = KMixDeviceManager::instance();
  initActionsAfterInitMixer(); // init actions that require initialized mixer backend(s).

  recreateGUI(false);
  if (m_wsMixers->count() < 1)
    {
      // Something is wrong. Perhaps a hardware or driver or backend change. Let KMix search harder
      recreateGUI(false, QString(), true);
    }

  if (!kapp->isSessionRestored() ) // done by the session manager otherwise
  setInitialSize();

  fixConfigAfterRead();
  theKMixDeviceManager->initHotplug();
  connect(theKMixDeviceManager, SIGNAL(plugged(const char*,QString,QString&)),
      SLOT (plugged(const char*,QString,QString&)));
  connect(theKMixDeviceManager, SIGNAL(unplugged(QString)),
      SLOT (unplugged(QString)));
  if (m_startVisible && !invisible)
    show(); // Started visible

  connect(kapp, SIGNAL(aboutToQuit()), SLOT(saveConfig()) );

  ControlManager::instance().addListener(
  	  QString(), // All mixers (as the Global master Mixer might change)
  	(ControlChangeType::Type)(ControlChangeType::ControlList | ControlChangeType::MasterChanged),
  	this,
  	QString("KMixWindow")
  	);

  // Send an initial volume refresh (otherwise all volumes are 0 until the next change)
  ControlManager::instance().announce(QString(), ControlChangeType::Volume, QString("Startup"));
}
コード例 #2
0
ファイル: playlistwindow.cpp プロジェクト: tmarques/waheela
void PlaylistWindow::slotToggleMenu() //SLOT
{
    if( static_cast<KToggleAction *>(actionCollection()->action(KStdAction::name(KStdAction::ShowMenubar)))->isChecked() ) {
        AmarokConfig::setShowMenuBar( true );
        m_menubar->setShown( true );

        if( amaroK::actionCollection()->action( "amarok_menu" )->isPlugged() )
            amaroK::actionCollection()->action( "amarok_menu" )->unplugAll();
    }
    else
    {
        AmarokConfig::setShowMenuBar( false );
        m_menubar->setShown( false );
        recreateGUI();
    }
}
コード例 #3
0
void
KMixWindow::recreateGUI(bool saveConfig)
{
  recreateGUI(saveConfig, QString(), false);
}
コード例 #4
0
void
KMixWindow::recreateGUIwithSavingView()
{
//  saveViewConfig();
  recreateGUI(true);
}