Пример #1
0
UBKeyboardPalette::~UBKeyboardPalette()
{
    //for (int i=0; i<47; i++)
    //    delete buttons[i];
    delete [] buttons;

    //for (int i=0; i<8; i++)
    //    delete ctrlButtons[i];
    delete [] ctrlButtons;

    //if (locales!=NULL)
    //{
    //    for (int i=0; i<nLocalesCount; i++)
    //        delete locales[i];
    //    delete [] locales;
    //}

    if(currBtnImages != NULL)
    {
        delete currBtnImages;
        currBtnImages = NULL;
    }

    onActivated(false);
}
Пример #2
0
SeafileTrayIcon::SeafileTrayIcon(QObject *parent)
    : QSystemTrayIcon(parent),
      nth_trayicon_(0),
      rotate_counter_(0)
{
    setState(STATE_DAEMON_DOWN);
    rotate_timer_ = new QTimer(this);
    connect(rotate_timer_, SIGNAL(timeout()), this, SLOT(rotateTrayIcon()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIcon()));

    createActions();
    createContextMenu();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

    connect(SeahubNotificationsMonitor::instance(), SIGNAL(notificationsChanged()),
            this, SLOT(onSeahubNotificationsChanged()));

    hide();

#if defined(Q_WS_MAC)
    tnm = new TrayNotificationManager(this);
#endif
}
Пример #3
0
SeafileTrayIcon::SeafileTrayIcon(QObject *parent)
    : QSystemTrayIcon(parent),
      nth_trayicon_(0),
      rotate_counter_(0)
{
    setToolTip(SEAFILE_CLIENT_BRAND);
    setState(STATE_DAEMON_DOWN);
    rotate_timer_ = new QTimer(this);
    connect(rotate_timer_, SIGNAL(timeout()), this, SLOT(rotateTrayIcon()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIcon()));

    createActions();
    createContextMenu();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

    hide();

#if defined(Q_WS_MAC)
    tnm = new TrayNotificationManager(this);
#endif
}
Пример #4
0
SeafileTrayIcon::SeafileTrayIcon(QObject *parent)
    : QSystemTrayIcon(parent),
      nth_trayicon_(0),
      rotate_counter_(0),
      state_(STATE_DAEMON_UP)
{
    setState(STATE_DAEMON_DOWN);
    rotate_timer_ = new QTimer(this);
    connect(rotate_timer_, SIGNAL(timeout()), this, SLOT(rotateTrayIcon()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIcon()));
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIconToolTip()));

    createActions();
    createContextMenu();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

    connect(SeahubNotificationsMonitor::instance(), SIGNAL(notificationsChanged()),
            this, SLOT(onSeahubNotificationsChanged()));

#if defined(Q_OS_WIN32) || (defined(Q_OS_MAC) && (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0)))
    connect(this, SIGNAL(messageClicked()),
            this, SLOT(onMessageClicked()));
#endif

    hide();

    createGlobalMenuBar();
#if defined(Q_OS_MAC)
    tnm = new TrayNotificationManager(this);
