예제 #1
0
SysTrayIconWrapper::SysTrayIconWrapper(const MainView& view, const PlayListManager& playlists):
    QObject(),
    mPlaylists(playlists),
    mSystemTrayIcon(QIcon(":/nocturn.png")),
    mSystemTrayMenu(),
    mPlayAction(QIcon::fromTheme("media-playback-start"), tr("Play"), nullptr),
    mStopAction(QIcon::fromTheme("media-playback-stop"), tr("Stop"), nullptr),
    mStatus(SharedTypes::StoppedState)
{
    connect(SettingsManager::getSettingsManager(), SIGNAL(ConfigurationUpdated()), this, SLOT(rebuildMenu()));
    connect(SettingsManager::getSettingsManager(), SIGNAL(ConfigurationUpdated()), this, SLOT(updateTrayVisibility()));
    connect(&mSystemTrayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), &view, SLOT(toggleWindowVisiblity(QSystemTrayIcon::ActivationReason)));

    connect(&mPlaylists, SIGNAL(CurrentSongChanged(const QString&)), this, SLOT(rebuildMenu()));
    connect(&mPlaylists, SIGNAL(ActivePlayListChanged()), this, SLOT(rebuildMenu()));
    connect(&mPlaylists, SIGNAL(TrackListChanged()), this, SLOT(rebuildMenu()));

    connect(&mPlayAction, SIGNAL(triggered(bool)), MainControler::getMainControler(), SLOT(startPlayback()));
    connect(&mStopAction, SIGNAL(triggered(bool)), MainControler::getMainControler(), SLOT(stopPlayback()));

    connect(MainControler::getMainControler(), SIGNAL(StatusChanged(SharedTypes::PlaybackState, SharedTypes::PlaybackState)),
            this, SLOT(changeStatus(SharedTypes::PlaybackState, SharedTypes::PlaybackState)));

    updateTrayVisibility();
    rebuildMenu();
    mSystemTrayIcon.setContextMenu(&mSystemTrayMenu);
}
예제 #2
0
cTrayIcon::cTrayIcon(cDataManager *DataManager):QSystemTrayIcon()
{    
    m_DataManager = DataManager;
    rebuildMenu();

    connect(&m_ProfilesMenu, SIGNAL(triggered(QAction*)), this, SLOT(onMenuSelection(QAction*)));
    m_ProfilesMenu.setTitle(tr("Profiles"));

    connect(&m_Menu, SIGNAL(triggered(QAction*)), this, SLOT(onMenuSelection(QAction*)));
    setContextMenu(&m_Menu);
    m_Menu.addAction(tr("Applications..."))->setData("APPLICATIONS");
    m_Menu.addAction(tr("Statistic..."))->setData("STATISTIC");
    m_Menu.addSeparator();
    m_Menu.addAction(tr("Settings..."))->setData("SETTINGS");
    m_Menu.addSeparator();
#ifdef Q_OS_WIN
    m_Menu.addMenu(&m_ProfilesMenu);
#else
    m_Menu.addAction(m_ProfilesMenu.title()+" ►")->setData("PROFILES");
#endif
    m_Menu.addSeparator();
    m_Menu.addAction(tr("About..."))->setData("ABOUT");
    m_Menu.addSeparator();
    m_Menu.addAction(tr("Exit"))->setData("EXIT");


    setActive();
    show();
}
예제 #3
0
void StreamsMenuWrapper::storeMenu(QMenu* menu)
{
  mMenu = menu;
  //can't be done in the constructor
  connect (SettingsManager::getSettingsManager(), SIGNAL(streamsChanged()), this, SLOT(rebuildMenu()));
  rebuildMenu();
}
예제 #4
0
void SysTrayIconWrapper::changeStatus(SharedTypes::PlaybackState newStatus, SharedTypes::PlaybackState oldStatus)
{
    mStatus = newStatus;
    if (mStatus == SharedTypes::StoppedState &&
	mPlaylists.getActiveModel() != mPlaylists.getCurrentModel())
    {
        rebuildMenu();
    }
}
예제 #5
0
파일: sysmenu.cpp 프로젝트: gnuton/QDe
SystemMenu::SystemMenu(Adx *a, Panel *p, QWidget *parent)
	: GenericButton(p, parent) 
{
	app = a;

	setFixedWidth(28);

	setIconSize(QSize(17, 16));
	setImages(QPixmap(":/default/ame-logo.png"), QPixmap(":/default/ame-logo-active.png"));
	rebuildMenu();
}
예제 #6
0
void MSOptionPopupMenu::update(const MSIndexVector& index_)
{
  if (MSView::model()!=0)
   {
     if (index_.length()==0)
      {
	if (optionsModel().length()==itemCount())
	 {
	   MSMenuItem *mi;
           int i,n=itemCount();
           for(i=0;i<n;i++)
	    {
	      mi=(MSMenuItem *)itemVector()(i);
	      mi->label(optionsModel()(i));
	    }
	   computeSize();
	   optionMenu()->setSelectedItem(0);
	   optionMenu()->computeSize();
	 }
	else rebuildMenu();
      }
     else 
      {
	MSIndexVector iv(index_);
	iv.sortUp();
	if (iv(0)==itemCount())
	 {
	   for (unsigned i=0,j=itemCount();i<iv.length();i++,j++)
	    {
	      MSMenuItem *pMenuItem=new MSMenuItem(this,optionsModel()(j),0,j);
	      setItem(pMenuItem,j);
	    }
	 }
	else
	 {
	   for (unsigned i=0;i<iv.length();i++)
	    {
	      unsigned index=iv(i);
	      MSMenuItem *mi=menuItem(index);
	      if (mi!=0) mi->label(optionsModel()(index));
	    }
	 }
      }
     computeSize();
     optionMenu()->computeSize();
   }
}
예제 #7
0
UbuntuTray::UbuntuTray(Main *qtnote, QObject *parent) :
    TrayImpl(parent),
    qtnote(qtnote),
    contextMenu(0)
{
    menuUpdateTimer = new QTimer(this);
    menuUpdateTimer->setInterval(1000);
    menuUpdateTimer->setSingleShot(true);
    connect(menuUpdateTimer, SIGNAL(timeout()), SLOT(rebuildMenu()));

    sti = new QSystemTrayIcon(QIcon::fromTheme("qtnote", QIcon(":/icons/trayicon")), this);
    connect(sti, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SIGNAL(newNoteTriggered()));

    actQuit = new QAction(QIcon(":/icons/exit"), tr("&Quit"), this);
    actNew = new QAction(QIcon(":/icons/new"), tr("&New"), this);
    actAbout = new QAction(QIcon(":/icons/trayicon"), tr("&About"), this);
    actOptions = new QAction(QIcon(":/icons/options"), tr("&Options"), this);
    actManager = new QAction(QIcon(":/icons/manager"), tr("&Note Manager"), this);

    connect(actQuit, SIGNAL(triggered()), SIGNAL(exitTriggered()));
    connect(actNew, SIGNAL(triggered()), SIGNAL(newNoteTriggered()));
    connect(actManager, SIGNAL(triggered()), SIGNAL(noteManagerTriggered()));
    connect(actOptions, SIGNAL(triggered()), SIGNAL(optionsTriggered()));
    connect(actAbout, SIGNAL(triggered()), SIGNAL(aboutTriggered()));

    advancedMenu = new QMenu;
    advancedMenu->addAction(actOptions);
    advancedMenu->addAction(actManager);
    advancedMenu->addAction(actAbout);
    advancedMenu->addSeparator();
    advancedMenu->addAction(actQuit);
    advancedMenu->setTitle(tr("More.."));

    connect(NoteManager::instance(), SIGNAL(storageAdded(StorageItem)), menuUpdateTimer, SLOT(start()));
    connect(NoteManager::instance(), SIGNAL(storageRemoved(StorageItem)), menuUpdateTimer, SLOT(start()));
    connect(NoteManager::instance(), SIGNAL(storageChanged(StorageItem)), menuUpdateTimer, SLOT(start()));
    menuUpdateTimer->start();
}
예제 #8
0
void Menu::onSourceDirty() {
	_controller->clear();
	rebuildMenu();
}
예제 #9
0
void SysTrayIconWrapper::updateTrayVisibility()
{
    mSystemTrayIcon.setVisible(SettingsManager::getSettingsManager()->getSetting("View/ShowTrayIcon").toBool());
    rebuildMenu();
}
예제 #10
0
void cTrayIcon::onProfilesChange()
{
    //never rebuild menu directly from method, because method may be inside menu event and we can delete menu item while we is insede this item handler which can cause problems.
    QTimer::singleShot(1, this, SLOT(rebuildMenu()));
}
예제 #11
0
// your model has changed
void MSOptionPopupMenu::updateData(void)
{ rebuildMenu(); }