Exemplo n.º 1
0
void KSystemTray::mousePressEvent(QMouseEvent *e)
{
    if(!rect().contains(e->pos()))
        return;

    switch(e->button())
    {
    case LeftButton:
        toggleActive();
        break;
    case MidButton:
    // fall through
    case RightButton:
        if(parentWidget())
        {
            KAction *action = d->actionCollection->action("minimizeRestore");
            if(parentWidget()->isVisible())
                action->setText(i18n("&Minimize"));
            else
                action->setText(i18n("&Restore"));
        }
        contextMenuAboutToShow(menu);
        menu->popup(e->globalPos());
        break;
    default:
        // nothing
        break;
    }
}
Exemplo n.º 2
0
void KwikDisk::mousePressEvent(TQMouseEvent *me)
{
   kdDebug() << k_funcinfo << endl;

   if( m_dirty )
      updateDF();

   if( m_menuVisible )
   {
      contextMenu()->hide();
      m_menuVisible = FALSE;
      me->ignore();
      return;
   }

   contextMenuAboutToShow(contextMenu());
   contextMenu()->popup( me->globalPos() );
   m_menuVisible = TRUE;
}
Exemplo n.º 3
0
KMixDockWidget::KMixDockWidget(KMixWindow* parent)
    : KStatusNotifierItem(parent)
    , _oldToolTipValue(-1)
    , _oldPixmapType('-')
    , _kmixMainWindow(parent)
    , _delta(0)
{
    setToolTipIconByName("kmix");
    setTitle(i18n( "Volume Control"));
    setCategory(Hardware);
    setStatus(Active);

    // TODO Unity / Gnome only support one type of activation (left-click == right-click)
    //      So we should show here the ViewDockAreaPopup instead of the menu:
    //bool onlyOneMouseButtonAction = onlyHaveOneMouseButtonAction();

    createMenuActions();

    connect(this, SIGNAL(scrollRequested(int,Qt::Orientation)), this, SLOT(trayWheelEvent(int,Qt::Orientation)));
    connect(this, SIGNAL(secondaryActivateRequested(QPoint)), this, SLOT(dockMute()));

	// For bizarre reasons, we wrap the ViewDockAreaPopup in a KMenu. Must relate to how KStatusNotifierItem works.
   _dockAreaPopupMenuWrapper = new KMenu(parent);
	_volWA = new QWidgetAction(_dockAreaPopupMenuWrapper);
	_dockView = new ViewDockAreaPopup(_dockAreaPopupMenuWrapper, "dockArea", 0, QString("no-guiprofile-yet-in-dock"), parent);
	_volWA->setDefaultWidget(_dockView);
	_dockAreaPopupMenuWrapper->addAction(_volWA);
	connect(contextMenu(), SIGNAL(aboutToShow()), this, SLOT(contextMenuAboutToShow()));

	ControlManager::instance().addListener(
		QString(), // All mixers (as the Global master Mixer might change)
		(ControlChangeType::Type) (ControlChangeType::Volume | ControlChangeType::MasterChanged), this,
		QString("KMixDockWidget"));
	 
	      // Refresh in all cases. When there is no Golbal Master we still need
     // to initialize correctly (e.g. for showin 0% or hiding it)
     refreshVolumeLevels();
}
Exemplo n.º 4
0
QMenu *Actions::channelContextMenu(QWidget *parent) const
{
    QMenu *menu = new QMenu("チャンネルコンテキストメニュー", parent);

    connect(menu, SIGNAL(aboutToShow()), this, SLOT(contextMenuAboutToShow()));
    connect(menu, SIGNAL(aboutToHide()), this, SLOT(contextMenuAboutToHide()));

    if (m_mainWindow->menuBar()->isHidden() && m_mainWindow->toolBar()->isHidden()) {
        menu->addAction(m_updateYellowPageAction);
        menu->addAction(m_toggleAutoUpdateAction);
        menu->addSeparator();
    }
    menu->addAction(m_playChannelAction);
    menu->addAction(m_openContactUrlAction);
    menu->addSeparator();
    menu->addAction(m_addToFavoritesAction);
    menu->addAction(m_unfavoriteAction);
    menu->addAction(m_addToNGAction);
    menu->addSeparator();
    menu->addAction(m_copyChannelInfoAction);
    menu->addAction(m_copyStreamUrlAction);
    menu->addAction(m_copyContactUrlAction);
    if (m_mainWindow->menuBar()->isHidden() && m_mainWindow->toolBar()->isHidden()) {
        menu->addSeparator();
        menu->addAction(m_findChannelAction);
    }
#ifndef Q_WS_MAC
    if (m_mainWindow->menuBar()->isHidden()) {
        menu->addSeparator();
        menu->addMenu(settingsMenu(menu));
        menu->addSeparator();
        menu->addAction(m_quitAction);
    }
#endif
    return menu;
}
Exemplo n.º 5
0
void CameraMainWindow::delayedInit()
{
    settingsDialog = new QDialog( this );
    settingsDialog->setModal( true );
    settings = new Ui::CameraSettings();
    settings->setupUi( settingsDialog );
    settingsDialog->setObjectName( "settings" );    // To pick up correct help.
    connect( settings->photo_quality, SIGNAL(valueChanged(int)),
             settings->photo_quality_n, SLOT(setNum(int)) );
    QFileSystemFilter *fsf = new QFileSystemFilter;
    fsf->documents = QFileSystemFilter::Set;
    settings->location->setFilter(fsf);
    // load settings from config
    QSettings cfg("Trolltech","Camera");
    cfg.beginGroup("General");
    QString l = cfg.value("location").toString();
    if ( !l.isEmpty() )
        settings->location->setLocation(l);
    else
        settings->location->setLocation(QFileSystem::documentsFileSystem().documentsPath());
    storagepath = settings->location->documentPath();
    cfg.endGroup();
    cfg.beginGroup("Photo");
    int w;
    w = cfg.value("width",camera->videocaptureview->recommendedPhotoSize().width()).toInt();
    for (psize=0; psize<(int)photo_size.count()-1 && photo_size[psize].width() > w;)
        psize++;
    pquality = cfg.value("quality",settings->photo_quality->value()).toInt();
    cfg.endGroup();
    cfg.beginGroup("Video");
    w = cfg.value("width",camera->videocaptureview->recommendedVideoSize().width()).toInt();
    for (vsize=0; vsize<(int)video_size.count()-1 && video_size[vsize].width() > w;)
        vsize++;
    vquality = cfg.value("quality",settings->video_quality->value()).toInt();
    vframerate = cfg.value("framerate",settings->video_framerate->value()).toInt();

    for (int i=0; i<(int)photo_size.count(); i++) {
        settings->photo_size->addItem(tr("%1 x %2","picture size e.g. 640 x 480").arg(photo_size[i].width()).arg(photo_size[i].height()));
    }
    for (int i=0; i<(int)video_size.count(); i++) {
        settings->video_size->addItem(tr("%1 x %2","picture size e.g. 640 x 480").arg(video_size[i].width()).arg(video_size[i].height()));
    }

    QMimeType m( QLatin1String( "image/jpeg" ));
    QContent a = m.application();
    QIcon picViewIcon = a.icon();
    if ( picViewIcon.isNull() )
        picViewIcon = QIcon( QLatin1String( ":icon/view" ));

    if ( video_supported ) {
        // If video_supported is ever not a constant false then ensure
        // an application is available to handle it
        if ( a.isValid() )
        {
            a_vview = new QAction( QIcon(":image/"+a.iconName()), QString("%1...").arg(a.name()), this );
            connect( a_vview, SIGNAL(triggered()), this, SLOT(viewVideos()) );
        }
    } else {
        a_vview = 0;
    }

    a_pview = new QAction( QIcon(), tr( "View pictures" ), this );
    a_pview->setIcon(picViewIcon);
    connect( a_pview, SIGNAL(triggered()), this, SLOT(viewPictures()) );

    a_timer = new QAction( QIcon( ":icon/wait" ) , tr("Timer"), this );
    connect( a_timer, SIGNAL(triggered()), this, SLOT(takePhotoTimer()) );

    if(camera->videocaptureview->available())
    {
        a_settings = new QAction( QIcon( ":icon/settings" ) , tr("Settings..."), this );
        connect( a_settings, SIGNAL(triggered()), this, SLOT(doSettings()) );
    }

    a_th_edit = new QAction( QIcon(":icon/edit"), tr("Edit"), this );
    connect( a_th_edit, SIGNAL(triggered()), this, SLOT(editThumb()) );
    a_th_del = new QAction( QIcon(":icon/trash"), tr("Delete"), this );
    connect( a_th_del, SIGNAL(triggered()), this, SLOT(delThumb()) );
    a_th_add = new QAction( QIcon(":image/addressbook/AddressBook"), tr("Save to Contact..."), this );
    connect( a_th_add, SIGNAL(triggered()), this, SLOT(moveToContact()) );
    a_send = new QAction( QIcon( ":icon/beam" ), tr("Send to Contact..."), this );
    connect( a_send, SIGNAL(triggered()), this, SLOT(sendFile()) );

    a_zoom = new QAction( QIcon( ), tr("Zoom"), this);
    connect(a_zoom, SIGNAL(triggered()), this, SLOT(showZoom()));
    m_zoom = new QSlider(this);
    m_zoom->setSliderPosition(50);
    m_zoom->setOrientation(Qt::Horizontal);

    m_zoom->setRange(camera->videocaptureview->minZoom(),camera->videocaptureview->maxZoom());
    m_zoom->setValue(0);
    m_zoom->setGeometry(width()*1/5, height()*2/3, 60*width()/100, 40*height()/100);
    m_zoom->hide();

    connect(m_zoom, SIGNAL(valueChanged(int)), this, SLOT(zoomChanged(int)));

    QMenu *contextMenu = QSoftMenuBar::menuFor(this);
    if(camera->videocaptureview->available())
    {
        contextMenu->addAction( a_pview );
        if ( video_supported )
            contextMenu->addAction( a_vview );
        contextMenu->addAction( a_th_edit );
        contextMenu->addAction( a_th_del );
        contextMenu->addAction( a_th_add );
        contextMenu->addAction( a_timer );
        contextMenu->addAction( a_send );
        contextMenu->addAction( a_settings );
        contextMenu->addAction( a_zoom );
    }

    connect(contextMenu, SIGNAL(aboutToHide()),
            this, SLOT(contextMenuAboutToHide()));
    connect(contextMenu, SIGNAL(aboutToShow()),
            this, SLOT(contextMenuAboutToShow()));

    QSignalMapper* sm = new QSignalMapper(this);
    for (int i=0; i<nthumb; i++) {
        sm->setMapping(thumb[i],i);
        connect(thumb[i],SIGNAL(clicked()),sm,SLOT(map()));
        thumb[i]->installEventFilter(this);
    }
    connect(sm,SIGNAL(mapped(int)),this,SLOT(thumbClicked(int)));

    installEventFilter(camera->photo);
    installEventFilter(camera->video);
    camera->photo->installEventFilter(this);
    camera->video->installEventFilter(this);

    loadThumbs();
    preview();
}