#endif
}
Пример #5
0
Maemo5Tray::Maemo5Tray() :
	NotificationBackend("Tray")
{
	setDescription(QT_TR_NOOP("Maemo 5 blink icon in the tray"));

	m_activeAccount = 0;
	m_offlineIconPath	      = IconLoader::iconPath("qutim-offline",Maemo5Docklet::GetIconSize());
	m_mailIconPath                = IconLoader::iconPath("mail-message-new-qutim",Maemo5Docklet::GetIconSize());
	m_typingIconPath              = IconLoader::iconPath("im-status-message-edit",Maemo5Docklet::GetIconSize());
	m_chatUserJoinedIconPath      = IconLoader::iconPath("list-add-user-conference",Maemo5Docklet::GetIconSize());
	m_chatUserLeftIconPath        = IconLoader::iconPath("list-remove-user-conference",Maemo5Docklet::GetIconSize());
	m_qutimIconPath               = IconLoader::iconPath("qutim",Maemo5Docklet::GetIconSize());
	m_transferCompletedIconPath   = IconLoader::iconPath("mdocument-save-filetransfer-comleted",Maemo5Docklet::GetIconSize());
	m_defaultNotificationIconPath = IconLoader::iconPath("dialog-information",Maemo5Docklet::GetIconSize());

	Maemo5Docklet::Enable();
	Maemo5Docklet::SetTooltip("qutIM::Offline");
	Maemo5Docklet::SetIcon(m_offlineIconPath,false);

	connect(Maemo5Docklet::Instance(), SIGNAL(ButtonClicked()),this, SLOT(onActivated()));

	QMap<QString, Protocol*> protocols;
	foreach (Protocol *proto, Protocol::all()) {
		protocols.insert(proto->id(), proto);
		connect(proto, SIGNAL(accountCreated(qutim_sdk_0_3::Account*)),
				this, SLOT(onAccountCreated(qutim_sdk_0_3::Account*)));
	}
Пример #6
0
TrayIcon::TrayIcon(AppCore *core)
  : QSystemTrayIcon(core)
  , m_core(core)
  , m_message(Unknown)
{
  setIcon(QIcon(QLatin1String(":/images/icon16.png")));
  setToolTip(QString("%1 %2").arg(PRODUCT_NAME).arg(VERSION_STRING));

  m_widget = new QWidget();
  RecentItemDelegate *delegate = new RecentItemDelegate(core, this);

  m_window = new TrayWindow(core, m_widget);
  m_window->installEventFilter(this);
  m_window->recentView()->setItemDelegate(delegate);
  m_window->recentView()->setModel(core->recentModel());

  QTimer::singleShot(0, this, SLOT(show()));
  QTimer::singleShot(1000, this, SLOT(show()));

  connect(this, SIGNAL(messageClicked()), SLOT(onMessageClicked()));
  connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
  connect(m_window, SIGNAL(grabRect()), m_core, SLOT(grabRect()));
  connect(m_window, SIGNAL(grabScreen()), m_core, SLOT(grabScreen()));
  connect(m_window, SIGNAL(openFile()), m_core, SLOT(openFile()));
  connect(delegate, SIGNAL(closeRequest()), m_window, SLOT(close()));
  connect(delegate, SIGNAL(linkCopied(QUrl)), SLOT(onLinkCopied(QUrl)));
  connect(core->autoUpdate(), SIGNAL(done(int)), SLOT(onUpdateDone(int)));
}
Пример #7
0
SystemTrayIcon::SystemTrayIcon(QQuickItem *parent) :
    QQuickItem(parent)
{
    setVisible (false);
    systempTray = new QSystemTrayIcon(this);
    connect (systempTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
    connect (systempTray, SIGNAL(messageClicked()), this, SIGNAL(messageClicked()));
    connect (this, SIGNAL(visibleChanged()), SLOT(onVisibleChanged()));
}
Пример #8
0
MESASystemTrayIcon::MESASystemTrayIcon(QWidget *ptr,const QIcon& icon):QSystemTrayIcon(icon,ptr){
    //connect to daemon
    daemon.openConnection();
    //create a menu
    QMenu *menu=new QMenu();
    QAction *acHighPower=new QAction(QIcon("high.svg"),"High Power",this);
    QAction *acMidPower=new QAction(QIcon("mid.svg"),"Mid Power",this);
    QAction *acLowPower=new QAction( QIcon("low.svg"),"Low Power",this);
    QAction *acAuto=new QAction(QIcon("auto.svg"),"Auto",this);
    QAction *acDefault=new QAction(QIcon("default.svg"),"Default",this);
    QAction *acProfile=new QAction(QIcon("profile.svg"),"Profile",this);
    QAction *acDynpm=new QAction(QIcon("dynpm.svg"),"Dynpm",this);
    QAction *acExit=new QAction("exit",this);
    //enable icons
    acHighPower->setIconVisibleInMenu(true);
    acMidPower->setIconVisibleInMenu(true);
    acLowPower->setIconVisibleInMenu(true);
    acAuto->setIconVisibleInMenu(true);
    acDefault->setIconVisibleInMenu(true);
    acProfile->setIconVisibleInMenu(true);
    acDynpm->setIconVisibleInMenu(true);
    //add objects
    menu->addAction(acHighPower);
    menu->addAction(acMidPower);
    menu->addAction(acLowPower);
    menu->addAction(acAuto);
    menu->addAction(acDefault);
    menu->addSeparator();
    menu->addAction(acProfile);
    menu->addAction(acDynpm);
    menu->addSeparator();
    menu->addAction(acExit);
    //setup events
    QObject::connect(acHighPower,SIGNAL(triggered(bool)), this, SLOT(onHighPower(bool)));
    QObject::connect(acMidPower,SIGNAL(triggered(bool)), this, SLOT(onMidPower(bool)));
    QObject::connect(acLowPower,SIGNAL(triggered(bool)), this, SLOT(onLowPower(bool)));
    QObject::connect(acAuto,SIGNAL(triggered(bool)), this, SLOT(onAuto(bool)));
    QObject::connect(acDefault,SIGNAL(triggered(bool)), this, SLOT(onDefault(bool)));
    QObject::connect(acProfile,SIGNAL(triggered(bool)), this, SLOT(onProfile(bool)));
    QObject::connect(acDynpm,SIGNAL(triggered(bool)), this, SLOT(onDynpm(bool)));
    QObject::connect(acExit,SIGNAL(triggered(bool)), this, SLOT(onExit(bool)));
    //show event
    QObject::connect(this,SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
                     this,SLOT(onActivated(QSystemTrayIcon::ActivationReason)));
    this->setContextMenu(menu);

    //super ico
    if(AMDDaemonClient::PROFILE==daemon.getMethod())
        setIcon(QIcon("profile.svg"));
    else
        setIcon(QIcon("dynpm.svg"));


}
Пример #9
0
/**
 * Appelé en cas de colision
 *
 * @param animator      Infos sur la colision
 */
bool FuncDoor::onCollision(
        const irr::scene::ISceneNodeAnimatorCollisionResponse &animator)
{
    onActivated(ENTITY_ACTIVATION_COLLIDE);

    // Si on peut passer au travers
    if(getProperty("solid") == "false")
        return true;

    return false;
}
ShuffleButtonDelegate::ShuffleButtonDelegate(QListView *parent) :
    QStyledItemDelegate(parent)
{
    button = new QMaemo5ValueButton();
    button->setText(tr("Shuffle songs"));
    button->setIcon(QIcon::fromTheme(defaultShuffleIcon));
    button->setValueLayout(QMaemo5ValueButton::ValueUnderTextCentered);
    button->setCheckable(true);

    connect(parent, SIGNAL(activated(QModelIndex)), this, SLOT(onActivated(QModelIndex)));
}
Пример #11
0
void ZLQtApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) {
	if (item->isSeparator()) {
		myToolbarActions[item] = myToolbar->addSeparator();
	} else {
		ZLToolbar::ButtonItem& buttonItem = (ZLToolbar::ButtonItem&)*item;
		QAction *action = getAction(buttonItem.actionId());
		ZLQtToolbarButton *button = new ZLQtToolbarButton(buttonItem.iconName(), myToolbar);
		button->setToolTip(::qtString(buttonItem.tooltip()));
		connect(button, SIGNAL(clicked()), action, SLOT(onActivated()));
		myToolbarActions[item] = myToolbar->addWidget(button);
	}
}
ZLQtToolBarAction::ZLQtToolBarAction(ZLQtApplicationWindow *parent, ZLToolbar::AbstractButtonItem &item) : QAction(parent), myItem(item) {
	static std::string imagePrefix = ZLibrary::ApplicationImageDirectory() + ZLibrary::FileNameDelimiter;
	QPixmap icon((imagePrefix + myItem.iconName() + ".png").c_str());
	setIcon(QIcon(icon));
	QSize size = icon.size();
	if (item.type() == ZLToolbar::Item::TOGGLE_BUTTON) {
		setCheckable(true);
	}
	QString text = QString::fromUtf8(myItem.tooltip().c_str());
	setText(text);
	setToolTip(text);
	connect(this, SIGNAL(triggered()), this, SLOT(onActivated()));
}
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent),
	_ui(new Ui::MainWindow),
	_clipboard(QApplication::clipboard()),
	_proxyModel(new QSortFilterProxyModel),
	_storageModel(),
	_objectModel(new MtpObjectsModel()),
	_uploader(new FileUploader(_objectModel, this))
{
	_ui->setupUi(this);
	setWindowIcon(QIcon(":/android-file-transfer.png"));

	_ui->listView->setModel(_proxyModel);

	_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
	_proxyModel->sort(0);
	_proxyModel->setDynamicSortFilter(true);

	_objectModel->moveToThread(QApplication::instance()->thread());

	connect(_ui->listView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)), SLOT(updateActionsState()));
	connect(_ui->listView, SIGNAL(doubleClicked(QModelIndex)), SLOT(onActivated(QModelIndex)));
	connect(_ui->listView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(showContextMenu(QPoint)));
	connect(_ui->actionBack, SIGNAL(triggered()), SLOT(back()));
	connect(_ui->actionGo_Down, SIGNAL(triggered()), SLOT(down()));
	connect(_ui->actionCreateDirectory, SIGNAL(triggered()), SLOT(createDirectory()));
	connect(_ui->actionUploadDirectory, SIGNAL(triggered()), SLOT(uploadDirectories()));
	connect(_ui->actionUpload_Album, SIGNAL(triggered()), SLOT(uploadAlbum()));
	connect(_ui->actionUpload, SIGNAL(triggered()), SLOT(uploadFiles()));
	connect(_ui->actionRename, SIGNAL(triggered()), SLOT(renameFile()));
	connect(_ui->actionDownload, SIGNAL(triggered()), SLOT(downloadFiles()));
	connect(_ui->actionDelete, SIGNAL(triggered()), SLOT(deleteFiles()));
	connect(_ui->storageList, SIGNAL(activated(int)), SLOT(onStorageChanged(int)));
	connect(_ui->actionRefresh, SIGNAL(triggered()), SLOT(refresh()));
	connect(_ui->actionPaste, SIGNAL(triggered()), SLOT(pasteFromClipboard()));

	connect(_objectModel, SIGNAL(onFilesDropped(QStringList)), SLOT(uploadFiles(QStringList)));
	connect(_objectModel, SIGNAL(existingFileOverwrite(QString)), SLOT(confirmOverwrite(QString)), Qt::BlockingQueuedConnection);

	connect(_clipboard, SIGNAL(dataChanged()), SLOT(validateClipboard()));
	validateClipboard();

	//fixme: find out how to specify alternative in designer
	_ui->actionBack->setShortcuts(_ui->actionBack->shortcuts() << QKeySequence("Alt+Up") << QKeySequence("Esc"));
	_ui->actionGo_Down->setShortcuts(_ui->actionGo_Down->shortcuts() << QKeySequence("Alt+Down") << QKeySequence("Enter"));
	_ui->actionCreateDirectory->setShortcuts(_ui->actionCreateDirectory->shortcuts() << QKeySequence("F7"));
	_ui->actionRefresh->setShortcuts(_ui->actionRefresh->shortcuts() << QKeySequence("Ctrl+R"));
	_ui->listView->setFocus();
}
Пример #14
0
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
    : QSystemTrayIcon( parent )
    , m_currentAnimationFrame( 0 )
    , m_showWindowAction( 0 )
{
    QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
    setIcon( icon );

    refreshToolTip();

    m_contextMenu = new QMenu();
    setContextMenu( m_contextMenu );

    ActionCollection *ac = ActionCollection::instance();
    m_contextMenu->addAction( ac->getAction( "playPause" ) );
    m_contextMenu->addAction( ac->getAction( "stop" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
    m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );

#ifdef Q_WS_MAC
    // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
    m_contextMenu->addSeparator();
    m_showWindowAction = m_contextMenu->addAction( tr( "Hide Tomahawk Window" ) );
    m_showWindowAction->setData( true );
    connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );
#endif

    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "quit" ) );

    connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
    connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( enablePause() ) );
    connect( AudioEngine::instance(), SIGNAL( resumed() ), this, SLOT( enablePause() ) );
    connect( AudioEngine::instance(), SIGNAL( stopped() ), this, SLOT( enablePlay() ) );
    connect( AudioEngine::instance(), SIGNAL( paused() ),  this, SLOT( enablePlay() ) );

    connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );

    show();
}
ZLQtToolButton::ZLQtToolButton(ZLQtApplicationWindow &window, ZLToolbar::AbstractButtonItem &item) : QToolButton(window.myToolBar), myWindow(window), myItem(item) {
	static std::string imagePrefix = ZLibrary::ApplicationImageDirectory() + ZLibrary::FileNameDelimiter;
	QPixmap icon((imagePrefix + myItem.iconName() + ".png").c_str());
	setIconSet(QIconSet(icon));
	QSize size = icon.size();
	QIconSet::setIconSize(QIconSet::Large, size);
	QIconSet::setIconSize(QIconSet::Small, size);
	if (item.type() == ZLToolbar::Item::TOGGLE_BUTTON) {
		setToggleButton(true);
	} else if (item.type() == ZLToolbar::Item::MENU_BUTTON) {
		ZLToolbar::MenuButtonItem &menuButtonItem = (ZLToolbar::MenuButtonItem&)myItem;
		shared_ptr<ZLPopupData> popupData = menuButtonItem.popupData();
		myWindow.myPopupIdMap[&menuButtonItem] =
			!popupData ? (size_t)-1 : (popupData->id() - 1);
		setPopup(new ZLQtPopupMenu(this));
	}
	QString text = QString::fromUtf8(myItem.tooltip().c_str());
	setTextLabel(text);
	setUsesTextLabel(false);
	QToolTip::add(this, text);
	connect(this, SIGNAL(clicked()), this, SLOT(onActivated()));
}
Пример #16
0
SeafileTrayIcon::SeafileTrayIcon(QObject *parent)
    : QSystemTrayIcon(parent),
      nth_trayicon_(0),
      rotate_counter_(0),
      state_(STATE_DAEMON_UP),
      next_message_msec_(0),
      sync_errors_dialog_(nullptr),
      about_dialog_(nullptr),
      log_dir_uploader_(nullptr)
{
    setState(STATE_DAEMON_DOWN);
    rotate_timer_ = new QTimer(this);
    connect(rotate_timer_, SIGNAL(timeout()), this, SLOT(rotateTrayIcon()));

    refresh_timer_ = new QTimer(this);
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIcon()));
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(refreshTrayIconToolTip()));
#if defined(Q_OS_WIN32)
    connect(refresh_timer_, SIGNAL(timeout()), this, SLOT(checkTrayIconMessageQueue()));
#endif

    createActions();
    createContextMenu();

    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
            this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

#if !defined(Q_OS_LINUX)
    connect(this, SIGNAL(messageClicked()),
            this, SLOT(onMessageClicked()));
#endif

    hide();

    createGlobalMenuBar();
#if defined(Q_OS_MAC)
    tnm = new TrayNotificationManager(this);
#endif
}
Пример #17
0
/**
 * @brief TrayIcon::TrayIcon
 * @param MainWindow* _parent
 * @param Controller* _ctrl
 */
TrayIcon::TrayIcon(MainWindow* _parent, Controller* _ctrl) :
    QSystemTrayIcon(_parent),
    m_ctrl(_ctrl),
    m_parent(_parent)
{
    connect(m_parent, SIGNAL(showHidden(bool)),     this, SLOT(onWindowShown(bool)));
    connect(m_ctrl,   SIGNAL(startedPaused(bool)),  this, SLOT(onStartPause(bool)));
    connect(m_ctrl,   SIGNAL(lockToggled(bool)),    this, SLOT(setLocked(bool)));
    connect(m_parent, &MainWindow::settingsChanged, this, [this]{ setLockEnabled(m_ctrl->lockEnabled() == UM::LOCK_ALL); });
    connect(m_ctrl,   SIGNAL(generationFinished()), this, SLOT(onListChanged()));
    connect(this, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(onActivated(QSystemTrayIcon::ActivationReason)));

    QMenu* menu = new QMenu();
    m_actionPause =          menu->addAction(QIcon(":/images/icons/play_pause.png"), tr("Pause"));
    QAction* actionRefresh = menu->addAction(QIcon(":/images/icons/refresh.png"),    tr("Refresh"));
    m_actionHide =           menu->addAction(QIcon(":/images/icons/hide.png"),       tr("Hide"));
    m_actionLock =           menu->addAction(QIcon(":/images/icons/lock.png"),       tr("Lock"));
    m_actionUnlock =         menu->addAction(QIcon(":/images/icons/lock.png"),       tr("Unlock"));
    m_quickMenu =            menu->addMenu(QIcon(":/images/icons/quick.png"),        tr("Quick switch"));
                             menu->addSeparator();
    QAction* actionQuit =    menu->addAction(QIcon(":/images/icons/quit.png"),       tr("Quit"));

    connect(actionQuit,    SIGNAL(triggered()), m_parent, SLOT(quit()));
    connect(m_actionHide,  SIGNAL(triggered()), m_parent, SLOT(toggleWindow()));
    connect(m_actionPause, SIGNAL(triggered()), m_ctrl,   SLOT(startPause()));
    connect(actionRefresh, SIGNAL(triggered()), m_ctrl,   SLOT(update()));
    connect(m_actionLock,  SIGNAL(triggered()), m_ctrl,   SLOT(lock()));
    connect(m_actionUnlock,SIGNAL(triggered()), m_parent, SLOT(openUnlockDialog()));

    setToolTip(APP_NAME);
    setContextMenu(menu);

    onListChanged();
    setLockEnabled(m_ctrl->lockEnabled() == UM::LOCK_ALL);
    updateIcon();
}
ZLQtRunPopupAction::ZLQtRunPopupAction(QObject *parent, shared_ptr<ZLPopupData> data, size_t index) : QAction(parent), myData(data), myIndex(index) {
	setText(QString::fromUtf8(myData->text(myIndex).c_str()));
	connect(this, SIGNAL(triggered()), this, SLOT(onActivated()));
}
Пример #19
0
ZLQtAction::ZLQtAction(ZLApplication &application, const std::string &id, QObject *parent) : QAction(parent), myApplication(application), Id(id) {
	connect(this, SIGNAL(triggered()), this, SLOT(onActivated()));
}
Пример #20
0
void  UBKeyboardPalette::onDeactivated()
{
    onActivated(false);
}
Пример #21
0
TomahawkTrayIcon::TomahawkTrayIcon( QObject* parent )
    : QSystemTrayIcon( parent )
    , m_currentAnimationFrame( 0 )
    , m_showWindowAction( 0 )
    , m_stopContinueAfterTrackAction( 0 )
    , m_loveTrackAction( 0 )
{
#ifdef Q_OS_MAC
    QIcon icon( RESPATH "icons/tomahawk-grayscale-icon-128x128.png" );
#else
    QIcon icon( RESPATH "icons/tomahawk-icon-128x128.png" );
#endif

    setIcon( icon );

    refreshToolTip();

    m_contextMenu = new QMenu();
    m_contextMenu->setFont( TomahawkUtils::systemFont() );
    setContextMenu( m_contextMenu );

    m_loveTrackAction = new QAction( this );
    m_stopContinueAfterTrackAction = new QAction( this );

    ActionCollection *ac = ActionCollection::instance();
    m_contextMenu->addAction( ac->getAction( "playPause" ) );
    m_contextMenu->addAction( ac->getAction( "stop" ) );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( m_loveTrackAction );
    m_contextMenu->addAction( m_stopContinueAfterTrackAction );
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "previousTrack" ) );
    m_contextMenu->addAction( ac->getAction( "nextTrack" ) );
    /*
    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ActionCollection::instance()->getAction( "togglePrivacy" ) );
    */

#ifdef Q_OS_MAC
    // On mac you can close the windows while leaving the app open. We then need a way to show the main window again
    m_contextMenu->addSeparator();
    m_showWindowAction = m_contextMenu->addAction( tr( "Hide %applicationName Window" ) );
    m_showWindowAction->setData( true );
    connect( m_showWindowAction, SIGNAL( triggered() ), this, SLOT( showWindow() ) );

    connect( m_contextMenu, SIGNAL( aboutToShow() ), this, SLOT( menuAboutToShow() ) );
#endif

    m_contextMenu->addSeparator();
    m_contextMenu->addAction( ac->getAction( "quit" ) );

    connect( m_loveTrackAction, SIGNAL( triggered() ), SLOT( loveTrackTriggered() ) );
    connect( m_stopContinueAfterTrackAction, SIGNAL( triggered() ), SLOT( stopContinueAfterTrackActionTriggered() ) );

    connect( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ), SLOT( setResult( Tomahawk::result_ptr ) ) );
    connect( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ), SLOT( onPlay() ) );
    connect( AudioEngine::instance(), SIGNAL( resumed() ), SLOT( onResume() ) );
    connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onStop() ) );
    connect( AudioEngine::instance(), SIGNAL( paused() ),  SLOT( onPause() ) );
    connect( AudioEngine::instance(), SIGNAL( stopAfterTrackChanged() ), SLOT( onStopContinueAfterTrackChanged() ) );

    connect( &m_animationTimer, SIGNAL( timeout() ), SLOT( onAnimationTimer() ) );
    connect( this, SIGNAL( activated( QSystemTrayIcon::ActivationReason ) ), SLOT( onActivated( QSystemTrayIcon::ActivationReason ) ) );

    onStop();
    show();
}