Ejemplo n.º 1
0
IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent)
    : QWidget(aParent)
    , _foundMatch(false)
    , _searchEdit(0)
    , _caseSensitive(0)
    , _regExpression(0)
    , _highlightMatches(0)
{
    QHBoxLayout* barLayout = new QHBoxLayout(this);

    QToolButton* closeButton = new QToolButton(this);
    closeButton->setObjectName(QLatin1String("close-button"));
    closeButton->setToolTip(i18n("Close the search bar"));
    closeButton->setAutoRaise(true);
    closeButton->setIcon(KIcon("dialog-close"));
    connect(closeButton , SIGNAL(clicked()) , this , SIGNAL(closeClicked()));

    QLabel* findLabel = new QLabel(i18n("Find:"), this);
    _searchEdit = new KLineEdit(this);
    _searchEdit->setClearButtonShown(true);
    _searchEdit->installEventFilter(this);
    _searchEdit->setObjectName(QLatin1String("search-edit"));
    _searchEdit->setToolTip(i18n("Enter the text to search for here"));

    // text box may be a minimum of 6 characters wide and a maximum of 10 characters wide
    // (since the maxWidth metric is used here, more characters probably will fit in than 6
    //  and 10)
    QFontMetrics metrics(_searchEdit->font());
    int maxWidth = metrics.maxWidth();
    _searchEdit->setMinimumWidth(maxWidth * 6);
    _searchEdit->setMaximumWidth(maxWidth * 10);

    _searchTimer = new QTimer(this);
    _searchTimer->setInterval(250);
    _searchTimer->setSingleShot(true);
    connect(_searchTimer , SIGNAL(timeout()) , this , SLOT(notifySearchChanged()));
    connect(_searchEdit , SIGNAL(clearButtonClicked()) , this , SLOT(clearLineEdit()));
    connect(_searchEdit , SIGNAL(textChanged(QString)) , _searchTimer , SLOT(start()));

    QToolButton* findNext = new QToolButton(this);
    findNext->setObjectName(QLatin1String("find-next-button"));
    findNext->setText(i18nc("@action:button Go to the next phrase", "Next"));
    findNext->setIcon(KIcon("go-down-search"));
    findNext->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    findNext->setToolTip(i18n("Find the next match for the current search phrase"));
    connect(findNext , SIGNAL(clicked()) , this , SIGNAL(findNextClicked()));

    QToolButton* findPrev = new QToolButton(this);
    findPrev->setObjectName(QLatin1String("find-previous-button"));
    findPrev->setText(i18nc("@action:button Go to the previous phrase", "Previous"));
    findPrev->setIcon(KIcon("go-up-search"));
    findPrev->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    findPrev->setToolTip(i18n("Find the previous match for the current search phrase"));
    connect(findPrev , SIGNAL(clicked()) , this , SIGNAL(findPreviousClicked()));

    QToolButton* optionsButton = new QToolButton(this);
    optionsButton->setObjectName(QLatin1String("find-options-button"));
    optionsButton->setText(i18nc("@action:button Display options menu", "Options"));
    optionsButton->setCheckable(false);
    optionsButton->setPopupMode(QToolButton::InstantPopup);
    optionsButton->setArrowType(Qt::DownArrow);
    optionsButton->setToolButtonStyle(Qt::ToolButtonTextOnly);
    optionsButton->setToolTip(i18n("Display the options menu"));

    barLayout->addWidget(closeButton);
    barLayout->addWidget(findLabel);
    barLayout->addWidget(_searchEdit);
    barLayout->addWidget(findNext);
    barLayout->addWidget(findPrev);
    barLayout->addWidget(optionsButton);

    // Fill the options menu
    QMenu* optionsMenu = new QMenu(this);
    optionsButton->setMenu(optionsMenu);

    _caseSensitive = optionsMenu->addAction(i18n("Case sensitive"));
    _caseSensitive->setCheckable(true);
    _caseSensitive->setToolTip(i18n("Sets whether the search is case sensitive"));
    connect(_caseSensitive, SIGNAL(toggled(bool)),
            this, SIGNAL(matchCaseToggled(bool)));

    _regExpression = optionsMenu->addAction(i18n("Match regular expression"));
    _regExpression->setCheckable(true);
    connect(_regExpression, SIGNAL(toggled(bool)),
            this, SIGNAL(matchRegExpToggled(bool)));

    _highlightMatches = optionsMenu->addAction(i18n("Highlight all matches"));
    _highlightMatches->setCheckable(true);
    _highlightMatches->setToolTip(i18n("Sets whether matching text should be highlighted"));
    _highlightMatches->setChecked(true);
    connect(_highlightMatches, SIGNAL(toggled(bool)),
            this, SIGNAL(highlightMatchesToggled(bool)));

    barLayout->addStretch();

    barLayout->setContentsMargins(4, 4, 4, 4);

    setLayout(barLayout);
}
Ejemplo n.º 2
0
MailEditorMainWindow::MailEditorMainWindow(ATopLevelWindowsContainer* parent, AddressBookModel& abModel,
  IMailProcessor& mailProcessor, bool editMode) :
  ATopLevelWindow(parent),
  ui(new Ui::MailEditorWindow()),
  ABModel(abModel),
  MailProcessor(mailProcessor),
  FontCombo(nullptr),
  EditMode(editMode)
  {
  ui->setupUi(this);

  /** Disable these toolbars by default. They should be showed up on demand, when given action will
      be trigerred.
  */
  ui->fileAttachementToolBar->hide();
  ui->moneyAttachementToolBar->hide();
  ui->editToolBar->hide();
  ui->adjustToolbar->hide();
  ui->formatToolBar->hide();

  MoneyAttachement = new TMoneyAttachementWidget(ui->moneyAttachementToolBar);
  ui->moneyAttachementToolBar->addWidget(MoneyAttachement);

  FileAttachment = new TFileAttachmentWidget(ui->fileAttachementToolBar, editMode);
  ui->fileAttachementToolBar->addWidget(FileAttachment);

  MailFields = new MailFieldsWidget(*this, *ui->actionSend, abModel, editMode);

  /// Initially only basic mail fields (To: and Subject:) should be visible
  MailFields->showFromControls(false);
  MailFields->showCcControls(false);
  MailFields->showBccControls(false);

  ui->mailFieldsToolBar->addWidget(MailFields);

  connect(MailFields, SIGNAL(subjectChanged(QString)), this, SLOT(onSubjectChanged(QString)));
  connect(MailFields, SIGNAL(recipientListChanged()), this, SLOT(onRecipientListChanged()));
  connect(FileAttachment, SIGNAL(attachmentListChanged()), this, SLOT(onAttachmentListChanged()));

  if(editMode)
    {
    /** Supplement definition of mailFieldSelectorToolbar since Qt Creator doesn't support putting
        into its context dedicated controls (like preconfigured toolbutton).

        Setup local menu for 'actionMailFields' toolButton (used to enable/disable additional mail
        field selection).
    */
    QMenu* mailFieldsMenu = new QMenu(this);
    mailFieldsMenu->addAction(ui->actionFrom);
    mailFieldsMenu->addAction(ui->actionCC);
    mailFieldsMenu->addAction(ui->actionBCC);

    ui->actionMailFields->setMenu(mailFieldsMenu);
    ui->mainToolBar->insertAction(ui->actionShowFormatOptions, ui->actionMailFields);
    }

  setupEditorCommands();

  ui->messageEdit->setFocus();
  fontChanged(ui->messageEdit->font());
  colorChanged(ui->messageEdit->textColor());
  alignmentChanged(ui->messageEdit->alignment());

  QString subject = MailFields->getSubject();
  onSubjectChanged(subject);
  
  /// Clear modified flag
  ui->messageEdit->document()->setModified(false);
  setWindowModified(ui->messageEdit->document()->isModified());
  
  ui->actionSave->setEnabled(ui->messageEdit->document()->isModified());
  ui->actionUndo->setEnabled(ui->messageEdit->document()->isUndoAvailable());
  ui->actionRedo->setEnabled(ui->messageEdit->document()->isRedoAvailable());

  /// Setup command update ui related to 'save' option activity control and window modify marker.
  connect(ui->messageEdit->document(), SIGNAL(modificationChanged(bool)), ui->actionSave,
    SLOT(setEnabled(bool)));
  connect(ui->messageEdit->document(), SIGNAL(modificationChanged(bool)), this,
    SLOT(setWindowModified(bool)));

#ifndef QT_NO_CLIPBOARD
  connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(onClipboardDataChanged()));
#endif

  toggleReadOnlyMode();
  }
Ejemplo n.º 3
0
bool HelpIndexView::eventFilter(QObject *obj, QEvent *e)
{
  if (obj == m_SearchLineEdit && e->type() == QEvent::KeyPress)
  {
    QKeyEvent *ke = static_cast<QKeyEvent*>(e);
    QModelIndex idx = m_IndexWidget->currentIndex();
    switch (ke->key())
    {
    case Qt::Key_Up:
      idx = m_IndexWidget->model()->index(idx.row()-1,
                                          idx.column(), idx.parent());
      if (idx.isValid())
      {
        m_IndexWidget->setCurrentIndex(idx);
        return true;
      }
      break;
    case Qt::Key_Down:
      idx = m_IndexWidget->model()->index(idx.row()+1,
                                          idx.column(), idx.parent());
      if (idx.isValid())
      {
        m_IndexWidget->setCurrentIndex(idx);
        return true;
      }
      break;
    default: ; // stop complaining
    }
  }
  else if (obj == m_IndexWidget && e->type() == QEvent::ContextMenu)
  {
    QContextMenuEvent *ctxtEvent = static_cast<QContextMenuEvent*>(e);
    QModelIndex idx = m_IndexWidget->indexAt(ctxtEvent->pos());
    if (idx.isValid())
    {
      QMenu menu;
      QAction *curTab = menu.addAction(tr("Open Link"));
      QAction *newTab = menu.addAction(tr("Open Link in New Tab"));
      menu.move(m_IndexWidget->mapToGlobal(ctxtEvent->pos()));

      QAction *action = menu.exec();
      if (curTab == action)
        m_IndexWidget->activateCurrentItem();
      else if (newTab == action)
      {
        open(m_IndexWidget, idx);
      }
    }
  }
  else if (m_IndexWidget && obj == m_IndexWidget->viewport()
           && e->type() == QEvent::MouseButtonRelease)
  {
    QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(e);
    QModelIndex idx = m_IndexWidget->indexAt(mouseEvent->pos());
    if (idx.isValid())
    {
      Qt::MouseButtons button = mouseEvent->button();
      if (((button == Qt::LeftButton) && (mouseEvent->modifiers() & Qt::ControlModifier))
          || (button == Qt::MidButton))
      {
        open(m_IndexWidget, idx);
      }
    }
  }
#ifdef Q_OS_MAC
  else if (obj == m_IndexWidget && e->type() == QEvent::KeyPress)
  {
    QKeyEvent *ke = static_cast<QKeyEvent*>(e);
    if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter)
      m_IndexWidget->activateCurrentItem();
  }
#endif
  return QObject::eventFilter(obj, e);
}
Ejemplo n.º 4
0
void MainWindow::createElements()
{
    QMenu *fileMenu = new QMenu(tr("&File"), this);
    menuBar()->addMenu(fileMenu);

    QMenu *viewMenu = new QMenu(tr("&View"), this);
    menuBar()->addMenu(viewMenu);

    QMenu *selectMenu = new QMenu(tr("&Selection"), this);
    menuBar()->addMenu(selectMenu);

    QMenu *helpMenu = new QMenu(tr("&Help"), this);
    menuBar()->addMenu(helpMenu);

    QAction *openAct = new QAction(tr("&Open..."), this);
    openAct->setShortcut(tr("Ctrl+O"));
    connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
    fileMenu->addAction(openAct);

    QAction *exitAct = new QAction(tr("E&xit"), this);
    exitAct->setShortcut(tr("Ctrl+Q"));
    connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
    fileMenu->addAction(exitAct);

    QAction *zoomInAct = new QAction(tr("Zoom &In (25%)"), this);
    zoomInAct->setShortcut(tr("Ctrl++"));
    connect(zoomInAct, SIGNAL(triggered()), this, SLOT(zoomIn()));
    viewMenu->addAction(zoomInAct);

    QAction *zoomOutAct = new QAction(tr("Zoom &Out (25%)"), this);
    zoomOutAct->setShortcut(tr("Ctrl+-"));
    connect(zoomOutAct, SIGNAL(triggered()), this, SLOT(zoomOut()));
    viewMenu->addAction(zoomOutAct);

    QAction *normalSizeAct = new QAction(tr("&Normal Size"), this);
    normalSizeAct->setShortcut(tr("Ctrl+0"));
    connect(normalSizeAct, SIGNAL(triggered()), this, SLOT(normalSize()));
    viewMenu->addAction(normalSizeAct);

    QAction *flipSectAct = new QAction(tr("&Show/Hide Section"), this);
    flipSectAct->setShortcut(tr("Ctrl+J"));
    connect(flipSectAct, SIGNAL(triggered()), this, SLOT(flipSectWin()));
    viewMenu->addAction(flipSectAct);

    QAction *flipSpecAct = new QAction(tr("&Show/Hide Spectrum"), this);
    flipSpecAct->setShortcut(tr("Ctrl+K"));
    connect(flipSpecAct, SIGNAL(triggered()), this, SLOT(flipSpecWin()));
    viewMenu->addAction(flipSpecAct);

    QAction *flipMainOptAct = new QAction(tr("&Show/Hide Image Viewer Options"), this);
    flipMainOptAct->setShortcut(tr("Ctrl+L"));
    connect(flipMainOptAct, SIGNAL(triggered()), this, SLOT(flipMainOpt()));
    viewMenu->addAction(flipMainOptAct);

    QAction *flipSectOptAct = new QAction(tr("&Show/Hide Section Viewer Options"), this);
    flipSectOptAct->setShortcut(tr("Ctrl+L"));
    connect(flipSectOptAct, SIGNAL(triggered()), this, SLOT(flipSectOpt()));
    viewMenu->addAction(flipSectOptAct);

    QAction *popAct = new QAction(tr("&Delete Last Point"), this);
    popAct->setShortcut(tr("Ctrl+N"));
    connect(popAct, SIGNAL(triggered()), this, SLOT(popPoint()));
    selectMenu->addAction(popAct);

    QAction *clearAct = new QAction(tr("&Delete All Points"), this);
    clearAct->setShortcut(tr("Ctrl+M"));
    connect(clearAct, SIGNAL(triggered()), this, SLOT(clearPoints()));
    selectMenu->addAction(clearAct);

    QAction *aboutAct = new QAction(tr("&About"), this);
    connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
    helpMenu->addAction(aboutAct);

    connect(m_maincan, SIGNAL(sample()), this, SLOT(sample()));
    connect(m_maincan, SIGNAL(moved(float, float)), this, SLOT(showMainPixel(float, float)));
    connect(m_sectwin, SIGNAL(moved(float, float)), this, SLOT(mapSect(float, float)));
}
Ejemplo n.º 5
0
QgsComposer::QgsComposer( QgisApp *qgis, const QString& title )
    : QMainWindow()
    , mTitle( title )
    , mUndoView( 0 )
{
  setupUi( this );
  setWindowTitle( mTitle );
  setupTheme();
  connect( mButtonBox, SIGNAL( rejected() ), this, SLOT( close() ) );

  QSettings settings;
  int size = settings.value( "/IconSize", QGIS_ICON_SIZE ).toInt();
  setIconSize( QSize( size, size ) );

#ifndef Q_WS_MAC
  setFontSize( settings.value( "/fontPointSize", QGIS_DEFAULT_FONTSIZE ).toInt() );
#endif

  QToolButton* orderingToolButton = new QToolButton( this );
  orderingToolButton->setPopupMode( QToolButton::InstantPopup );
  orderingToolButton->setAutoRaise( true );
  orderingToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  orderingToolButton->addAction( mActionRaiseItems );
  orderingToolButton->addAction( mActionLowerItems );
  orderingToolButton->addAction( mActionMoveItemsToTop );
  orderingToolButton->addAction( mActionMoveItemsToBottom );
  orderingToolButton->setDefaultAction( mActionRaiseItems );
  toolBar->addWidget( orderingToolButton );

  QToolButton* alignToolButton = new QToolButton( this );
  alignToolButton->setPopupMode( QToolButton::InstantPopup );
  alignToolButton->setAutoRaise( true );
  alignToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );

  alignToolButton->addAction( mActionAlignLeft );
  alignToolButton->addAction( mActionAlignHCenter );
  alignToolButton->addAction( mActionAlignRight );
  alignToolButton->addAction( mActionAlignTop );
  alignToolButton->addAction( mActionAlignVCenter );
  alignToolButton->addAction( mActionAlignBottom );
  alignToolButton->setDefaultAction( mActionAlignLeft );
  toolBar->addWidget( alignToolButton );

  QToolButton* shapeToolButton = new QToolButton( toolBar );
  shapeToolButton->setCheckable( true );
  shapeToolButton->setPopupMode( QToolButton::InstantPopup );
  shapeToolButton->setAutoRaise( true );
  shapeToolButton->setToolButtonStyle( Qt::ToolButtonIconOnly );
  shapeToolButton->addAction( mActionAddRectangle );
  shapeToolButton->addAction( mActionAddTriangle );
  shapeToolButton->addAction( mActionAddEllipse );
  shapeToolButton->setDefaultAction( mActionAddEllipse );
  toolBar->insertWidget( mActionAddArrow, shapeToolButton );

  QActionGroup* toggleActionGroup = new QActionGroup( this );
  toggleActionGroup->addAction( mActionMoveItemContent );
  toggleActionGroup->addAction( mActionAddNewMap );
  toggleActionGroup->addAction( mActionAddNewLabel );
  toggleActionGroup->addAction( mActionAddNewLegend );
  toggleActionGroup->addAction( mActionAddNewScalebar );
  toggleActionGroup->addAction( mActionAddImage );
  toggleActionGroup->addAction( mActionSelectMoveItem );
  toggleActionGroup->addAction( mActionAddRectangle );
  toggleActionGroup->addAction( mActionAddTriangle );
  toggleActionGroup->addAction( mActionAddEllipse );
  toggleActionGroup->addAction( mActionAddArrow );
  toggleActionGroup->addAction( mActionAddTable );
  toggleActionGroup->setExclusive( true );


  mActionAddNewMap->setCheckable( true );
  mActionAddNewLabel->setCheckable( true );
  mActionAddNewLegend->setCheckable( true );
  mActionSelectMoveItem->setCheckable( true );
  mActionAddNewScalebar->setCheckable( true );
  mActionAddImage->setCheckable( true );
  mActionMoveItemContent->setCheckable( true );
  mActionAddArrow->setCheckable( true );

#ifdef Q_WS_MAC
  QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) );
  appMenu->addAction( QgisApp::instance()->actionAbout() );
  appMenu->addAction( QgisApp::instance()->actionOptions() );
#endif

  QMenu *fileMenu = menuBar()->addMenu( tr( "File" ) );
  fileMenu->addAction( mActionLoadFromTemplate );
  fileMenu->addAction( mActionSaveAsTemplate );
  fileMenu->addSeparator();
  fileMenu->addAction( mActionExportAsImage );
  fileMenu->addAction( mActionExportAsPDF );
  fileMenu->addAction( mActionExportAsSVG );
  fileMenu->addSeparator();
  fileMenu->addAction( mActionPageSetup );
  fileMenu->addAction( mActionPrint );
  fileMenu->addSeparator();
  fileMenu->addAction( mActionQuit );
  QObject::connect( mActionQuit, SIGNAL( triggered() ), this, SLOT( close() ) );

  QMenu *viewMenu = menuBar()->addMenu( tr( "View" ) );
  viewMenu->addAction( mActionZoomIn );
  viewMenu->addAction( mActionZoomOut );
  viewMenu->addAction( mActionZoomAll );
  viewMenu->addSeparator();
  viewMenu->addAction( mActionRefreshView );

  QMenu *layoutMenu = menuBar()->addMenu( tr( "Layout" ) );
  layoutMenu->addAction( mActionUndo );
  layoutMenu->addAction( mActionRedo );
  layoutMenu->addSeparator();
  layoutMenu->addAction( mActionAddNewMap );
  layoutMenu->addAction( mActionAddNewLabel );
  layoutMenu->addAction( mActionAddNewScalebar );
  layoutMenu->addAction( mActionAddNewLegend );
  layoutMenu->addAction( mActionAddImage );
  layoutMenu->addAction( mActionSelectMoveItem );
  layoutMenu->addAction( mActionMoveItemContent );

  layoutMenu->addAction( mActionAddArrow );
  layoutMenu->addAction( mActionAddTable );
  layoutMenu->addSeparator();
  layoutMenu->addAction( mActionGroupItems );
  layoutMenu->addAction( mActionUngroupItems );
  layoutMenu->addAction( mActionRaiseItems );
  layoutMenu->addAction( mActionLowerItems );
  layoutMenu->addAction( mActionMoveItemsToTop );
  layoutMenu->addAction( mActionMoveItemsToBottom );

#ifdef Q_WS_MAC
#ifndef Q_WS_MAC64 /* assertion failure in NSMenuItem setSubmenu (Qt 4.5.0-snapshot-20080830) */
  menuBar()->addMenu( QgisApp::instance()->windowMenu() );

  menuBar()->addMenu( QgisApp::instance()->helpMenu() );
#endif
#endif

  mQgis = qgis;
  mFirstTime = true;

  // Create action to select this window
  mWindowAction = new QAction( windowTitle(), this );
  connect( mWindowAction, SIGNAL( triggered() ), this, SLOT( activate() ) );

  QgsDebugMsg( "entered." );

  setMouseTracking( true );
  mViewFrame->setMouseTracking( true );

  //create composer view
  mView = new QgsComposerView( mViewFrame );

  //init undo/redo buttons
  mComposition  = new QgsComposition( mQgis->mapCanvas()->mapRenderer() );

  mActionUndo->setEnabled( false );
  mActionRedo->setEnabled( false );
  if ( mComposition->undoStack() )
  {
    connect( mComposition->undoStack(), SIGNAL( canUndoChanged( bool ) ), mActionUndo, SLOT( setEnabled( bool ) ) );
    connect( mComposition->undoStack(), SIGNAL( canRedoChanged( bool ) ), mActionRedo, SLOT( setEnabled( bool ) ) );
  }
Ejemplo n.º 6
0
void
ChartView::selected( const QRectF& rc )
{
    QMenu menu;

	double x0 = this->transform( QwtPlot::xBottom, rc.left() );
	double x1 = this->transform( QwtPlot::xBottom, rc.right() );
    bool hasRange = int( std::abs( x1 - x0 ) ) > 2;

    int idx(0);
    if ( auto action = menu.addAction( tr( "Unzoom" ) ) ) {
        action->setData( idx++ ); // 0
        action->setEnabled( !hasRange );
    }
    if ( auto action = menu.addAction( tr( "Copy x-coordinate" ) ) ) {
        action->setData( idx++ ); // 1
        action->setEnabled( !hasRange );
    }
    if ( auto action = menu.addAction( tr( "Copy x,y-coordinate" ) ) ) {
        action->setData( idx++ ); // 2
        action->setEnabled( !hasRange );
    }
    menu.addAction( tr( "Copy image" ) )->setData( idx++ );             // 3
    menu.addAction( tr( "Copy SVG" ) )->setData( idx++ );               // 4
    menu.addAction( tr( "Save as SVG File..." ) )->setData( idx++ );    // 5
    if ( auto zoomer = findChild< adplot::Zoomer * >() ) {
        auto action = menu.addAction( tr( "Auto Y-Scale" ) );
        action->setData( idx++ );                                       // 6
        action->setCheckable( true );
        action->setChecked( zoomer->autoYScale() );
    }
    if ( auto action = menu.addAction( tr( "y-zoom" ) ) ) {
        action->setData( idx++ );                                       // 7
        action->setEnabled( hasRange );
    }
    if ( auto action = menu.addAction( tr( "Add time range to query" ) ) ) {
        action->setData( idx++ );                                       // 8
        action->setEnabled( hasRange );
    }
    if ( auto action = menu.addAction( tr( "Show query ranges" ) ) ) {
        action->setData( idx++ );                                       // 9
    }    

    QPointF pos = QPointF( rc.left(), rc.top() );

    if ( auto selected = menu.exec( QCursor::pos() ) ) {

        switch ( selected->data().toInt() ) {
        case 0:
            if ( auto zoomer = findChild< QwtPlotZoomer * >() )
                zoomer->setZoomStack( zoomer->zoomStack(), 0 );
            break;
        case 1:
            QApplication::clipboard()->setText( QString::number( pos.x(), 'g', 14 ) );
            break;
        case 2:
            QApplication::clipboard()->setText( QString( "%1, %2" ).arg( QString::number( pos.x(), 'g', 14 )
                                                                         , QString::number( pos.y(), 'g', 14 ) ) );
            break;
        case 3:
            copyToClipboard();
            break;
        case 4:
            saveImage( true );
            break;
        case 5:
            saveImage( false );
            break;
        case 6:
            findChild< adplot::Zoomer * >()->autoYScale( selected->isChecked() );
            break;
        case 7:
            yZoom( rc );
            break;            
        case 8:
            emit makeQuery( "COUNTING", rc, bool( axisTitle( QwtPlot::xBottom ).text().contains( "m/z" ) ) );
            break;
        case 9:
            emit makeQuery( "", rc, false ); // show
            break;            
        }
    }

}
Ejemplo n.º 7
0
	QMenu* SeparateTabWidget::GetTabMenu (int index)
	{
		QMenu *menu = new QMenu ();

		const auto widget = Widget (index);
		const auto imtw = qobject_cast<ITabWidget*> (widget);

		if (XmlSettingsManager::Instance ()->
				property ("ShowPluginMenuInTabs").toBool ())
		{
			bool asSub = XmlSettingsManager::Instance ()->
				property ("ShowPluginMenuInTabsAsSubmenu").toBool ();
			if (imtw)
			{
				const auto& tabActions = imtw->GetTabBarContextMenuActions ();

				QMenu *subMenu = asSub ?
						new QMenu (TabText (index), menu) :
						nullptr;
				for (auto act : tabActions)
					(asSub ? subMenu : menu)->addAction (act);

				if (asSub)
					menu->addMenu (subMenu);

				if (tabActions.size ())
					menu->addSeparator ();
			}
		}

		auto rootWM = Core::Instance ().GetRootWindowsManager ();
		const int windowIndex = rootWM->GetWindowIndex (Window_);

		auto moveMenu = menu->addMenu (tr ("Move tab to"));
		auto toNew = moveMenu->addAction (tr ("New window"),
				rootWM, SLOT (moveTabToNewWindow ()));
		toNew->setProperty ("TabIndex", index);
		toNew->setProperty ("FromWindowIndex", windowIndex);
		if (rootWM->GetWindowsCount () > 1)
		{
			moveMenu->addSeparator ();

			for (int i = 0; i < rootWM->GetWindowsCount (); ++i)
			{
				auto thatWin = rootWM->GetMainWindow (i);
				if (thatWin == Window_)
					continue;

				const auto& actTitle = tr ("To window %1 (%2)")
							.arg (i + 1)
							.arg (thatWin->windowTitle ());
				auto toExisting = moveMenu->addAction (actTitle,
						rootWM, SLOT (moveTabToExistingWindow ()));
				toExisting->setProperty ("TabIndex", index);
				toExisting->setProperty ("FromWindowIndex", windowIndex);
				toExisting->setProperty ("ToWindowIndex", i);
			}
		}

		const auto irt = qobject_cast<IRecoverableTab*> (widget);
		if (imtw &&
				irt &&
				(imtw->GetTabClassInfo ().Features_ & TabFeature::TFOpenableByRequest) &&
				!(imtw->GetTabClassInfo ().Features_ & TabFeature::TFSingle))
		{
			const auto cloneAct = menu->addAction (tr ("Clone tab"),
					this, SLOT (handleCloneTab ()));
			cloneAct->setProperty ("TabIndex", index);
			cloneAct->setProperty ("ActionIcon", "tab-duplicate");
		}

		for (auto act : TabBarActions_)
		{
			if (!act)
			{
				qWarning () << Q_FUNC_INFO
						<< "detected null pointer";
				continue;
			}
			menu->addAction (act);
		}

		Util::DefaultHookProxy_ptr proxy (new Util::DefaultHookProxy);
		emit hookTabContextMenuFill (proxy, menu, index,
				Core::Instance ().GetRootWindowsManager ()->GetWindowIndex (Window_));

		return menu;
	}
Ejemplo n.º 8
0
XmlConsole::XmlConsole(Client* client, QWidget *parent) :
	QWidget(parent),
	m_ui(new Ui::XmlConsole),
	m_client(client),	m_filter(0x1f)
{
	m_ui->setupUi(this);

    m_client->addXmlStreamHandler(this);

	QPalette pal = palette();
	pal.setColor(QPalette::Base, Qt::black);
	pal.setColor(QPalette::Text, Qt::white);
	m_ui->xmlBrowser->viewport()->setPalette(pal);
	QTextDocument *doc = m_ui->xmlBrowser->document();
	doc->setDocumentLayout(new QPlainTextDocumentLayout(doc));
	doc->clear();

	QTextFrameFormat format = doc->rootFrame()->frameFormat();
	format.setBackground(QColor(Qt::black));
	format.setMargin(0);
	doc->rootFrame()->setFrameFormat(format);
	QMenu *menu = new QMenu(m_ui->filterButton);
	menu->setSeparatorsCollapsible(false);
	menu->addSeparator()->setText(tr("Filter"));
	QActionGroup *group = new QActionGroup(menu);
	QAction *disabled = group->addAction(menu->addAction(tr("Disabled")));
	disabled->setCheckable(true);
	disabled->setData(Disabled);
	QAction *jid = group->addAction(menu->addAction(tr("By JID")));
	jid->setCheckable(true);
	jid->setData(ByJid);
	QAction *xmlns = group->addAction(menu->addAction(tr("By namespace uri")));
	xmlns->setCheckable(true);
	xmlns->setData(ByXmlns);
	QAction *attrb = group->addAction(menu->addAction(tr("By all attributes")));
	attrb->setCheckable(true);
	attrb->setData(ByAllAttributes);
	disabled->setChecked(true);
	connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionGroupTriggered(QAction*)));
	menu->addSeparator()->setText(tr("Visible stanzas"));
	group = new QActionGroup(menu);
	group->setExclusive(false);
	QAction *iq = group->addAction(menu->addAction(tr("Information query")));
	iq->setCheckable(true);
	iq->setData(XmlNode::Iq);
	iq->setChecked(true);
	QAction *message = group->addAction(menu->addAction(tr("Message")));
	message->setCheckable(true);
	message->setData(XmlNode::Message);
	message->setChecked(true);
	QAction *presence = group->addAction(menu->addAction(tr("Presence")));
	presence->setCheckable(true);
	presence->setData(XmlNode::Presence);
	presence->setChecked(true);
	QAction *custom = group->addAction(menu->addAction(tr("Custom")));
	custom->setCheckable(true);
	custom->setData(XmlNode::Custom);
	custom->setChecked(true);
	connect(group, SIGNAL(triggered(QAction*)), this, SLOT(onActionGroupTriggered(QAction*)));
	m_ui->filterButton->setMenu(menu);
	m_stackBracketsColor = QColor(0x666666);
	m_stackIncoming.bodyColor = QColor(0xbb66bb);
	m_stackIncoming.tagColor = QColor(0x006666);
	m_stackIncoming.attributeColor = QColor(0x009933);
	m_stackIncoming.paramColor = QColor(0xcc0000);
	m_stackOutgoing.bodyColor = QColor(0x999999);
	m_stackOutgoing.tagColor = QColor(0x22aa22);
	m_stackOutgoing.attributeColor = QColor(0xffff33);
	m_stackOutgoing.paramColor = QColor(0xdd8811);

	QAction *action = new QAction(tr("Close"),this);
	action->setSoftKeyRole(QAction::NegativeSoftKey);
	connect(action, SIGNAL(triggered()), SLOT(close()));
	addAction(action);
}
Ejemplo n.º 9
0
void BitcoinGUI::createMenuBar()
{
#ifdef Q_OS_MAC
    // Create a decoupled menu bar on Mac which stays even if the window is closed
    appMenuBar = new QMenuBar();
#else
    // Get the main window's menu bar on other platforms
    appMenuBar = menuBar();
#endif

    // Configure the menus
    QMenu *file = appMenuBar->addMenu(tr("&File"));
    if(walletFrame)
    {
        file->addAction(openAction);
        file->addAction(backupWalletAction);
        file->addAction(signMessageAction);
        file->addAction(verifyMessageAction);
        file->addSeparator();
        file->addAction(usedSendingAddressesAction);
        file->addAction(usedReceivingAddressesAction);
        file->addSeparator();
    }
    file->addAction(quitAction);

    QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
    if(walletFrame)
    {
        settings->addAction(encryptWalletAction);
        settings->addAction(changePassphraseAction);
        settings->addSeparator();
    }
    settings->addAction(optionsAction);

    QMenu *help = appMenuBar->addMenu(tr("&Help"));
    if(walletFrame)
    {
        help->addAction(openRPCConsoleAction);
    }
    help->addAction(showHelpMessageAction);
    help->addSeparator();
    help->addAction(aboutAction);
    help->addAction(aboutQtAction);
}
Ejemplo n.º 10
0
MainWindow::MainWindow(const QUrl& url) : m_dongle(new mobot_t)
{
    progress = 0;

    QFile file;
    file.setFileName(":/jquery.min.js");
    file.open(QIODevice::ReadOnly);
    jQuery = file.readAll();
    jQuery.append("\nvar qt = { 'jQuery': jQuery.noConflict(true) };");
    file.close();
//! [1]

    QNetworkProxyFactory::setUseSystemConfiguration(true);

    m_interface = new JsInterface(this);
//! [2]
    view = new QWebView(this);
    view->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
    view->load(url);
    connect(view, SIGNAL(loadFinished(bool)), SLOT(adjustLocation()));
    connect(view, SIGNAL(titleChanged(QString)), SLOT(adjustTitle()));
    connect(view, SIGNAL(loadProgress(int)), SLOT(setProgress(int)));
    connect(view, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool)));
    connect(view->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()),
            this, SLOT(populateJavaScriptWindowObject()));

    locationEdit = new QLineEdit(this);
    locationEdit->setSizePolicy(QSizePolicy::Expanding, locationEdit->sizePolicy().verticalPolicy());
    connect(locationEdit, SIGNAL(returnPressed()), SLOT(changeLocation()));

    QToolBar *toolBar = addToolBar(tr("Navigation"));
    toolBar->addAction(view->pageAction(QWebPage::Back));
    toolBar->addAction(view->pageAction(QWebPage::Forward));
    toolBar->addAction(view->pageAction(QWebPage::Reload));
    toolBar->addAction(view->pageAction(QWebPage::Stop));
    toolBar->addWidget(locationEdit);
//! [2]

    QMenu *viewMenu = menuBar()->addMenu(tr("&View"));
    QAction* viewSourceAction = new QAction("Page Source", this);
    connect(viewSourceAction, SIGNAL(triggered()), SLOT(viewSource()));
    viewMenu->addAction(viewSourceAction);

//! [3]
    QMenu *effectMenu = menuBar()->addMenu(tr("&Effect"));
    effectMenu->addAction("Highlight all links", this, SLOT(highlightAllLinks()));

    rotateAction = new QAction(this);
    rotateAction->setIcon(style()->standardIcon(QStyle::SP_FileDialogDetailedView));
    rotateAction->setCheckable(true);
    rotateAction->setText(tr("Turn images upside down"));
    connect(rotateAction, SIGNAL(toggled(bool)), this, SLOT(rotateImages(bool)));
    effectMenu->addAction(rotateAction);

    QMenu *toolsMenu = menuBar()->addMenu(tr("&Tools"));
    toolsMenu->addAction(tr("Remove GIF images"), this, SLOT(removeGifImages()));
    toolsMenu->addAction(tr("Remove all inline frames"), this, SLOT(removeInlineFrames()));
    toolsMenu->addAction(tr("Remove all object elements"), this, SLOT(removeObjectElements()));
    toolsMenu->addAction(tr("Remove all embedded elements"), this, SLOT(removeEmbeddedElements()));

    setCentralWidget(view);
    setUnifiedTitleAndToolBarOnMac(true);

    baroboInit();
    
    qDebug() << "App path : " << qApp->applicationDirPath();
}
QgsStyleV2ManagerDialog::QgsStyleV2ManagerDialog( QgsStyleV2* style, QWidget* parent )
    : QDialog( parent ), mStyle( style ), mModified( false )
{
  setupUi( this );
#ifdef Q_WS_MAC
  setWindowModality( Qt::WindowModal );
#endif

  QSettings settings;
  restoreGeometry( settings.value( "/Windows/StyleV2Manager/geometry" ).toByteArray() );
  mSplitter->setSizes( QList<int>() << 170 << 540 );
  mSplitter->restoreState( settings.value( "/Windows/StyleV2Manager/splitter" ).toByteArray() );

  tabItemType->setDocumentMode( true );
  searchBox->setPlaceholderText( tr( "Type here to filter symbols..." ) );

  // setup icons
  btnAddItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyAdd.png" ) ) );
  btnEditItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyEdit.png" ) ) );
  btnRemoveItem->setIcon( QIcon( QgsApplication::iconPath( "symbologyRemove.png" ) ) );
  btnShare->setIcon( QIcon( QgsApplication::iconPath( "user.png" ) ) );

  connect( this, SIGNAL( finished( int ) ), this, SLOT( onFinished() ) );

  connect( listItems, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( editItem() ) );

  connect( btnAddItem, SIGNAL( clicked() ), this, SLOT( addItem() ) );
  connect( btnEditItem, SIGNAL( clicked() ), this, SLOT( editItem() ) );
  connect( btnRemoveItem, SIGNAL( clicked() ), this, SLOT( removeItem() ) );

  QMenu *shareMenu = new QMenu( tr( "Share Menu" ), this );
  QAction *exportAction = shareMenu->addAction( tr( "Export" ) );
  QAction *importAction = shareMenu->addAction( tr( "Import" ) );
  connect( exportAction, SIGNAL( triggered() ), this, SLOT( exportItems() ) );
  connect( importAction, SIGNAL( triggered() ), this, SLOT( importItems() ) );
  btnShare->setMenu( shareMenu );

  // Set editing mode off by default
  mGrouppingMode = false;

  QStandardItemModel* model = new QStandardItemModel( listItems );
  listItems->setModel( model );
  listItems->setSelectionMode( QAbstractItemView::ExtendedSelection );

  connect( model, SIGNAL( itemChanged( QStandardItem* ) ), this, SLOT( itemChanged( QStandardItem* ) ) );
  connect( listItems->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
           this, SLOT( symbolSelected( const QModelIndex& ) ) );

  populateTypes();

  QStandardItemModel* groupModel = new QStandardItemModel( groupTree );
  groupTree->setModel( groupModel );
  groupTree->setHeaderHidden( true );
  populateGroups();
  connect( groupTree->selectionModel(), SIGNAL( currentChanged( const QModelIndex&, const QModelIndex& ) ),
           this, SLOT( groupChanged( const QModelIndex& ) ) );
  connect( groupModel, SIGNAL( itemChanged( QStandardItem* ) ),
           this, SLOT( groupRenamed( QStandardItem* ) ) );

  QMenu *groupMenu = new QMenu( tr( "Group Actions" ), this );
  QAction *groupSymbols = groupMenu->addAction( tr( "Group Symbols" ) );
  QAction *editSmartgroup = groupMenu->addAction( tr( "Edit Smart Group" ) );
  btnManageGroups->setMenu( groupMenu );
  connect( groupSymbols, SIGNAL( triggered() ), this, SLOT( groupSymbolsAction() ) );
  connect( editSmartgroup, SIGNAL( triggered() ), this, SLOT( editSmartgroupAction() ) );

  connect( btnAddGroup, SIGNAL( clicked() ), this, SLOT( addGroup() ) );
  connect( btnRemoveGroup, SIGNAL( clicked() ), this, SLOT( removeGroup() ) );

  on_tabItemType_currentChanged( 0 );

  connect( searchBox, SIGNAL( textChanged( QString ) ), this, SLOT( filterSymbols( QString ) ) );
  tagsLineEdit->installEventFilter( this );

  // Context menu for groupTree
  groupTree->setContextMenuPolicy( Qt::CustomContextMenu );
  connect( groupTree, SIGNAL( customContextMenuRequested( const QPoint& ) ),
           this, SLOT( grouptreeContextMenu( const QPoint& ) ) );

  // Context menu for listItems
  listItems->setContextMenuPolicy( Qt::CustomContextMenu );
  connect( listItems, SIGNAL( customContextMenuRequested( const QPoint& ) ),
           this, SLOT( listitemsContextMenu( const QPoint& ) ) );

}
Ejemplo n.º 12
0
    void setupUi(QMainWindow *MainWindow)
    {
        if (MainWindow->objectName().isEmpty())
            MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
        MainWindow->resize(999, 913);
        actionAbout = new QAction(MainWindow);
        actionAbout->setObjectName(QString::fromUtf8("actionAbout"));
        actionAtlas = new QAction(MainWindow);
        actionAtlas->setObjectName(QString::fromUtf8("actionAtlas"));
        actionMapping = new QAction(MainWindow);
        actionMapping->setObjectName(QString::fromUtf8("actionMapping"));
        actionLibrary = new QAction(MainWindow);
        actionLibrary->setObjectName(QString::fromUtf8("actionLibrary"));
        actionToolbox = new QAction(MainWindow);
        actionToolbox->setObjectName(QString::fromUtf8("actionToolbox"));
        centralwidget = new QWidget(MainWindow);
        centralwidget->setObjectName(QString::fromUtf8("centralwidget"));
        gridLayout = new QGridLayout(centralwidget);
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        mainSizer = new QGridLayout();
        mainSizer->setObjectName(QString::fromUtf8("mainSizer"));
        mainSizer->setVerticalSpacing(14);
        mainSizer->setContentsMargins(0, -1, -1, -1);
        renderFrame = new QFrame(centralwidget);
        renderFrame->setObjectName(QString::fromUtf8("renderFrame"));
        renderFrame->setMinimumSize(QSize(800, 600));
        renderFrame->setFrameShape(QFrame::Box);
        renderFrame->setFrameShadow(QFrame::Raised);

        mainSizer->addWidget(renderFrame, 0, 0, 1, 1);


        gridLayout->addLayout(mainSizer, 0, 0, 1, 1);

        MainWindow->setCentralWidget(centralwidget);
        menubar = new QMenuBar(MainWindow);
        menubar->setObjectName(QString::fromUtf8("menubar"));
        menubar->setGeometry(QRect(0, 0, 999, 21));
        menuFile = new QMenu(menubar);
        menuFile->setObjectName(QString::fromUtf8("menuFile"));
        menuTools = new QMenu(menubar);
        menuTools->setObjectName(QString::fromUtf8("menuTools"));
        menuAbout = new QMenu(menubar);
        menuAbout->setObjectName(QString::fromUtf8("menuAbout"));
        menuWindows = new QMenu(menubar);
        menuWindows->setObjectName(QString::fromUtf8("menuWindows"));
        MainWindow->setMenuBar(menubar);
        statusbar = new QStatusBar(MainWindow);
        statusbar->setObjectName(QString::fromUtf8("statusbar"));
        MainWindow->setStatusBar(statusbar);

        menubar->addAction(menuFile->menuAction());
        menubar->addAction(menuTools->menuAction());
        menubar->addAction(menuWindows->menuAction());
        menubar->addAction(menuAbout->menuAction());
        menuTools->addAction(actionAtlas);
        menuTools->addAction(actionMapping);
        menuAbout->addAction(actionAbout);
        menuWindows->addAction(actionLibrary);
        menuWindows->addAction(actionToolbox);

        retranslateUi(MainWindow);

        QMetaObject::connectSlotsByName(MainWindow);
    } // setupUi
Ejemplo n.º 13
0
void DataTreeView::showPopup(const QPoint & pos)
{
    DataTreeViewItem * item = 0 ;
    auto items = selectedItems ();
    if(items.count() == 0) 
        return;

    QMenu menu(this);
    QMenu addMenu(this);
    vector<Action*> actions;

    if(items.count() == 1)
    {
        item = static_cast<DataTreeViewItem*>(items.back());
        uint guid = item->getGuid();
        serialization::Node* pNode = m_pDataBase->getNode(guid);

        if(pNode == nullptr)
        {
            const phantom::data& d = m_pDataBase->getData(guid);
            reflection::Class* pClass = d.type()->asClass();
            const phantom::data& owner = m_pDataBase->getComponentDataOwner(d);
            if(owner.isNull())
            {
                // Data directly removed from a Node
                //menu.addAction(new RemoveDataAction(&menu, m_pDataBase->getNode(d), d));
            }
            else
            {
                // Data first removed from its owner
                o_assert(owner.type()->asClass());

            }

            // Display/Hide action
            /*if (d.type()->isKindOf(phantom::typeOf<physic::CollisionShape>()))
            {
            menu.addAction(new DisplayDataAction(&menu, d, this));
            menu.addAction(new HideDataAction(&menu, d, this));
            }*/
        }
        else
        {
            if(pNode->getState() == serialization::Node::e_Loaded)
            {
                addMenu.setTitle("add");
                addMenu.setIcon(QIcon("resources/icons/famfamfam/add.png"));
                menu.addMenu(&addMenu);
                Action* pAction = o_new(AddNodeAction)(this, pNode, m_AddNodeActionDelegate, this);
                addMenu.addAction(pAction);
                actions.push_back(pAction);
                if(pNode != m_pDataBase->rootNode()) 
                {
                    addMenu.addSeparator();
                    for(auto it = phantom::beginModules(); it != phantom::endModules(); ++it)
                    {
                        reflection::Module* pModule = it->second;
                        for(auto it = pModule->beginPackages(); it != pModule->endPackages(); ++it)
                        {
                            QMenu* packageMenu = new QMenu;
                            reflection::Package* pPackage = *it;
                            for(auto it = pPackage->beginSources(); it != pPackage->endSources(); ++it)
                            {
                                reflection::Source* pSource = *it;
                                for(auto it = pSource->beginElements(); it != pSource->endElements(); ++it)
                                {
                                    packageMenu->setTitle(pPackage->getName().c_str());
                                    reflection::Class* pClass = (*it)->asClass();
                                    if(pClass 
                                        AND pClass->isPublic()
                                        AND NOT(pClass->testModifiers(o_private_visibility)) 
                                        AND NOT(pClass->isAbstract())
                                        AND pClass->isDefaultConstructible()
                                        AND pClass->getSingleton() == nullptr)
                                    {
                                        Action* pAction = o_new(AddDataAction)(this, pNode, pClass, m_AddDataActionDelegate, packageMenu);
                                        packageMenu->addAction(pAction);
                                        actions.push_back(pAction);
                                    }
                                }
                            }
                            if(!packageMenu->isEmpty())
                            {
                                addMenu.addMenu(packageMenu);
                            }
                        }
                    }
                    menu.addSeparator();
                    if(pNode->getParentNode()) // If it's not the root node
                    {
                        Action* pAction = o_new(UnloadNodeAction)(this, pNode, m_UnloadNodeActionDelegate, &menu);
                        menu.addAction(pAction);
                        actions.push_back(pAction);
                    }
                }

            }
            else if(pNode->getState() == serialization::Node::e_Unloaded)
            {
                Action* pAction = o_new(LoadNodeAction)(this, pNode, m_LoadNodeActionDelegate, &menu);
                menu.addAction(pAction);
                actions.push_back(pAction);
                pAction = o_new(LoadNodeAction)(this, pNode, m_RecursiveLoadNodeActionDelegate, &menu);
                menu.addAction(pAction);
                actions.push_back(pAction);
            }
        }
    }
    {
        vector<uint> guids;
        for(auto it = items.begin(); it != items.end(); ++it)
        {
            guids.push_back(((DataTreeViewItem*)(*it))->getGuid());
        }
        RemoveDataAction* pRemoveDataAction = o_new(RemoveDataAction)(this, guids, m_RemoveDataActionDelegate, &menu) ;
        menu.addAction(pRemoveDataAction);
        actions.push_back(pRemoveDataAction);
    }
    if(NOT(menu.isEmpty()))
    {
        menu.exec(QCursor::pos());
    }
    for(auto it = actions.begin(); it != actions.end(); ++it)
    {
        o_dynamic_delete *it;
    }
}
Ejemplo n.º 14
0
ArrangerView::ArrangerView(QWidget* parent)
   : TopWin(TopWin::ARRANGER, parent, "arrangerview", Qt::Window)
{
  setWindowTitle(tr("MusE: Arranger"));
  setFocusPolicy(Qt::NoFocus);  

  arranger = new Arranger(this, "arranger");
  setCentralWidget(arranger);
  //setFocusProxy(arranger);

  scoreOneStaffPerTrackMapper = new QSignalMapper(this);
  scoreAllInOneMapper = new QSignalMapper(this);

  editSignalMapper = new QSignalMapper(this);

  // Toolbars ---------------------------------------------------------
  editTools = new EditToolBar(this, arrangerTools);
  addToolBar(editTools);
  editTools->setObjectName("arrangerTools");

  visTracks = new VisibleTracks(this);
  addToolBar(visTracks);



  connect(editTools, SIGNAL(toolChanged(int)), arranger, SLOT(setTool(int)));
  connect(visTracks, SIGNAL(visibilityChanged()), MusEGlobal::song, SLOT(update()) );
  connect(arranger, SIGNAL(editPart(MusECore::Track*)), MusEGlobal::muse, SLOT(startEditor(MusECore::Track*)));
  connect(arranger, SIGNAL(dropSongFile(const QString&)), MusEGlobal::muse, SLOT(loadProjectFile(const QString&)));
  connect(arranger, SIGNAL(dropMidiFile(const QString&)), MusEGlobal::muse, SLOT(importMidi(const QString&)));
  connect(arranger, SIGNAL(startEditor(MusECore::PartList*,int)),  MusEGlobal::muse, SLOT(startEditor(MusECore::PartList*,int)));
  connect(arranger, SIGNAL(toolChanged(int)), editTools, SLOT(set(int)));
  connect(MusEGlobal::muse, SIGNAL(configChanged()), arranger, SLOT(configChanged()));
  connect(arranger, SIGNAL(setUsedTool(int)), editTools, SLOT(set(int)));
  connect(arranger, SIGNAL(selectionChanged()), SLOT(selectionChanged()));
  connect(MusEGlobal::song, SIGNAL(songChanged(MusECore::SongChangedFlags_t)), this, SLOT(songChanged(MusECore::SongChangedFlags_t)));






  //-------- Edit Actions
  editDeleteAction = new QAction(QIcon(*deleteIcon), tr("D&elete"), this);
  editCutAction = new QAction(QIcon(*editcutIconSet), tr("C&ut"), this);
  editCopyAction = new QAction(QIcon(*editcopyIconSet), tr("&Copy"), this);
  editCopyRangeAction = new QAction(QIcon(*editcopyIconSet), tr("Copy in range"), this);
  editPasteAction = new QAction(QIcon(*editpasteIconSet), tr("&Paste"), this);
  editPasteCloneAction = new QAction(QIcon(*editpasteCloneIconSet), tr("Paste c&lone"), this);
  editPasteToTrackAction = new QAction(QIcon(*editpaste2TrackIconSet), tr("Paste to selected &track"), this);
  editPasteCloneToTrackAction = new QAction(QIcon(*editpasteClone2TrackIconSet), tr("Paste clone to selected trac&k"), this);
  editPasteDialogAction = new QAction(QIcon(*editpasteIconSet), tr("Paste (show dialo&g)"), this);
  editInsertEMAction = new QAction(QIcon(*editpasteIconSet), tr("&Insert Empty Measure"), this);
  editDeleteSelectedAction = new QAction(QIcon(*edit_track_delIcon), tr("Delete Selected Tracks"), this);
  editDuplicateSelTrackAction = new QAction(QIcon(*edit_track_addIcon), tr("Duplicate Selected Tracks"), this);

  editShrinkPartsAction = new QAction(tr("Shrink selected parts"), this);
  editExpandPartsAction = new QAction(tr("Expand selected parts"), this);
  editCleanPartsAction = new QAction(tr("Purge hidden events from selected parts"), this);


  addTrack = new QMenu(tr("Add Track"), this);
  addTrack->setIcon(QIcon(*edit_track_addIcon));
  select = new QMenu(tr("Select"), this);
  select->setIcon(QIcon(*selectIcon));

  editSelectAllAction = new QAction(QIcon(*select_allIcon), tr("Select &All"), this);
  editDeselectAllAction = new QAction(QIcon(*select_deselect_allIcon), tr("&Deselect All"), this);
  editInvertSelectionAction = new QAction(QIcon(*select_invert_selectionIcon), tr("Invert &Selection"), this);
  editInsideLoopAction = new QAction(QIcon(*select_inside_loopIcon), tr("&Inside Loop"), this);
  editOutsideLoopAction = new QAction(QIcon(*select_outside_loopIcon), tr("&Outside Loop"), this);
  editAllPartsAction = new QAction( QIcon(*select_all_parts_on_trackIcon), tr("All &Parts on Track"), this);

	
  scoreSubmenu = new QMenu(tr("Score"), this);
  scoreSubmenu->setIcon(QIcon(*scoreIconSet));

  scoreAllInOneSubsubmenu = new QMenu(tr("all tracks in one staff"), this);
  scoreOneStaffPerTrackSubsubmenu = new QMenu(tr("one staff per track"), this);

  scoreSubmenu->addMenu(scoreAllInOneSubsubmenu);
  scoreSubmenu->addMenu(scoreOneStaffPerTrackSubsubmenu);
  updateScoreMenus();

  startScoreEditAction = new QAction(*scoreIconSet, tr("New score window"), this);
  startPianoEditAction = new QAction(*pianoIconSet, tr("Pianoroll"), this);
  startDrumEditAction = new QAction(QIcon(*edit_drummsIcon), tr("Drums"), this);
  startListEditAction = new QAction(QIcon(*edit_listIcon), tr("List"), this);
  startWaveEditAction = new QAction(QIcon(*edit_waveIcon), tr("Wave"), this);

  master = new QMenu(tr("Mastertrack"), this);
  master->setIcon(QIcon(*edit_mastertrackIcon));
  masterGraphicAction = new QAction(QIcon(*mastertrack_graphicIcon),tr("Graphic"), this);
  masterListAction = new QAction(QIcon(*mastertrack_listIcon),tr("List"), this);

  midiTransformerAction = new QAction(QIcon(*midi_transformIcon), tr("Midi &Transform"), this);


  //-------- Structure Actions
  strGlobalCutAction = new QAction(tr("Global Cut"), this);
  strGlobalInsertAction = new QAction(tr("Global Insert"), this);
  strGlobalSplitAction = new QAction(tr("Global Split"), this);

  strGlobalCutSelAction = new QAction(tr("Global Cut - selected tracks"), this);
  strGlobalInsertSelAction = new QAction(tr("Global Insert - selected tracks"), this);
  strGlobalSplitSelAction = new QAction(tr("Global Split - selected tracks"), this);



  //-------------------------------------------------------------
  //    popup Edit
  //-------------------------------------------------------------

  QMenu* menuEdit = menuBar()->addMenu(tr("&Edit"));
  menuEdit->addActions(MusEGlobal::undoRedo->actions());
  menuEdit->addSeparator();

  menuEdit->addAction(editDeleteAction);
  menuEdit->addAction(editCutAction);
  menuEdit->addAction(editCopyAction);
  menuEdit->addAction(editCopyRangeAction);
  menuEdit->addAction(editPasteAction);
  menuEdit->addAction(editPasteToTrackAction);
  menuEdit->addAction(editPasteCloneAction);
  menuEdit->addAction(editPasteCloneToTrackAction);
  menuEdit->addAction(editPasteDialogAction);
  menuEdit->addAction(editInsertEMAction);
  menuEdit->addSeparator();
  menuEdit->addAction(editShrinkPartsAction);
  menuEdit->addAction(editExpandPartsAction);
  menuEdit->addAction(editCleanPartsAction);
  menuEdit->addSeparator();
  menuEdit->addAction(editDeleteSelectedAction);

  menuEdit->addMenu(addTrack);
  menuEdit->addAction(editDuplicateSelTrackAction);
  menuEdit->addMenu(select);
    select->addAction(editSelectAllAction);
    select->addAction(editDeselectAllAction);
    select->addAction(editInvertSelectionAction);
    select->addAction(editInsideLoopAction);
    select->addAction(editOutsideLoopAction);
    select->addAction(editAllPartsAction);
  menuEdit->addSeparator();

  menuEdit->addAction(startPianoEditAction);
  menuEdit->addMenu(scoreSubmenu);
  menuEdit->addAction(startScoreEditAction);
  menuEdit->addAction(startDrumEditAction);
  menuEdit->addAction(startListEditAction);
  menuEdit->addAction(startWaveEditAction);

  menuEdit->addMenu(master);
    master->addAction(masterGraphicAction);
    master->addAction(masterListAction);
  menuEdit->addSeparator();

  menuEdit->addAction(midiTransformerAction);

  QMenu* menuStructure = menuEdit->addMenu(tr("&Structure"));
    menuStructure->addAction(strGlobalCutAction);
    menuStructure->addAction(strGlobalInsertAction);
    menuStructure->addAction(strGlobalSplitAction);
    menuStructure->addSeparator();
    menuStructure->addAction(strGlobalCutSelAction);
    menuStructure->addAction(strGlobalInsertSelAction);
    menuStructure->addAction(strGlobalSplitSelAction);

  
  
  QMenu* functions_menu = menuBar()->addMenu(tr("Functions"));
		QAction* func_quantize_action = functions_menu->addAction(tr("&Quantize Notes"), editSignalMapper, SLOT(map()));
		QAction* func_notelen_action = functions_menu->addAction(tr("Change note &length"), editSignalMapper, SLOT(map()));
		QAction* func_velocity_action = functions_menu->addAction(tr("Change note &velocity"), editSignalMapper, SLOT(map()));
		QAction* func_cresc_action = functions_menu->addAction(tr("Crescendo/Decrescendo"), editSignalMapper, SLOT(map()));
		QAction* func_transpose_action = functions_menu->addAction(tr("Transpose"), editSignalMapper, SLOT(map()));
		QAction* func_erase_action = functions_menu->addAction(tr("Erase Events (Not Parts)"), editSignalMapper, SLOT(map()));
		QAction* func_move_action = functions_menu->addAction(tr("Move Events (Not Parts)"), editSignalMapper, SLOT(map()));
		QAction* func_fixed_len_action = functions_menu->addAction(tr("Set Fixed Note Length"), editSignalMapper, SLOT(map()));
		QAction* func_del_overlaps_action = functions_menu->addAction(tr("Delete Overlapping Notes"), editSignalMapper, SLOT(map()));
		QAction* func_legato_action = functions_menu->addAction(tr("Legato"), editSignalMapper, SLOT(map()));
		editSignalMapper->setMapping(func_quantize_action, CMD_QUANTIZE);
		editSignalMapper->setMapping(func_notelen_action, CMD_NOTELEN);
		editSignalMapper->setMapping(func_velocity_action, CMD_VELOCITY);
		editSignalMapper->setMapping(func_cresc_action, CMD_CRESCENDO);
		editSignalMapper->setMapping(func_transpose_action, CMD_TRANSPOSE);
		editSignalMapper->setMapping(func_erase_action, CMD_ERASE);
		editSignalMapper->setMapping(func_move_action, CMD_MOVE);
		editSignalMapper->setMapping(func_fixed_len_action, CMD_FIXED_LEN);
		editSignalMapper->setMapping(func_del_overlaps_action, CMD_DELETE_OVERLAPS);
		editSignalMapper->setMapping(func_legato_action, CMD_LEGATO);

  
  
  QMenu* menuSettings = menuBar()->addMenu(tr("Window &Config"));
  menuSettings->addAction(tr("Configure &custom columns"), this, SLOT(configCustomColumns()));
  menuSettings->addSeparator();
  menuSettings->addAction(subwinAction);
  menuSettings->addAction(shareAction);
  menuSettings->addAction(fullscreenAction);


  //-------- Edit connections
  connect(editDeleteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editCutAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editCopyAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editCopyRangeAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editPasteAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editPasteCloneAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editPasteToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editPasteCloneToTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editPasteDialogAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editInsertEMAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editDeleteSelectedAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editDuplicateSelTrackAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));

  connect(editShrinkPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editExpandPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editCleanPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));

  connect(editSelectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editDeselectAllAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editInvertSelectionAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editInsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editOutsideLoopAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
  connect(editAllPartsAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));

  editSignalMapper->setMapping(editDeleteAction, CMD_DELETE);
  editSignalMapper->setMapping(editCutAction, CMD_CUT);
  editSignalMapper->setMapping(editCopyAction, CMD_COPY);
  editSignalMapper->setMapping(editCopyRangeAction, CMD_COPY_RANGE);
  editSignalMapper->setMapping(editPasteAction, CMD_PASTE);
  editSignalMapper->setMapping(editPasteCloneAction, CMD_PASTE_CLONE);
  editSignalMapper->setMapping(editPasteToTrackAction, CMD_PASTE_TO_TRACK);
  editSignalMapper->setMapping(editPasteCloneToTrackAction, CMD_PASTE_CLONE_TO_TRACK);
  editSignalMapper->setMapping(editPasteDialogAction, CMD_PASTE_DIALOG);
  editSignalMapper->setMapping(editInsertEMAction, CMD_INSERTMEAS);
  editSignalMapper->setMapping(editDeleteSelectedAction, CMD_DELETE_TRACK);
  editSignalMapper->setMapping(editDuplicateSelTrackAction, CMD_DUPLICATE_TRACK);
  editSignalMapper->setMapping(editShrinkPartsAction, CMD_SHRINK_PART);
  editSignalMapper->setMapping(editExpandPartsAction, CMD_EXPAND_PART);
  editSignalMapper->setMapping(editCleanPartsAction, CMD_CLEAN_PART);
  editSignalMapper->setMapping(editSelectAllAction, CMD_SELECT_ALL);
  editSignalMapper->setMapping(editDeselectAllAction, CMD_SELECT_NONE);
  editSignalMapper->setMapping(editInvertSelectionAction, CMD_SELECT_INVERT);
  editSignalMapper->setMapping(editInsideLoopAction, CMD_SELECT_ILOOP);
  editSignalMapper->setMapping(editOutsideLoopAction, CMD_SELECT_OLOOP);
  editSignalMapper->setMapping(editAllPartsAction, CMD_SELECT_PARTS);

  connect(editSignalMapper, SIGNAL(mapped(int)), this, SLOT(cmd(int)));

  connect(startPianoEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startPianoroll()));
  connect(startScoreEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startScoreQuickly()));
  connect(startDrumEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startDrumEditor()));
  connect(startListEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startListEditor()));
  connect(startWaveEditAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startWaveEditor()));
  connect(scoreOneStaffPerTrackMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_oneStaffPerTrack(QWidget*)));
  connect(scoreAllInOneMapper, SIGNAL(mapped(QWidget*)), MusEGlobal::muse, SLOT(openInScoreEdit_allInOne(QWidget*)));


  connect(masterGraphicAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startMasterEditor()));
  connect(masterListAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startLMasterEditor()));

  connect(midiTransformerAction, SIGNAL(triggered()), MusEGlobal::muse, SLOT(startMidiTransformer()));


  //-------- Structure connections
  connect(strGlobalCutAction, SIGNAL(triggered()), SLOT(globalCut()));
  connect(strGlobalInsertAction, SIGNAL(triggered()), SLOT(globalInsert()));
  connect(strGlobalSplitAction, SIGNAL(triggered()), SLOT(globalSplit()));
  connect(strGlobalCutSelAction, SIGNAL(triggered()), SLOT(globalCutSel()));
  connect(strGlobalInsertSelAction, SIGNAL(triggered()), SLOT(globalInsertSel()));
  connect(strGlobalSplitSelAction, SIGNAL(triggered()), SLOT(globalSplitSel()));



  connect(MusEGlobal::muse, SIGNAL(configChanged()), SLOT(updateShortcuts()));


  QClipboard* cb = QApplication::clipboard();
  connect(cb, SIGNAL(dataChanged()), SLOT(clipboardChanged()));
  connect(cb, SIGNAL(selectionChanged()), SLOT(clipboardChanged()));

  finalizeInit();

  // work around for probable QT/WM interaction bug.
  // for certain window managers, e.g xfce, this window is
  // is displayed although not specifically set to show();
  // bug: 2811156     Softsynth GUI unclosable with XFCE4 (and a few others)
  // Nov 21, 2012 Hey this causes the thing not to open at all, EVER, on Lubuntu and some others!
  // And we had a request to remove this from a knowledgable tester. REMOVE Tim.
  ///show();
  ///hide();
}
Ejemplo n.º 15
0
static void* ui_companion_qt_init(void)
{
   ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
   MainWindow *mainwindow = NULL;
   QHBoxLayout *browserButtonsHBoxLayout = NULL;
   QVBoxLayout *layout = NULL;
   QVBoxLayout *launchWithWidgetLayout = NULL;
   QHBoxLayout *coreComboBoxLayout = NULL;
   QMenuBar *menu = NULL;
   QDesktopWidget *desktop = NULL;
   QMenu *fileMenu = NULL;
   QMenu *editMenu = NULL;
   QMenu *viewMenu = NULL;
   QMenu *viewClosedDocksMenu = NULL;
   QMenu *toolsMenu = NULL;
   QMenu *updaterMenu = NULL;
   QMenu *helpMenu = NULL;
   QRect desktopRect;
   QDockWidget *thumbnailDock = NULL;
   QDockWidget *thumbnail2Dock = NULL;
   QDockWidget *thumbnail3Dock = NULL;
   QDockWidget *browserAndPlaylistTabDock = NULL;
   QDockWidget *coreSelectionDock = NULL;
   QTabWidget *browserAndPlaylistTabWidget = NULL;
   QWidget *widget = NULL;
   QWidget *browserWidget = NULL;
   QWidget *playlistWidget = NULL;
   QWidget *coreSelectionWidget = NULL;
   QWidget *launchWithWidget = NULL;
   ThumbnailWidget *thumbnailWidget = NULL;
   ThumbnailWidget *thumbnail2Widget = NULL;
   ThumbnailWidget *thumbnail3Widget = NULL;
   QPushButton *browserDownloadsButton = NULL;
   QPushButton *browserUpButton = NULL;
   QPushButton *browserStartButton = NULL;
   ThumbnailLabel *thumbnail = NULL;
   ThumbnailLabel *thumbnail2 = NULL;
   ThumbnailLabel *thumbnail3 = NULL;
   QAction *editSearchAction = NULL;
   QAction *loadCoreAction = NULL;
   QAction *unloadCoreAction = NULL;
   QAction *exitAction = NULL;
   QComboBox *launchWithComboBox = NULL;
   QSettings *qsettings = NULL;
   QListWidget *listWidget = NULL;
   int i = 0;

   if (!handle)
      return NULL;

   handle->app = static_cast<ui_application_qt_t*>(ui_application_qt.initialize());
   handle->window = static_cast<ui_window_qt_t*>(ui_window_qt.init());

   desktop = qApp->desktop();
   desktopRect = desktop->availableGeometry();

   mainwindow = handle->window->qtWindow;

   qsettings = mainwindow->settings();

   mainwindow->resize(qMin(desktopRect.width(), INITIAL_WIDTH), qMin(desktopRect.height(), INITIAL_HEIGHT));
   mainwindow->setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, mainwindow->size(), desktopRect));

   mainwindow->setWindowTitle("RetroArch");
   mainwindow->setDockOptions(QMainWindow::AnimatedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AllowTabbedDocks | GROUPED_DRAGGING);

   listWidget = mainwindow->playlistListWidget();

   widget = new FileDropWidget(mainwindow);
   widget->setObjectName("tableWidget");
   widget->setContextMenuPolicy(Qt::CustomContextMenu);

   QObject::connect(widget, SIGNAL(filesDropped(QStringList)), mainwindow, SLOT(onPlaylistFilesDropped(QStringList)));
   QObject::connect(widget, SIGNAL(deletePressed()), mainwindow, SLOT(deleteCurrentPlaylistItem()));
   QObject::connect(widget, SIGNAL(customContextMenuRequested(const QPoint&)), mainwindow, SLOT(onFileDropWidgetContextMenuRequested(const QPoint&)));

   layout = new QVBoxLayout();
   layout->addWidget(mainwindow->contentTableWidget());
   layout->addWidget(mainwindow->contentGridWidget());

   widget->setLayout(layout);

   mainwindow->setCentralWidget(widget);

   menu = mainwindow->menuBar();

   fileMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE));

   loadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_LOAD_CORE), mainwindow, SLOT(onLoadCoreClicked()));
   loadCoreAction->setShortcut(QKeySequence("Ctrl+L"));

   unloadCoreAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_UNLOAD_CORE), mainwindow, SLOT(onUnloadCoreMenuAction()));
   unloadCoreAction->setObjectName("unloadCoreAction");
   unloadCoreAction->setEnabled(false);
   unloadCoreAction->setShortcut(QKeySequence("Ctrl+U"));

   exitAction = fileMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_FILE_EXIT), mainwindow, SLOT(close()));
   exitAction->setShortcut(QKeySequence::Quit);

   editMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT));
   editSearchAction = editMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_EDIT_SEARCH), mainwindow->searchLineEdit(), SLOT(setFocus()));
   editSearchAction->setShortcut(QKeySequence::Find);

   viewMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW));
   viewClosedDocksMenu = viewMenu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_CLOSED_DOCKS));
   viewClosedDocksMenu->setObjectName("viewClosedDocksMenu");

   QObject::connect(viewClosedDocksMenu, SIGNAL(aboutToShow()), mainwindow, SLOT(onViewClosedDocksAboutToShow()));

   viewMenu->addSeparator();
   viewMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_ICONS), mainwindow, SLOT(onIconViewClicked()));
   viewMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_VIEW_TYPE_LIST), mainwindow, SLOT(onListViewClicked()));
   viewMenu->addSeparator();
   viewMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_VIEW_OPTIONS), mainwindow->viewOptionsDialog(), SLOT(showDialog()));

   toolsMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_TOOLS));
   updaterMenu = toolsMenu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ONLINE_UPDATER));
#ifdef Q_OS_WIN
   updaterMenu->addAction(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_UPDATE_RETROARCH_NIGHTLY), mainwindow, SLOT(updateRetroArchNightly()));
#endif
   helpMenu = menu->addMenu(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_HELP));
   helpMenu->addAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_DOCUMENTATION)), mainwindow, SLOT(showDocs()));
   helpMenu->addAction(QString(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_HELP_ABOUT)) + "...", mainwindow, SLOT(showAbout()));
   helpMenu->addAction("About Qt...", qApp, SLOT(aboutQt()));

   playlistWidget = new QWidget();
   playlistWidget->setLayout(new QVBoxLayout());
   playlistWidget->setObjectName("playlistWidget");

   playlistWidget->layout()->addWidget(mainwindow->playlistListWidget());

   browserWidget = new QWidget();
   browserWidget->setLayout(new QVBoxLayout());
   browserWidget->setObjectName("browserWidget");

   browserDownloadsButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_CORE_ASSETS_DIRECTORY));
   browserUpButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER_UP));
   browserStartButton = new QPushButton(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_FAVORITES));

   QObject::connect(browserDownloadsButton, SIGNAL(clicked()), mainwindow, SLOT(onBrowserDownloadsClicked()));
   QObject::connect(browserUpButton, SIGNAL(clicked()), mainwindow, SLOT(onBrowserUpClicked()));
   QObject::connect(browserStartButton, SIGNAL(clicked()), mainwindow, SLOT(onBrowserStartClicked()));

   browserButtonsHBoxLayout = new QHBoxLayout();
   browserButtonsHBoxLayout->addWidget(browserUpButton);
   browserButtonsHBoxLayout->addWidget(browserStartButton);
   browserButtonsHBoxLayout->addWidget(browserDownloadsButton);

   qobject_cast<QVBoxLayout*>(browserWidget->layout())->addLayout(browserButtonsHBoxLayout);
   browserWidget->layout()->addWidget(mainwindow->dirTreeView());

   browserAndPlaylistTabWidget = mainwindow->browserAndPlaylistTabWidget();
   browserAndPlaylistTabWidget->setObjectName("browserAndPlaylistTabWidget");

   /* Several functions depend on the same tab title strings here, so if you change these, make sure to change those too
    * setCoreActions()
    * onTabWidgetIndexChanged()
    * onCurrentListItemChanged()
    */
   browserAndPlaylistTabWidget->addTab(playlistWidget, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_PLAYLISTS));
   browserAndPlaylistTabWidget->addTab(browserWidget, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_TAB_FILE_BROWSER));

   browserAndPlaylistTabDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER), mainwindow);
   browserAndPlaylistTabDock->setObjectName("browserAndPlaylistTabDock");
   browserAndPlaylistTabDock->setProperty("default_area", Qt::LeftDockWidgetArea);
   browserAndPlaylistTabDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_MENU_DOCK_CONTENT_BROWSER));
   browserAndPlaylistTabDock->setWidget(browserAndPlaylistTabWidget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(browserAndPlaylistTabDock->property("default_area").toInt()), browserAndPlaylistTabDock);

   browserButtonsHBoxLayout->addItem(new QSpacerItem(browserAndPlaylistTabWidget->tabBar()->width(), 20, QSizePolicy::Expanding, QSizePolicy::Minimum));

   thumbnailWidget = new ThumbnailWidget();
   thumbnail2Widget = new ThumbnailWidget();
   thumbnail3Widget = new ThumbnailWidget();

   thumbnailWidget->setLayout(new QVBoxLayout());
   thumbnail2Widget->setLayout(new QVBoxLayout());
   thumbnail3Widget->setLayout(new QVBoxLayout());

   thumbnailWidget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail2Widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail3Widget->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

   thumbnail = new ThumbnailLabel();
   thumbnail->setObjectName("thumbnail");

   thumbnail2 = new ThumbnailLabel();
   thumbnail2->setObjectName("thumbnail2");

   thumbnail3 = new ThumbnailLabel();
   thumbnail3->setObjectName("thumbnail3");

   thumbnail->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail2->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
   thumbnail3->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));

   QObject::connect(mainwindow, SIGNAL(thumbnailChanged(const QPixmap&)), thumbnail, SLOT(setPixmap(const QPixmap&)));
   QObject::connect(mainwindow, SIGNAL(thumbnail2Changed(const QPixmap&)), thumbnail2, SLOT(setPixmap(const QPixmap&)));
   QObject::connect(mainwindow, SIGNAL(thumbnail3Changed(const QPixmap&)), thumbnail3, SLOT(setPixmap(const QPixmap&)));

   thumbnailWidget->layout()->addWidget(thumbnail);
   thumbnail2Widget->layout()->addWidget(thumbnail2);
   thumbnail3Widget->layout()->addWidget(thumbnail3);

   thumbnailDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART), mainwindow);
   thumbnailDock->setObjectName("thumbnailDock");
   thumbnailDock->setProperty("default_area", Qt::RightDockWidgetArea);
   thumbnailDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_BOXART));
   thumbnailDock->setWidget(thumbnailWidget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(thumbnailDock->property("default_area").toInt()), thumbnailDock);

   thumbnail2Dock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN), mainwindow);
   thumbnail2Dock->setObjectName("thumbnail2Dock");
   thumbnail2Dock->setProperty("default_area", Qt::RightDockWidgetArea);
   thumbnail2Dock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_TITLE_SCREEN));
   thumbnail2Dock->setWidget(thumbnail2Widget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(thumbnail2Dock->property("default_area").toInt()), thumbnail2Dock);

   thumbnail3Dock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT), mainwindow);
   thumbnail3Dock->setObjectName("thumbnail3Dock");
   thumbnail3Dock->setProperty("default_area", Qt::RightDockWidgetArea);
   thumbnail3Dock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_THUMBNAIL_SCREENSHOT));
   thumbnail3Dock->setWidget(thumbnail3Widget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(thumbnail3Dock->property("default_area").toInt()), thumbnail3Dock);

   mainwindow->tabifyDockWidget(thumbnailDock, thumbnail2Dock);
   mainwindow->tabifyDockWidget(thumbnailDock, thumbnail3Dock);

   /* when tabifying the dock widgets, the last tab added is selected by default, so we need to re-select the first tab */
   thumbnailDock->raise();

   coreSelectionWidget = new QWidget();
   coreSelectionWidget->setLayout(new QVBoxLayout());

   launchWithComboBox = mainwindow->launchWithComboBox();

   launchWithWidgetLayout = new QVBoxLayout();

   launchWithWidget = new QWidget();
   launchWithWidget->setLayout(launchWithWidgetLayout);

   coreComboBoxLayout = new QHBoxLayout();

   mainwindow->runPushButton()->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
   mainwindow->stopPushButton()->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));
   mainwindow->startCorePushButton()->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding));

   coreComboBoxLayout->addWidget(launchWithComboBox);
   coreComboBoxLayout->addWidget(mainwindow->startCorePushButton());
   coreComboBoxLayout->addWidget(mainwindow->coreInfoPushButton());
   coreComboBoxLayout->addWidget(mainwindow->runPushButton());
   coreComboBoxLayout->addWidget(mainwindow->stopPushButton());

   mainwindow->stopPushButton()->hide();

   coreComboBoxLayout->setStretchFactor(launchWithComboBox, 1);

   launchWithWidgetLayout->addLayout(coreComboBoxLayout);

   coreSelectionWidget->layout()->addWidget(launchWithWidget);

   coreSelectionWidget->layout()->addItem(new QSpacerItem(20, browserAndPlaylistTabWidget->height(), QSizePolicy::Minimum, QSizePolicy::Expanding));

   coreSelectionDock = new QDockWidget(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE), mainwindow);
   coreSelectionDock->setObjectName("coreSelectionDock");
   coreSelectionDock->setProperty("default_area", Qt::LeftDockWidgetArea);
   coreSelectionDock->setProperty("menu_text", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_CORE));
   coreSelectionDock->setWidget(coreSelectionWidget);

   mainwindow->addDockWidget(static_cast<Qt::DockWidgetArea>(coreSelectionDock->property("default_area").toInt()), coreSelectionDock);

   mainwindow->splitDockWidget(browserAndPlaylistTabDock, coreSelectionDock, Qt::Vertical);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
   mainwindow->resizeDocks(QList<QDockWidget*>() << coreSelectionDock, QList<int>() << 1, Qt::Vertical);
#endif

   /* this should come last */
   mainwindow->resizeThumbnails(true, true, true);

   if (qsettings->contains("all_playlists_list_max_count"))
      mainwindow->setAllPlaylistsListMaxCount(qsettings->value("all_playlists_list_max_count", 0).toInt());

   if (qsettings->contains("all_playlists_grid_max_count"))
      mainwindow->setAllPlaylistsGridMaxCount(qsettings->value("all_playlists_grid_max_count", 5000).toInt());

   if (qsettings->contains("geometry"))
      if (qsettings->contains("save_geometry"))
         mainwindow->restoreGeometry(qsettings->value("geometry").toByteArray());

   if (qsettings->contains("save_dock_positions"))
      if (qsettings->contains("dock_positions"))
         mainwindow->restoreState(qsettings->value("dock_positions").toByteArray());

   if (qsettings->contains("theme"))
   {
      QString themeStr = qsettings->value("theme").toString();
      MainWindow::Theme theme = mainwindow->getThemeFromString(themeStr);

      if (qsettings->contains("custom_theme") && theme == MainWindow::THEME_CUSTOM)
      {
         QString customThemeFilePath = qsettings->value("custom_theme").toString();

         mainwindow->setCustomThemeFile(customThemeFilePath);
      }

      mainwindow->setTheme(theme);
   }
   else
      mainwindow->setTheme();

   if (qsettings->contains("view_type"))
   {
      QString viewType = qsettings->value("view_type", "list").toString();

      if (viewType == "list")
         mainwindow->setCurrentViewType(MainWindow::VIEW_TYPE_LIST);
      else if (viewType == "icons")
         mainwindow->setCurrentViewType(MainWindow::VIEW_TYPE_ICONS);
      else
         mainwindow->setCurrentViewType(MainWindow::VIEW_TYPE_LIST);

      /* we set it to the same thing a second time so that m_lastViewType is also equal to the startup view type */
      mainwindow->setCurrentViewType(mainwindow->getCurrentViewType());
   }
   else
      mainwindow->setCurrentViewType(MainWindow::VIEW_TYPE_LIST);

   /* We make sure to hook up the tab widget callback only after the tabs themselves have been added,
    * but before changing to a specific one, to avoid the callback firing before the view type is set.
    */
   QObject::connect(browserAndPlaylistTabWidget, SIGNAL(currentChanged(int)), mainwindow, SLOT(onTabWidgetIndexChanged(int)));

   /* setting the last tab must come after setting the view type */
   if (qsettings->contains("save_last_tab"))
   {
      int lastTabIndex = qsettings->value("last_tab", 0).toInt();

      if (lastTabIndex >= 0 && browserAndPlaylistTabWidget->count() > lastTabIndex)
      {
         browserAndPlaylistTabWidget->setCurrentIndex(lastTabIndex);
         mainwindow->onTabWidgetIndexChanged(lastTabIndex);
      }
   }
   else
   {
      browserAndPlaylistTabWidget->setCurrentIndex(0);
      mainwindow->onTabWidgetIndexChanged(0);
   }

   for (i = 0; i < listWidget->count() && listWidget->count() > 0; i++)
   {
      /* select the first non-hidden row */
      if (!listWidget->isRowHidden(i))
      {
         listWidget->setCurrentRow(i);
         break;
      }
   }

   return handle;
}
Ejemplo n.º 16
0
void ScoreView::createElementPropertyMenu(Element* e, QMenu* popup)
      {
      if (e->type() == BAR_LINE) {
            genPropertyMenu1(e, popup);
            }
      else if (e->type() == ARTICULATION) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Articulation Properties..."))->setData("a-props");
            }
      else if (e->type() == BEAM) {
            popup->addAction(getAction("flip"));
            }
      else if (e->type() == STEM) {
            popup->addAction(getAction("flip"));
            }
      else if (e->type() == HOOK) {
            popup->addAction(getAction("flip"));
            }
      else if (e->type() == BEND) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Bend Properties..."))->setData("b-props");
            }
      else if (e->type() == TREMOLOBAR) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("TremoloBar Properties..."))->setData("tr-props");
            }
      else if (e->type() == HBOX) {
            QMenu* textMenu = popup->addMenu(tr("Add"));
            textMenu->addAction(getAction("frame-text"));
            textMenu->addAction(getAction("picture"));
            popup->addAction(tr("Frame Properties..."))->setData("f-props");
            }
      else if (e->type() == VBOX) {
            QMenu* textMenu = popup->addMenu(tr("Add"));
            textMenu->addAction(getAction("frame-text"));
            textMenu->addAction(getAction("title-text"));
            textMenu->addAction(getAction("subtitle-text"));
            textMenu->addAction(getAction("composer-text"));
            textMenu->addAction(getAction("poet-text"));
            textMenu->addAction(getAction("insert-hbox"));
            textMenu->addAction(getAction("picture"));
            popup->addAction(tr("Frame Properties..."))->setData("f-props");
            }
      else if (e->type() == TBOX) {
            popup->addAction(tr("Frame Properties..."))->setData("f-props");
            }
      else if (e->type() == TUPLET) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Tuplet Properties..."))->setData("tuplet-props");
            }
      else if (e->type() == VOLTA_SEGMENT) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Volta Properties..."))->setData("v-props");
            }
      else if (e->type() == TIMESIG) {
            genPropertyMenu1(e, popup);
            TimeSig* ts = static_cast<TimeSig*>(e);
            int _track = ts->track();
            // if the time sig. is not generated (= not courtesy) and is in track 0
            // add the specific menu item
            QAction* a;
            if (!ts->generated() && !_track) {
                  a = popup->addAction(ts->showCourtesySig()
                     ? QT_TRANSLATE_NOOP("TimeSig", "Hide Courtesy Time Signature")
                     : QT_TRANSLATE_NOOP("TimeSig", "Show Courtesy Time Signature") );
                  a->setData("ts-courtesy");
                  }
            popup->addSeparator();
            popup->addAction(tr("Time Signature Properties..."))->setData("ts-props");
            }
      else if (e->type() == ACCIDENTAL) {
            Accidental* acc = static_cast<Accidental*>(e);
            genPropertyMenu1(e, popup);
            QAction* a = popup->addAction(QT_TRANSLATE_NOOP("Properties", "small"));
            a->setCheckable(true);
            a->setChecked(acc->small());
            a->setData("smallAcc");
            }
      else if (e->type() == CLEF) {
            genPropertyMenu1(e, popup);
            // if the clef is not generated (= not courtesy) add the specific menu item
            if (!e->generated()) {
                  QAction* a = popup->addAction(static_cast<Clef*>(e)->showCourtesy()
                     ? QT_TRANSLATE_NOOP("Clef", "Hide courtesy clef")
                     : QT_TRANSLATE_NOOP("Clef", "Show courtesy clef") );
                        a->setData("clef-courtesy");
                  }
            }
      else if (e->type() == DYNAMIC) {
            popup->addSeparator();
            if (e->visible())
                  popup->addAction(tr("Set Invisible"))->setData("invisible");
            else
                  popup->addAction(tr("Set Visible"))->setData("invisible");
            popup->addAction(tr("MIDI Properties..."))->setData("d-dynamics");
            popup->addAction(tr("Text Properties..."))->setData("d-props");
            }
      else if (e->type() == TEXTLINE_SEGMENT || e->type() == OTTAVA_SEGMENT) {
            if (e->visible())
                  popup->addAction(tr("Set Invisible"))->setData("invisible");
            else
                  popup->addAction(tr("Set Visible"))->setData("invisible");
            popup->addAction(tr("Line Properties..."))->setData("l-props");
            }
      else if (e->type() == STAFF_TEXT) {
            genPropertyMenuText(e, popup);
            popup->addAction(tr("Staff Text Properties..."))->setData("st-props");
            }
      else if (e->type() == TEXT || e->type() == FINGERING || e->type() == LYRICS) {
            genPropertyMenuText(e, popup);
            }
      else if (e->type() == TEMPO_TEXT) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Tempo Properties..."))->setData("tempo-props");
            popup->addAction(tr("Text Properties..."))->setData("text-props");
            }
      else if (e->type() == KEYSIG) {
            genPropertyMenu1(e, popup);
            KeySig* ks = static_cast<KeySig*>(e);
            if (!e->generated()) {
                  QAction* a = popup->addAction(ks->showCourtesy()
                     ? QT_TRANSLATE_NOOP("KeySig", "Hide Courtesy Key Signature")
                     : QT_TRANSLATE_NOOP("KeySig", "Show Courtesy Key Signature") );
                  a->setData("key-courtesy");
                  a = popup->addAction(ks->showNaturals()
                     ? QT_TRANSLATE_NOOP("KeySig", "Hide Naturals")
                     : QT_TRANSLATE_NOOP("KeySig", "Show Naturals") );
                  a->setData("key-naturals");
                  }
            }
      else if (e->type() == STAFF_STATE && static_cast<StaffState*>(e)->subtype() == STAFF_STATE_INSTRUMENT) {
            popup->addAction(tr("Change Instrument Properties..."))->setData("ss-props");
            }
      else if (e->type() == SLUR_SEGMENT) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Edit Mode"))->setData("edit");
            popup->addAction(tr("Slur Properties..."))->setData("slur-props");
            }
      else if (e->type() == REST) {
            Rest* rest = static_cast<Rest*>(e);
            genPropertyMenu1(e, popup);
            if (rest->tuplet()) {
                  popup->addSeparator();
                  QMenu* menuTuplet = popup->addMenu(tr("Tuplet..."));
                  menuTuplet->addAction(tr("Tuplet Properties..."))->setData("tuplet-props");
                  menuTuplet->addAction(tr("Delete Tuplet"))->setData("tupletDelete");
                  }
            }
      else if (e->type() == NOTE) {
            Note* note = static_cast<Note*>(e);

            QAction* b = popup->actions()[0];
            QAction* a = popup->insertSeparator(b);
            a->setText(tr("Staff"));
            a = new QAction(tr("Staff Properties..."), 0);
            a->setData("staff-props");
            popup->insertAction(b, a);

            a = popup->insertSeparator(b);
            a->setText(tr("Measure"));
            a = new QAction(tr("Measure Properties..."), 0);
            a->setData("measure-props");
            popup->insertAction(b, a);

            genPropertyMenu1(e, popup);
            popup->addSeparator();

            popup->addAction(tr("Style..."))->setData("style");

            if (note->chord()->tuplet()) {
                  QMenu* menuTuplet = popup->addMenu(tr("Tuplet..."));
                  menuTuplet->addAction(tr("Tuplet Properties..."))->setData("tuplet-props");
                  menuTuplet->addAction(tr("Delete Tuplet"))->setData("tupletDelete");
                  }
            popup->addAction(tr("Chord Articulation..."))->setData("articulation");
            }
      else if (e->type() == MARKER) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Marker Properties..."))->setData("marker-props");
            }
      else if (e->type() == JUMP) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Jump Properties..."))->setData("jump-props");
            }
      else if (e->type() == LAYOUT_BREAK && static_cast<LayoutBreak*>(e)->subtype() == LAYOUT_BREAK_SECTION) {
            popup->addAction(tr("Section Break Properties..."))->setData("break-props");
            }
      else if (e->type() == INSTRUMENT_CHANGE) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Change Instrument..."))->setData("ch-instr");
            }
      else if (e->type() == FRET_DIAGRAM) {
            if (e->visible())
                  popup->addAction(tr("Set Invisible"))->setData("invisible");
            else
                  popup->addAction(tr("Set Visible"))->setData("invisible");
            popup->addAction(tr("Color..."))->setData("color");
            popup->addAction(tr("Fret Diagram Properties..."))->setData("fret-props");
            }
      else if (e->type() == GLISSANDO) {
            genPropertyMenu1(e, popup);
            popup->addAction(tr("Glissando Properties..."))->setData("gliss-props");
            }
      else if (e->type() == HAIRPIN_SEGMENT) {
            QAction* a = popup->addSeparator();
            a->setText(tr("Dynamics"));
            if (e->visible())
                  a = popup->addAction(tr("Set Invisible"));
            else
                  a = popup->addAction(tr("Set Visible"));
            a->setData("invisible");
            popup->addAction(tr("Hairpin Properties..."))->setData("hp-props");
            }
      else if (e->type() == HARMONY) {
            genPropertyMenu1(e, popup);
            popup->addSeparator();
            popup->addAction(tr("Harmony Properties..."))->setData("ha-props");
            popup->addAction(tr("Text Properties..."))->setData("text-props");
            }
      else if (e->type() == INSTRUMENT_NAME) {
            popup->addAction(tr("Staff Properties..."))->setData("staff-props");
            }
      else
            genPropertyMenu1(e, popup);
      }
Ejemplo n.º 17
0
KeyCaptureTestApp::KeyCaptureTestApp( QWidget *parent) : QMainWindow(parent)
{   
    TX_ENTRY
    
    qApp->installEventFilter(this);
    QCoreApplication::instance()->installEventFilter(this);
    
    
	setWindowTitle(tr("KeyCaptureTestApp"));
    
    mKeyCapture = new XQKeyCapture();
    
    mKeysMap.insert("Up", Qt::Key_Up);
    mKeysMap.insert("Down", Qt::Key_Down);
    mKeysMap.insert("Menu", Qt::Key_Menu);
    
    
    mKeysMenu = new QMenu(this);
    foreach (QString value, mKeysMap.keys())
        mKeysMenu->addAction(value)->setData( QVariant(value) );
    
    mLongFlagsMap.insert("LongNormal", XQKeyCapture::LongNormal);
    mLongFlagsMap.insert("LongRepeatEvents", XQKeyCapture::LongRepeatEvents);
    mLongFlagsMap.insert("LongShortEventImmediately", XQKeyCapture::LongShortEventImmediately);
    mLongFlagsMap.insert("LongWaitNotApplicable", XQKeyCapture::LongWaitNotApplicable);
    mLongFlagsMap.insert("LongWaitShort", XQKeyCapture::LongWaitShort);
    
    mLongFlagsMenu = new QMenu(this);
    foreach (QString value, mLongFlagsMap.keys())
        mLongFlagsMenu->addAction(value)->setData( QVariant(value) );
    
	QMenu *captureMenu = menuBar()->addMenu(QString("Capture"));
    connect(captureMenu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*)));
	captureMenu->addAction(QString("Key"))->setData( QVariant(1) );
	captureMenu->addAction(QString("Long Key"))->setData( QVariant(2) );
	captureMenu->addAction(QString("Up and Down Key"))->setData( QVariant(3) );

	QMenu *cancelCaptureMenu = menuBar()->addMenu(QString("Cancel Capture"));
    connect(cancelCaptureMenu, SIGNAL(triggered(QAction*)), this, SLOT(triggered(QAction*)));
	cancelCaptureMenu->addAction(QString("Cancel Key"))->setData( QVariant(4) );
	cancelCaptureMenu->addAction(QString("Cancel Long Key"))->setData( QVariant(5) );
	cancelCaptureMenu->addAction(QString("Cancel Up and Down Key"))->setData( QVariant(6) );

    QMenu *remoteMenu = menuBar()->addMenu(QString("Remote"));

    // *** remcon ***
    
    remoteAllOn = remoteMenu->addAction(QString("Turn on all"));
    remoteAllOff = remoteMenu->addAction(QString("Turn off all"));
    
    toggleRemoteBasic = remoteMenu->addAction(QString("Basic Remote"));
    toggleRemoteBasic->setCheckable(true);
    
    toggleRemoteCallHandlingEx = remoteMenu->addAction(QString("Call Handl. Ex Remote"));
    toggleRemoteCallHandlingEx->setCheckable(true);

    toggleRemoteSideKeys = remoteMenu->addAction(QString("Side Keys Events"));
    toggleRemoteSideKeys->setCheckable(true);
    toggleRemoteSideKeys->setEnabled(false); // not implemented yet

    toggleRemoteExtEvents = remoteMenu->addAction(QString("Extended Remote Events"));
    toggleRemoteExtEvents->setCheckable(true);

    connect(toggleRemoteBasic, SIGNAL(toggled(bool)), this, SLOT(enableRemBasic(bool)));
    connect(toggleRemoteCallHandlingEx, SIGNAL(toggled(bool)), this, SLOT(enableRemCallHandlingEx(bool)));
    connect(toggleRemoteSideKeys, SIGNAL(toggled(bool)), this, SLOT(enableRemoteSideKeys(bool)));
    connect(toggleRemoteExtEvents, SIGNAL(toggled(bool)), this, SLOT(enableRemoteExtEvents(bool)));

    connect(remoteAllOn, SIGNAL(triggered(bool)), this, SLOT(remoteAll(bool)));
    connect(remoteAllOff, SIGNAL(triggered(bool)), this, SLOT(remoteNone(bool)));
    
    // *** utilities ***

    connect(menuBar()->addAction(QString("Clear Log")), SIGNAL(triggered()), this, SLOT(cleanLog()));
    connect(menuBar()->addAction(QString("Exit")), SIGNAL(triggered()), qApp, SLOT(quit()));

    QWidget *window = new QWidget;
    QVBoxLayout* layout = new QVBoxLayout;

	mTextArea = new QPlainTextEdit("");
	mTextArea->setTextInteractionFlags(Qt::NoTextInteraction);
	QFont font = QFont(mTextArea->font());
	font.setPixelSize(10);
	mTextArea->setFont(font);
	
	layout->addWidget(new MyButton(mTextArea));
	
	layout->addWidget(mTextArea);
	
    window->setLayout(layout);
    setCentralWidget(window);
    window->show();;

    mappingPtr = new Mapping();
    
    TX_EXIT
}
Ejemplo n.º 18
0
MainWindow::MainWindow(QWidget *parent) :QMainWindow(parent),ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    int w, h;
    if (this->size().height() > qApp->desktop()->height())
        h = qApp->desktop()->height() - 150;
    else
        h = this->size().height();
    if (this->size().width() > qApp->desktop()->width())
        w = qApp->desktop()->width() - 150;
    else
        w = this->size().width();
    this->resize(w, h);
    QDir dir;
    dir.mkdir(QDir::currentPath()+"/tmp/");

    this->settingsWidget = new SettingsWidget;
    this->fileWidget = new FileWidget(this, this->settingsWidget);
//    this->fileWidget->settings = this->settingsWidget;
    win7.init(this->winId());

    this->shellWidget = NULL;
    this->screenshotWidget = NULL;
    this->phoneInfoWidget = NULL;
    this->messageWidget = NULL;
    this->appWidget = NULL;
    this->recoveryWidget = NULL;
    this->fastbootWidget = NULL;
    this->logcatDialog = NULL;


    this->systemTray=new QSystemTrayIcon();
    this->systemTray->setIcon(QIcon(":/icons/android.png"));
    this->systemTray->show();

    QMenu *menu = new QMenu;
    QAction *close,*logcat;
    logcat = menu->addAction(QIcon(":icons/logcat.png"),tr("Logcat", "action in system tray menu"),this,SLOT(showLogcat()));
    logcat->setData(QString("logcat"));
    close = menu->addAction(QIcon(":icons/remove.png"),tr("exit", "action in system tray menu"),this,SLOT(close()));
    close->setData(QString("exit"));
    this->systemTray->setContextMenu(menu);


    ui->stackedWidget->addWidget(this->settingsWidget);
    ui->stackedWidget->addWidget(this->fileWidget);
    ui->stackedWidget->setCurrentWidget(ui->pageDisconnected);

    ui->pageDisconnected->setLayout(ui->layoutDisconnected);
    this->currentWidget=ui->pageDisconnected;

//    this->codec = QTextCodec::codecForLocale();

//    ////Debugging
    qDebug()<<QDateTime::currentDateTime().toString("dd-MM-yyyy hh:mm:ss");
    qDebug()<<"App version - "<<QCoreApplication::applicationVersion();

//    this->setWindowTitle("QtADB");

    this->ui->centralWidget->setLayout(ui->gridLayout);

    if (this->settingsWidget->saveWindowPosition)
        this->restoreGeometry(this->settingsWidget->windowGeometry);

    this->ui->toolBar->setMovable(false);

    this->addButton(QIcon(":icons/files.png"), tr("Files", "files button"), "Files" , SLOT(showPageFiles()), Action::Device | Action::Recovery);
    this->addButton(QIcon(":icons/apps.png"), tr("Apps", "apps button"), "Apps", SLOT(showPageApps()), Action::Device | Action::Recovery);
    this->addButton(QIcon(":icons/recovery.png"), tr("Recovery", "recovery button"), "Recovery", SLOT(showPageRecovery()), Action::Recovery);
    this->addButton(QIcon(":icons/fastboot.png"), tr("Fastboot", "fastbot button"), "Fastboot", SLOT(showPageFastboot()), Action::Fastboot);
    this->addButton(QIcon(":icons/info.png"), tr("Phone info", "phone info button"), "Phone info", SLOT(showPagePhoneInfo()), Action::Device | Action::Recovery | Action::Disconnected | Action::Fastboot);
    this->addButton(QIcon(":icons/screenshot.png"), tr("Screenshot", "screenshot button"), "Screenshot", SLOT(showPageScreenshot()), Action::Device | Action::Recovery);
    this->addButton(QIcon(":icons/settings.png"), tr("Settings", "settings button"), "Settings", SLOT(showPageSettings()), Action::Disconnected | Action::Device | Action::Recovery | Action::Fastboot);
    this->addButton(QIcon(":icons/shell.png"), tr("Shell", "shell button"), "Shell", SLOT(showPageShell()), Action::Device | Action::Recovery);
    this->addButton(QIcon(":icons/messages.png"), tr("Messages", "messages button"), "Messages", SLOT(showPageMessages()), Action::Device);
//    this->addButton(QIcon(":icons/contacts.png"), tr("Contacts"), SLOT(showPageContacts()), Action::Device);
    this->addButton(QIcon(":icons/logcat.png"), tr("Logcat", "logcat button"), "Logcat", SLOT(showLogcat()), Action::Device | Action::Recovery);


    this->changeToolBar();
    connect(this->fileWidget->phone,SIGNAL(signalConnectionChanged(int)),this,SLOT(phoneConnectionChanged(int)));
//    this->refreshState();
    connect(this->ui->actionAdbReboot, SIGNAL(triggered()), this->fileWidget->phone, SLOT(adbReboot()));
    connect(this->ui->actionAdbRebootBootloader, SIGNAL(triggered()), this->fileWidget->phone, SLOT(adbRebootBootloader()));
    connect(this->ui->actionAdbRebootRecovery, SIGNAL(triggered()), this->fileWidget->phone, SLOT(adbRebootRecovery()));
    connect(this->ui->actionFastbootReboot, SIGNAL(triggered()), this->fileWidget->phone, SLOT(fastbootReboot()));
    connect(this->ui->actionFastbootRebootBootloader, SIGNAL(triggered()), this->fileWidget->phone, SLOT(fastbootRebootBootloader()));


    connect(ui->actionFastbootPowerOff, SIGNAL(triggered()), this->fileWidget->phone, SLOT(fastbootPowerOff()));
    connect(ui->actionFastbootReboot, SIGNAL(triggered()), this->fileWidget->phone, SLOT(fastbootReboot()));
    connect(ui->actionFastbootRebootBootloader, SIGNAL(triggered()), this->fileWidget->phone, SLOT(fastbootRebootBootloader()));

    connect(this->ui->buttonRefresh, SIGNAL(clicked()), this, SLOT(refreshState()));
//    connect(this->fileWidget, SIGNAL(phoneConnectionChanged(int)), this, SLOT(phoneConnectionChanged(int)));

//    //tryb
    connect(this->ui->actionUsb, SIGNAL(triggered()), this, SLOT(restartInUsb()));
    connect(this->ui->actionWifi, SIGNAL(triggered()), this, SLOT(restartInWifi()));

//    //updates
    connect(this->ui->actionCheck_for_updates, SIGNAL(triggered()), this, SLOT(updatesCheck()));
    connect(&this->updateApp, SIGNAL(updateState(bool, QString, QString)), this, SLOT(updatesCheckFinished(bool, QString, QString)));

    connect(&this->animation.animation, SIGNAL(finished()), this, SLOT(animationFinished()));

    connect(this->systemTray, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(systemTrayActivated(QSystemTrayIcon::ActivationReason)));
    connect(this->systemTray, SIGNAL(messageClicked()), this, SLOT(showPageMessages()));
    connect(this->systemTray, SIGNAL(messageClicked()), this, SLOT(show()));
//
#ifdef WIN7PROGRESS
    connect(this->fileWidget, SIGNAL(progressValue(int,int)), this, SLOT(setProgressValue(int, int)));
    connect(this->fileWidget, SIGNAL(copyFinished(int)), this, SLOT(setProgressDisable()));
#endif

    connect(this->settingsWidget, SIGNAL(settingsChanged()), this, SLOT(changeToolBar()));
    this->settingsWidget->clearSettings = false;

    this->fillLanguages();
    this->showNoUpdates = false;
    if (this->settingsWidget->checkForUpdatesOnStart)
        this->updateApp.checkUpdates();

//    this->setWindowTitle("QtADB " + QString::number(this->height()) + "x" + QString::number(this->width()));
}
Ejemplo n.º 19
0
	void set_menu_bar(){
		QMenu* menu = menuBar()->addMenu("File");

		connect(menu->addAction("Open..."), &QAction::triggered, this, &main_window::select_open_files);
		connect(menu->addAction("Exit"), &QAction::triggered, this, &QWidget::close);
	}
Ejemplo n.º 20
0
void TabProgress::progressContextMenu(QPoint p)
{
  if (m_context_scene)
    return;
  QApplication::setOverrideCursor(Qt::WaitCursor);
  QTableWidgetItem* item = ui.table_list->itemAt(p);
  if (!item) {
    QApplication::restoreOverrideCursor();
    return;
  }
  int index = item->row();

  qDebug() << "Context menu at row " << index;

  // Set m_context_scene after locking to avoid threading issues.
  Scene* scene = qobject_cast<Scene*>(m_opt->tracker()->at(index));

  scene->lock()->lockForRead();

  m_context_scene = scene;

  QApplication::restoreOverrideCursor();

  Scene::State state = m_context_scene->getStatus();

  QMenu menu;
  QAction* a_restart = menu.addAction("&Restart job");
  QAction* a_kill = menu.addAction("&Kill structure");
  QAction* a_unkill = menu.addAction("Un&kill structure");
  QAction* a_resetFail = menu.addAction("Reset &failure count");
  menu.addSeparator();
  QAction* a_randomize = menu.addAction("Replace with &new random structure");

  // Connect actions
  connect(a_restart, SIGNAL(triggered()), this, SLOT(restartJobProgress()));
  connect(a_kill, SIGNAL(triggered()), this, SLOT(killSceneProgress()));
  connect(a_unkill, SIGNAL(triggered()), this, SLOT(unkillSceneProgress()));
  connect(a_resetFail, SIGNAL(triggered()), this,
          SLOT(resetFailureCountProgress()));
  connect(a_randomize, SIGNAL(triggered()), this,
          SLOT(randomizeStructureProgress()));

  if (state == Scene::Killed || state == Scene::Removed) {
    a_kill->setVisible(false);
    a_restart->setVisible(false);
  } else {
    a_unkill->setVisible(false);
  }

  m_context_scene->lock()->unlock();
  QAction* selection = menu.exec(QCursor::pos());

  if (selection == 0) {
    m_context_scene = 0;
    return;
  }
  QtConcurrent::run(this, &TabProgress::updateProgressTable);
  a_restart->disconnect();
  a_kill->disconnect();
  a_unkill->disconnect();
  a_resetFail->disconnect();
  a_randomize->disconnect();
}
Ejemplo n.º 21
0
void ListTasks::contextMenuEvent(QContextMenuEvent *event)
{
	Item* item = getCurrentItem();
	if( item == NULL) return;

	QMenu menu(this);
	QAction *action;

	int id = item->getId();
	switch( id)
	 {
		  case ItemJobBlock::ItemId:
		  {
				ItemJobBlock *itemBlock = (ItemJobBlock*)item;
				if( itemBlock->files.size() )
				{
					 action = new QAction( "Browse Files...", this);
					 connect( action, SIGNAL( triggered() ), this, SLOT( actBrowseFolder() ));
					 menu.addAction( action);
					 menu.addSeparator();
				}

				QMenu * submenu = new QMenu( "Change Block", this);
				itemBlock->generateMenu( itemBlock->getNumBlock(), &menu, this, submenu);

				menu.addMenu( submenu);
				menu.addSeparator();

				submenu = new QMenu( "Change Tasks", this);
				menu.addMenu( submenu);

				action = new QAction( "Set Command", this);
				connect( action, SIGNAL( triggered() ), this, SLOT( actBlockCommand() ));
				submenu->addAction( action);

				action = new QAction( "Set Working Directory", this);
				connect( action, SIGNAL( triggered() ), this, SLOT( actBlockWorkingDir() ));
				submenu->addAction( action);

				action = new QAction( "Set Post Command", this);
				connect( action, SIGNAL( triggered() ), this, SLOT( actBlockCmdPost() ));
				submenu->addAction( action);

				action = new QAction( "Set Files", this);
				connect( action, SIGNAL( triggered() ), this, SLOT( actBlockFiles() ));
				submenu->addAction( action);

				action = new QAction( "Set Service Type", this);
				connect( action, SIGNAL( triggered() ), this, SLOT( actBlockService() ));
				submenu->addAction( action);

				action = new QAction( "Set Parser Type", this);
				connect( action, SIGNAL( triggered() ), this, SLOT( actBlockParser() ));
				submenu->addAction( action);

				break;
		  }
		case ItemJobTask::ItemId:
		{
			ActionId * actionid = new ActionId( 0, "Output", this);
			connect( actionid, SIGNAL( triggeredId( int ) ), this, SLOT( actTaskStdOut( int ) ));
			menu.addAction( actionid);

			if( m_job_id != AFJOB::SYSJOB_ID )
			{
				int startCount = ((ItemJobTask*)(item))->taskprogress.starts_count;
				if( startCount > 1 )
				{
					QMenu * submenu = new QMenu( "outputs", this);
					for( int i = 1; i < startCount; i++)
					{
						actionid = new ActionId( i, QString("session #%1").arg(i), this);
						connect( actionid, SIGNAL( triggeredId( int ) ), this, SLOT( actTaskStdOut( int ) ));
						submenu->addAction( actionid);
					}
					menu.addMenu( submenu);
				}
			}

			action = new QAction( "Log", this);
			connect( action, SIGNAL( triggered() ), this, SLOT( actTaskLog() ));
			menu.addAction( action);

			action = new QAction( "Info", this);
			connect( action, SIGNAL( triggered() ), this, SLOT( actTaskInfo() ));
			menu.addAction( action);

			action = new QAction( "Listen", this);
			connect( action, SIGNAL( triggered() ), this, SLOT( actTaskListen() ));
			menu.addAction( action);

			action = new QAction( "Error Hosts", this);
			connect( action, SIGNAL( triggered() ), this, SLOT( actTaskErrorHosts() ));
			menu.addAction( action);

			std::vector<std::string> files = ((ItemJobTask*)(item))->genFiles();
			if( files.size())
			{
				if( af::Environment::getPreviewCmds().size() > 0 )
				{
					menu.addSeparator();

					action = new QAction( "Browse Files...", this);
					connect( action, SIGNAL( triggered() ), this, SLOT( actBrowseFolder() ));
					menu.addAction( action);

				if( ((ItemJobTask*)(item))->isBlockNumeric() )
				{
					QMenu * submenu_cmd = new QMenu( "Preview", this);
					int p = 0;
					for( std::vector<std::string>::const_iterator it = af::Environment::getPreviewCmds().begin(); it != af::Environment::getPreviewCmds().end(); it++, p++)
					{
						if( files.size() > 1)
						{
							QString file = afqt::stoq((*it).c_str());
							QMenu * submenu_img = new QMenu( QString("%1").arg( file), this);
							for( int i = 0; i < files.size(); i++)
							{
								QString imgname = file.right(99);
								ActionIdId * actionid = new ActionIdId( p, i, imgname, this);
								connect( actionid, SIGNAL( triggeredId(int,int) ), this, SLOT( actTaskPreview(int,int) ));
								submenu_img->addAction( actionid);
							}
							submenu_cmd->addMenu( submenu_img);
						}
						else
						{
							ActionIdId * actionid = new ActionIdId( p, 0, QString("%1").arg( QString::fromUtf8((*it).c_str())), this);
							connect( actionid, SIGNAL( triggeredId(int,int) ), this, SLOT( actTaskPreview(int,int) ));
							submenu_cmd->addAction( actionid);
						}
					}
Ejemplo n.º 22
0
void game_list_frame::ShowSpecifiedContextMenu(const QPoint &pos, int row)
{
	if (row == -1)
	{
		return; // invalid
	}

	QPoint globalPos;

	if (m_isListLayout)
	{
		globalPos = gameList->mapToGlobal(pos);
	}
	else
	{
		globalPos = m_xgrid->mapToGlobal(pos);
	}

	QMenu myMenu;

	// Make Actions
	QAction* boot = myMenu.addAction(tr("&Boot"));
	QFont f = boot->font();
	f.setBold(true);
	boot->setFont(f);
	QAction* configure = myMenu.addAction(tr("&Configure"));
	myMenu.addSeparator();
	QAction* removeGame = myMenu.addAction(tr("&Remove"));
	QAction* removeConfig = myMenu.addAction(tr("&Remove Custom Configuration"));
	myMenu.addSeparator();
	QAction* openGameFolder = myMenu.addAction(tr("&Open Install Folder"));
	QAction* openConfig = myMenu.addAction(tr("&Open Config Folder"));
	myMenu.addSeparator();
	QAction* checkCompat = myMenu.addAction(tr("&Check Game Compatibility"));

	connect(boot, &QAction::triggered, [=]() {Boot(row); });
	connect(configure, &QAction::triggered, [=]() {
		settings_dialog(xgui_settings, m_Render_Creator, this, &m_game_data[row].info).exec();
	});
	connect(removeGame, &QAction::triggered, [=]() {
		if (QMessageBox::question(this, tr("Confirm Delete"), tr("Permanently delete files?")) == QMessageBox::Yes)
		{
			fs::remove_all(Emu.GetGameDir() + m_game_data[row].info.root);
			m_game_data.erase(m_game_data.begin() + row);
			Refresh();
		}
	});
	connect(removeConfig, &QAction::triggered, [=]() {RemoveCustomConfiguration(row); });
	connect(openGameFolder, &QAction::triggered, [=]() {open_dir(Emu.GetGameDir() + m_game_data[row].info.root); });
	connect(openConfig, &QAction::triggered, [=]() {open_dir(fs::get_config_dir() + "data/" + m_game_data[row].info.serial); });
	connect(checkCompat, &QAction::triggered, [=]() {
		QString serial = qstr(m_game_data[row].info.serial);
		QString link = "https://rpcs3.net/compatibility?g=" + serial;
		QDesktopServices::openUrl(QUrl(link));
	});

	//Disable options depending on software category
	QString category = qstr(m_game_data[row].info.category);

	if (category == category::disc_Game)
	{
		removeGame->setEnabled(false);
	}
	else if (category == category::audio_Video)
	{
		configure->setEnabled(false);
		removeConfig->setEnabled(false);
		openConfig->setEnabled(false);
		checkCompat->setEnabled(false);
	}
	else if (category == category::home || category == category::game_Data)
	{
		boot->setEnabled(false), f.setBold(false), boot->setFont(f);
		configure->setEnabled(false);
		removeConfig->setEnabled(false);
		openConfig->setEnabled(false);
		checkCompat->setEnabled(false);
	}

	myMenu.exec(globalPos);
}
Ejemplo n.º 23
0
MainWindow::MainWindow(Application *app)
    : QMainWindow(),
      m_application(app)
{
    app->setMainWindow(this);
    setDocumentMode(true);

    QCoreApplication::setOrganizationName("Dunnart");
    QCoreApplication::setOrganizationDomain("dunnart.org");
    QCoreApplication::setApplicationName("Dunnart");

    // Correct the look of the tab bar on OS X cocoa.
    app->setStyleSheet(
        "QGraphicsView {"
            "border: 0px;"
        "}"
#ifdef Q_OS_MAC
        "QTabBar::tab:top {"
            "font-family: \"Lucida Grande\";"
            "font-size: 11px;"
        "}"
#endif
    );

    // Set the window title.
    setWindowTitle("Dunnart");

    setUnifiedTitleAndToolBarOnMac(true);

    m_tab_widget = new CanvasTabWidget(this);    
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            this, SLOT(canvasChanged(Canvas*)));
    connect(m_tab_widget, SIGNAL(currentCanvasFileInfoChanged(QFileInfo)),
            this, SLOT(canvasFileInfoChanged(QFileInfo)));
    m_tab_widget->newTab();
    setCentralWidget(m_tab_widget);
    app->setCanvasTabWidget(m_tab_widget);

    // Inital window size.
    resize(1020, 743);

    m_new_action = new QAction("New", this);
    m_new_action->setShortcut(QKeySequence::New);
    connect(m_new_action, SIGNAL(triggered()), this, SLOT(documentNew()));

    m_open_action = new QAction("Open...", this);
    m_open_action->setShortcut(QKeySequence::Open);
    connect(m_open_action, SIGNAL(triggered()), this, SLOT(documentOpen()));

    for (int i = 0; i < MAX_RECENT_FILES; ++i)
    {
        m_action_open_recent_file[i] = new QAction(this);
        m_action_open_recent_file[i]->setVisible(false);
        connect(m_action_open_recent_file[i], SIGNAL(triggered()),
                this, SLOT(documentOpenRecent()));
    }

    m_close_action = new QAction("Close", this);
    m_close_action->setShortcut(QKeySequence::Close);
    connect(m_close_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasClose()));

    m_save_action = new QAction("Save", this);
    m_save_action->setShortcut(QKeySequence::Save);
    connect(m_save_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasSave()));

    m_save_as_action = new QAction("Save As...", this);
    m_save_as_action->setShortcut(QKeySequence::SaveAs);
    connect(m_save_as_action, SIGNAL(triggered()),
            m_tab_widget, SLOT(currentCanvasSaveAs()));

    m_export_action = new QAction("Export...", this);
    connect(m_export_action, SIGNAL(triggered()), this, SLOT(documentExport()));

    m_print_action = new QAction("Print...", this);
    m_print_action->setShortcut(QKeySequence::Print);
    connect(m_print_action, SIGNAL(triggered()), this, SLOT(documentPrint()));

    m_quit_action = new QAction(tr("Quit"), this);
    m_quit_action->setShortcut(QKeySequence::Quit);
    connect(m_quit_action, SIGNAL(triggered()),
            this, SLOT(close()));

    m_about_action = new QAction(tr("About"), this);
    connect(m_about_action, SIGNAL(triggered()), this, SLOT(about()));

    m_homepage_action = new QAction(tr("Dunnart homepage"), this);
    connect(m_homepage_action, SIGNAL(triggered()), this, SLOT(openHomepage()));

    m_action_show_zoom_level_dialog = new QAction(
            tr("Zoom Level"), this);
    m_action_show_zoom_level_dialog->setCheckable(true);

    m_action_show_properties_editor_dialog = new QAction(
            tr("Properties Editor"), this);
    m_action_show_properties_editor_dialog->setCheckable(true);

    m_action_show_layout_properties_dialog = new QAction(
            tr("Layout Properties"), this);
    m_action_show_layout_properties_dialog->setCheckable(true);

    m_action_show_connector_properties_dialog = new QAction(
            tr("Connector Properties"), this);
    m_action_show_connector_properties_dialog->setCheckable(true);

    m_action_show_create_alignment_dialog = new QAction(
            tr("Create Alignments"), this);
    m_action_show_create_alignment_dialog->setCheckable(true);

    m_action_show_create_distribution_dialog = new QAction(
            tr("Create Distributions"), this);
    m_action_show_create_distribution_dialog->setCheckable(true);

    m_action_show_create_separation_dialog = new QAction(
            tr("Create Separations"), this);
    m_action_show_create_separation_dialog->setCheckable(true);

    m_action_show_create_template_dialog = new QAction(
            tr("Create Templates"), this);
    m_action_show_create_template_dialog->setShortcut(tr("Ctrl+T"));
    m_action_show_create_template_dialog->setCheckable(true);

    m_action_show_shape_picker_dialog = new QAction(
            tr("Shape Picker"), this);
    m_action_show_shape_picker_dialog->setCheckable(true);

    m_action_clear_recent_files = new QAction(tr("Clear Menu"), this);
    connect(m_action_clear_recent_files, SIGNAL(triggered()),
            this, SLOT(clearRecentFileMenu()));

    m_action_show_undo_history_dialog = new QAction(
            tr("Undo History"), this);
    m_action_show_undo_history_dialog->setCheckable(true);

    m_action_show_canvas_overview_dialog = new QAction(
            tr("Canvas Overview"), this);
    m_action_show_canvas_overview_dialog->setCheckable(true);

    m_action_show_main_canvas_overview_dialog = new QAction(
            tr("Hierarchical Overview"), this);
    m_action_show_main_canvas_overview_dialog->setCheckable(true);

    m_action_show_search_widget = new QAction(
            tr("Search"), this);
    m_action_show_search_widget->setCheckable(true);

    CanvasView *canvasview = m_tab_widget->currentCanvasView();
    Canvas *canvas = m_tab_widget->currentCanvas();

    // Create statusBar, and assign it to the canvas.
    canvas->setStatusBar(statusBar());

#ifdef Q_OS_MAC
    // Make the status bar font size slightly smaller.
    QFont statusBarFont = statusBar()->font();
    statusBarFont.setPointSize(statusBarFont.pointSize() - 2);
    statusBar()->setFont(statusBarFont);
#endif

    m_file_menu = menuBar()->addMenu("File");
    m_file_menu->addAction(m_new_action);
    m_file_menu->addAction(m_open_action);
    QMenu *recentsMenu = m_file_menu->addMenu(tr("Open Recent"));
    for (int i = 0; i < MAX_RECENT_FILES; ++i)
    {
        recentsMenu->addAction(m_action_open_recent_file[i]);
    }
    m_action_recent_file_separator = recentsMenu->addSeparator();
    recentsMenu->addAction(m_action_clear_recent_files);
    updateRecentFileActions();

    m_file_menu->addSeparator();
    m_file_menu->addAction(m_close_action);
    m_file_menu->addAction(m_save_action);
    m_file_menu->addAction(m_save_as_action);
    m_file_menu->addSeparator();
    m_file_menu->addAction(m_export_action);
    m_file_menu->addSeparator();
    m_file_menu->addAction(m_print_action);
    m_file_menu->addSeparator();
    m_file_menu->addAction(m_quit_action);

    m_edit_menu = menuBar()->addMenu(tr("Edit"));
    m_tab_widget->addEditMenuActions(m_edit_menu);

    m_view_menu = menuBar()->addMenu(tr("View"));
    QMenu *dialogs_menu = m_view_menu->addMenu(tr("Show Dialogs"));
    dialogs_menu->addAction(m_action_show_main_canvas_overview_dialog);
    dialogs_menu->addAction(m_action_show_canvas_overview_dialog);
    dialogs_menu->addAction(m_action_show_zoom_level_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_shape_picker_dialog);
    dialogs_menu->addAction(m_action_show_undo_history_dialog);
    dialogs_menu->addAction(m_action_show_properties_editor_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_create_alignment_dialog);
    dialogs_menu->addAction(m_action_show_create_distribution_dialog);
    dialogs_menu->addAction(m_action_show_create_separation_dialog);
    dialogs_menu->addAction(m_action_show_create_template_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_layout_properties_dialog);
    dialogs_menu->addAction(m_action_show_connector_properties_dialog);
    dialogs_menu->addSeparator();
    dialogs_menu->addAction(m_action_show_search_widget);
    QMenu *overlays_menu = m_view_menu->addMenu(tr("Canvas Debug Layers"));
    m_tab_widget->addDebugOverlayMenuActions(overlays_menu);

    m_layout_menu = menuBar()->addMenu("Layout");
    m_tab_widget->addLayoutMenuActions(m_layout_menu);
    
    m_dialog_zoomLevel = new ZoomLevel(canvasview);
    connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)),
            m_dialog_zoomLevel, SLOT(changeCanvasView(CanvasView*)));
    connect(m_action_show_zoom_level_dialog,  SIGNAL(triggered(bool)),
            m_dialog_zoomLevel, SLOT(setVisible(bool)));
    connect(m_dialog_zoomLevel, SIGNAL(visibilityChanged(bool)),
            m_action_show_zoom_level_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_zoomLevel);
    m_dialog_zoomLevel->show();

    m_dialog_properties_editor = new PropertiesEditorDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_properties_editor, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_properties_editor_dialog, SIGNAL(triggered(bool)),
            m_dialog_properties_editor, SLOT(setVisible(bool)));
    connect(m_dialog_properties_editor, SIGNAL(visibilityChanged(bool)),
            m_action_show_properties_editor_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::BottomDockWidgetArea, m_dialog_properties_editor);
    m_dialog_properties_editor->hide();

    m_dialog_shape_picker = new ShapePickerDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_shape_picker, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_shape_picker_dialog,  SIGNAL(triggered(bool)),
            m_dialog_shape_picker, SLOT(setVisible(bool)));
    connect(m_dialog_shape_picker, SIGNAL(visibilityChanged(bool)),
            m_action_show_shape_picker_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_shape_picker);
    m_dialog_shape_picker->show();

    m_dialog_layoutProps = new LayoutPropertiesDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_layoutProps, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_layout_properties_dialog,  SIGNAL(triggered(bool)),
            m_dialog_layoutProps, SLOT(setVisible(bool)));
    connect(m_dialog_layoutProps, SIGNAL(visibilityChanged(bool)),
            m_action_show_layout_properties_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_layoutProps);
    m_dialog_layoutProps->show();

    m_dialog_connectorProps = new ConnectorPropertiesDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_connectorProps, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_connector_properties_dialog,  SIGNAL(triggered(bool)),
            m_dialog_connectorProps, SLOT(setVisible(bool)));
    connect(m_dialog_connectorProps, SIGNAL(visibilityChanged(bool)),
            m_action_show_connector_properties_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_connectorProps);
    m_dialog_connectorProps->hide();

    m_dialog_alignment = new CreateAlignmentDialog(canvas);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_alignment, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_alignment_dialog,  SIGNAL(triggered(bool)),
            m_dialog_alignment, SLOT(setVisible(bool)));
    connect(m_dialog_alignment, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_alignment_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_alignment);
    m_dialog_alignment->show();

    m_dialog_distribution = new  CreateDistributionDialog(canvas, this);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_distribution, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_distribution_dialog,  SIGNAL(triggered(bool)),
            m_dialog_distribution, SLOT(setVisible(bool)));
    connect(m_dialog_distribution, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_distribution_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_distribution);
    m_dialog_distribution->show();

    m_dialog_separation = new CreateSeparationDialog(canvas, this);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_separation, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_separation_dialog,  SIGNAL(triggered(bool)),
            m_dialog_separation, SLOT(setVisible(bool)));
    connect(m_dialog_separation, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_separation_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::RightDockWidgetArea, m_dialog_separation);
    m_dialog_separation->show();

    m_dialog_template = new CreateTemplateDialog(canvas, this);
    connect(m_tab_widget, SIGNAL(currentCanvasChanged(Canvas*)),
            m_dialog_template, SLOT(changeCanvas(Canvas*)));
    connect(m_action_show_create_template_dialog,  SIGNAL(triggered(bool)),
            m_dialog_template, SLOT(setVisible(bool)));
    connect(m_dialog_template, SIGNAL(visibilityChanged(bool)),
            m_action_show_create_template_dialog,  SLOT(setChecked(bool)));
    m_dialog_template->hide();

    m_dialog_undo_history = new UndoHistoryDialog(
            m_tab_widget->undoGroup(), this);
    connect(m_action_show_undo_history_dialog,  SIGNAL(triggered(bool)),
            m_dialog_undo_history, SLOT(setVisible(bool)));
    connect(m_dialog_undo_history, SIGNAL(visibilityChanged(bool)),
            m_action_show_undo_history_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_undo_history);
    m_dialog_undo_history->hide();

    m_dialog_canvas_overview = new CanvasOverviewDialog(canvasview, this);
    connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)),
            m_dialog_canvas_overview, SLOT(changeCanvasView(CanvasView*)));
    connect(m_action_show_canvas_overview_dialog,  SIGNAL(triggered(bool)),
            m_dialog_canvas_overview, SLOT(setVisible(bool)));
    connect(m_dialog_canvas_overview, SIGNAL(visibilityChanged(bool)),
            m_action_show_canvas_overview_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_canvas_overview);
    m_dialog_canvas_overview->hide();

    m_dialog_main_canvas_overview = new MainCanvasOverviewDialog(canvasview, this);
    connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)),
            m_dialog_main_canvas_overview, SLOT(changeCanvasView(CanvasView*)));
    connect(m_action_show_main_canvas_overview_dialog,  SIGNAL(triggered(bool)),
            m_dialog_main_canvas_overview, SLOT(setVisible(bool)));
    connect(m_dialog_main_canvas_overview, SIGNAL(visibilityChanged(bool)),
            m_action_show_main_canvas_overview_dialog,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_dialog_main_canvas_overview);
    m_dialog_main_canvas_overview->hide();

    m_search_widget = new SearchWidget(canvasview, this);
    connect(m_tab_widget, SIGNAL(currentCanvasViewChanged(CanvasView*)),
            m_search_widget, SLOT(changeCanvasView(CanvasView*)));
    connect(m_action_show_search_widget,  SIGNAL(triggered(bool)),
            m_search_widget, SLOT(setVisible(bool)));
    connect(m_search_widget, SIGNAL(visibilityChanged(bool)),
            m_action_show_search_widget,  SLOT(setChecked(bool)));
    addDockWidget(Qt::LeftDockWidgetArea, m_search_widget);
    m_search_widget->hide();

    // Allow plugins to initialise themselves and add things like
    // menu items and dock widgets to the main window.
    PluginApplicationManager *appPluginManager =
            sharedPluginApplicationManager();
    appPluginManager->applicationMainWindowInitialised(app);

    // Add help menu after everything else (if should be rightmost).
    m_help_menu = menuBar()->addMenu(tr("Help"));
    m_help_menu->addAction(m_homepage_action);
    m_help_menu->addSeparator();
    m_help_menu->addAction(m_about_action);

    // Restore window geometry and Dock Widget geometry.
    QSettings settings;
    restoreGeometry(settings.value("geometry").toByteArray());
    restoreState(settings.value("windowState").toByteArray());

    // This must be created after the geometry has been restored, otherwise
    // the toolbar can be hidden in weird ways.
    m_edit_toolbar = new QToolBar(tr("Edit toolbar"), this);
    m_edit_toolbar->setObjectName("EditToolbar");
    m_edit_toolbar->setIconSize(QSize(24, 24));
    m_edit_toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    m_edit_toolbar->setMovable(false);
    m_tab_widget->addEditToolBarActions(m_edit_toolbar);

    addToolBar(Qt::TopToolBarArea, m_edit_toolbar);
}
Ejemplo n.º 24
0
void TabBar::contextMenuRequested(const QPoint &position)
{
    int index = tabAt(position);
    m_clickedTab = index;

    QMenu menu;
    menu.addAction(QIcon(":/icons/menu/popup.png"), tr("&New tab"), p_QupZilla, SLOT(addTab()));
    menu.addSeparator();
    if (index != -1) {
        WebTab* webTab = qobject_cast<WebTab*>(m_tabWidget->widget(m_clickedTab));
        if (!webTab) {
            return;
        }
        if (p_QupZilla->weView(m_clickedTab)->isLoading()) {
            menu.addAction(IconProvider::standardIcon(QStyle::SP_BrowserStop), tr("&Stop Tab"), this, SLOT(stopTab()));
        }
        else {
            menu.addAction(IconProvider::standardIcon(QStyle::SP_BrowserReload), tr("&Reload Tab"), this, SLOT(reloadTab()));
        }

        menu.addAction(tr("&Duplicate Tab"), this, SLOT(duplicateTab()));
        menu.addAction(webTab->isPinned() ? tr("Un&pin Tab") : tr("&Pin Tab"), this, SLOT(pinTab()));
        menu.addSeparator();
        menu.addAction(tr("Re&load All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("&Bookmark This Tab"), this, SLOT(bookmarkTab()));
        menu.addAction(tr("Bookmark &All Tabs"), p_QupZilla, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        QAction* action = p_QupZilla->actionRestoreTab();
        action->setEnabled(m_tabWidget->canRestoreTab());
        menu.addAction(action);
        menu.addSeparator();
        menu.addAction(tr("Close Ot&her Tabs"), this, SLOT(closeAllButCurrent()));
        menu.addAction(QIcon::fromTheme("window-close"), tr("Cl&ose"), this, SLOT(closeTab()));
        menu.addSeparator();
    }
    else {
        menu.addAction(tr("Reloa&d All Tabs"), m_tabWidget, SLOT(reloadAllTabs()));
        menu.addAction(tr("Bookmark &All Ta&bs"), p_QupZilla, SLOT(bookmarkAllTabs()));
        menu.addSeparator();
        QAction* action = menu.addAction(QIcon::fromTheme("user-trash"), tr("Restore &Closed Tab"), m_tabWidget, SLOT(restoreClosedTab()));
        action->setEnabled(m_tabWidget->canRestoreTab());
    }

    //Prevent choosing first option with double rightclick
    const QPoint &pos = mapToGlobal(position);
    QPoint p(pos.x(), pos.y() + 1);
    menu.exec(p);

    p_QupZilla->actionRestoreTab()->setEnabled(true);
}
Ejemplo n.º 25
0
StopmotionWidget::StopmotionWidget(MonitorManager *manager, const QUrl &projectFolder, const QList<QAction *> &actions, QWidget* parent) :
    QDialog(parent)
  , Ui::Stopmotion_UI()
  , m_projectFolder(projectFolder)
  , m_captureDevice(NULL)
  , m_sequenceFrame(0)
  , m_animatedIndex(-1)
  , m_animate(false)
  , m_manager(manager)
  , m_monitor(new StopmotionMonitor(manager, this))
{
    //setAttribute(Qt::WA_DeleteOnClose);
    //HACK: the monitor widget is hidden, it is just used to control the capturedevice from monitormanager
    m_monitor->setHidden(true);
    connect(m_monitor, SIGNAL(stopCapture()), this, SLOT(slotStopCapture()));
    m_manager->appendMonitor(m_monitor);
    QAction* analyze = new QAction(i18n("Send frames to color scopes"), this);
    analyze->setCheckable(true);
    analyze->setChecked(KdenliveSettings::analyse_stopmotion());
    connect(analyze, SIGNAL(triggered(bool)), this, SLOT(slotSwitchAnalyse(bool)));

    QAction* mirror = new QAction(i18n("Mirror display"), this);
    mirror->setCheckable(true);
    //mirror->setChecked(KdenliveSettings::analyse_stopmotion());
    connect(mirror, SIGNAL(triggered(bool)), this, SLOT(slotSwitchMirror(bool)));

    addActions(actions);
    setupUi(this);
    setWindowTitle(i18n("Stop Motion Capture"));
    setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));

    live_button->setIcon(QIcon::fromTheme(QStringLiteral("camera-photo")));

    m_captureAction = actions.at(0);
    connect(m_captureAction, SIGNAL(triggered()), this, SLOT(slotCaptureFrame()));
    m_captureAction->setCheckable(true);
    m_captureAction->setChecked(false);
    capture_button->setDefaultAction(m_captureAction);

    connect(actions.at(1), SIGNAL(triggered()), this, SLOT(slotSwitchLive()));

    QAction *intervalCapture = new QAction(i18n("Interval capture"), this);
    intervalCapture->setIcon(QIcon::fromTheme(QStringLiteral("chronometer")));
    intervalCapture->setCheckable(true);
    intervalCapture->setChecked(false);
    capture_interval->setDefaultAction(intervalCapture);

    preview_button->setIcon(QIcon::fromTheme(QStringLiteral("media-playback-start")));
    capture_button->setEnabled(false);


    // Build config menu
    QMenu* confMenu = new QMenu;
    m_showOverlay = actions.at(2);
    connect(m_showOverlay, SIGNAL(triggered(bool)), this, SLOT(slotShowOverlay(bool)));
    overlay_button->setDefaultAction(m_showOverlay);
    //confMenu->addAction(m_showOverlay);

    m_effectIndex = KdenliveSettings::stopmotioneffect();
    QMenu* effectsMenu = new QMenu(i18n("Overlay effect"));
    QActionGroup* effectGroup = new QActionGroup(this);
    QAction* noEffect = new QAction(i18n("No Effect"), effectGroup);
    noEffect->setData(0);
    QAction* contrastEffect = new QAction(i18n("Contrast"), effectGroup);
    contrastEffect->setData(1);
    QAction* edgeEffect = new QAction(i18n("Edge detect"), effectGroup);
    edgeEffect->setData(2);
    QAction* brightEffect = new QAction(i18n("Brighten"), effectGroup);
    brightEffect->setData(3);
    QAction* invertEffect = new QAction(i18n("Invert"), effectGroup);
    invertEffect->setData(4);
    QAction* thresEffect = new QAction(i18n("Threshold"), effectGroup);
    thresEffect->setData(5);

    effectsMenu->addAction(noEffect);
    effectsMenu->addAction(contrastEffect);
    effectsMenu->addAction(edgeEffect);
    effectsMenu->addAction(brightEffect);
    effectsMenu->addAction(invertEffect);
    effectsMenu->addAction(thresEffect);
    QList <QAction*> list = effectsMenu->actions();
    for (int i = 0; i < list.count(); ++i) {
        list.at(i)->setCheckable(true);
        if (list.at(i)->data().toInt() == m_effectIndex) {
            list.at(i)->setChecked(true);
        }
    }
    connect(effectsMenu, SIGNAL(triggered(QAction*)), this, SLOT(slotUpdateOverlayEffect(QAction*)));
    confMenu->addMenu(effectsMenu);

    QAction* showThumbs = new QAction(QIcon::fromTheme(QStringLiteral("image-x-generic")), i18n("Show sequence thumbnails"), this);
    showThumbs->setCheckable(true);
    showThumbs->setChecked(KdenliveSettings::showstopmotionthumbs());
    connect(showThumbs, SIGNAL(triggered(bool)), this, SLOT(slotShowThumbs(bool)));

    QAction* removeCurrent = new QAction(QIcon::fromTheme(QStringLiteral("edit-delete")), i18n("Delete current frame"), this);
    removeCurrent->setShortcut(Qt::Key_Delete);
    connect(removeCurrent, SIGNAL(triggered()), this, SLOT(slotRemoveFrame()));

    QAction* conf = new QAction(QIcon::fromTheme(QStringLiteral("configure")), i18n("Configure"), this);
    connect(conf, SIGNAL(triggered()), this, SLOT(slotConfigure()));

    confMenu->addAction(showThumbs);
    confMenu->addAction(removeCurrent);
    confMenu->addAction(analyze);
    confMenu->addAction(mirror);
    confMenu->addAction(conf);
    config_button->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
    config_button->setMenu(confMenu);

    connect(sequence_name, SIGNAL(textChanged(QString)), this, SLOT(sequenceNameChanged(QString)));
    connect(sequence_name, SIGNAL(currentIndexChanged(int)), live_button, SLOT(setFocus()));

    // Video widget holder
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins(0, 0, 0, 0);
    layout->setSpacing(0);

    if (KdenliveSettings::decklink_device_found()) {
        // Found a BlackMagic device
    }

    if (QFile::exists(KdenliveSettings::video4vdevice())) {
#ifdef USE_V4L
        // Video 4 Linux device detection
        for (int i = 0; i < 10; ++i) {
            QString path = "/dev/video" + QString::number(i);
            if (QFile::exists(path)) {
                QStringList deviceInfo = V4lCaptureHandler::getDeviceName(path);
                if (!deviceInfo.isEmpty()) {
                    capture_device->addItem(deviceInfo.at(0), "v4l");
                    capture_device->setItemData(capture_device->count() - 1, path, Qt::UserRole + 1);
                    capture_device->setItemData(capture_device->count() - 1, deviceInfo.at(1), Qt::UserRole + 2);
                    if (path == KdenliveSettings::video4vdevice()) capture_device->setCurrentIndex(capture_device->count() - 1);
                }
            }
        }
#endif /* USE_V4L */
    }

    connect(capture_device, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDeviceHandler()));
    /*if (m_bmCapture) {
        connect(m_bmCapture, SIGNAL(frameSaved(QString)), this, SLOT(slotNewThumb(QString)));
        connect(m_bmCapture, SIGNAL(gotFrame(QImage)), this, SIGNAL(gotFrame(QImage)));
    } else live_button->setEnabled(false);*/

    m_frame_preview = new MyLabel(this);
    connect(m_frame_preview, SIGNAL(seek(bool)), this, SLOT(slotSeekFrame(bool)));
    connect(m_frame_preview, SIGNAL(switchToLive()), this, SLOT(slotSwitchLive()));
    layout->addWidget(m_frame_preview);
    m_frame_preview->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    video_preview->setLayout(layout);

    ////qDebug()<<video_preview->winId();

    QString profilePath;
    // Create MLT producer data
    if (capture_device->itemData(capture_device->currentIndex()) == "v4l") {
        // Capture using a video4linux device
        profilePath = QStandardPaths::writableLocation(QStandardPaths::DataLocation) + "/profiles/video4linux";
    }
    else {
        // Decklink capture
        profilePath = KdenliveSettings::current_profile();
    }

    /*TODO:
    //m_captureDevice = new MltDeviceCapture(profilePath, m_monitor->videoSurface, this);
    m_captureDevice->sendFrameForAnalysis = KdenliveSettings::analyse_stopmotion();
    m_monitor->setRender(m_captureDevice);
    connect(m_captureDevice, SIGNAL(frameSaved(QString)), this, SLOT(slotNewThumb(QString)));
    */

    live_button->setChecked(false);
    button_addsequence->setEnabled(false);
    connect(live_button, SIGNAL(toggled(bool)), this, SLOT(slotLive(bool)));
    connect(button_addsequence, SIGNAL(clicked(bool)), this, SLOT(slotAddSequence()));
    connect(preview_button, SIGNAL(clicked(bool)), this, SLOT(slotPlayPreview(bool)));
    connect(frame_list, SIGNAL(currentRowChanged(int)), this, SLOT(slotShowSelectedFrame()));
    connect(frame_list, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotShowSelectedFrame()));
    connect(this, SIGNAL(doCreateThumbs(QImage,int)), this, SLOT(slotCreateThumbs(QImage,int)));

    frame_list->addAction(removeCurrent);
    frame_list->setContextMenuPolicy(Qt::ActionsContextMenu);
    frame_list->setHidden(!KdenliveSettings::showstopmotionthumbs());
    parseExistingSequences();
    QTimer::singleShot(500, this, SLOT(slotLive()));
    connect(&m_intervalTimer, SIGNAL(timeout()), this, SLOT(slotCaptureFrame()));
    m_intervalTimer.setSingleShot(true);
    m_intervalTimer.setInterval(KdenliveSettings::captureinterval() * 1000);
}
Ejemplo n.º 26
0
void MainWindow::initToolbar()
{

    QSize myIconSize(32,32);
    ui->mainToolBar->setIconSize( myIconSize );

    //添加文档按钮,添加文献的下拉菜单
    add_doc_button = new QToolButton( this );
    add_doc_button->setDefaultAction( ui->menu_action_add_file );

    QMenu * buttonMenu = new QMenu( this );
    buttonMenu->addAction( ui->menu_action_add_file );
    buttonMenu->addAction( ui->menu_action_add_category );
    buttonMenu->addAction( ui->menu_action_manual_input );
    buttonMenu->addAction( ui->menu_action_change_category );
    add_doc_button->setMenu( buttonMenu );
    add_doc_button->setPopupMode( QToolButton::MenuButtonPopup );
    ui->mainToolBar->addWidget( add_doc_button );

    //修改分类按钮
    change_category_button = new QToolButton( this );
    change_category_button->setDefaultAction( ui->menu_action_change_category );
    ui->mainToolBar->addWidget( change_category_button );

    //删除文档按钮
    del_doc_button = new QToolButton( this );
    del_doc_button->setDefaultAction( ui->menu_action_remove_file );
    ui->mainToolBar->addWidget( del_doc_button );

    //创建分类按钮
    create_category_button = new QToolButton( this );
    create_category_button->setDefaultAction( ui->menu_action_add_category );
    ui->mainToolBar->addWidget( create_category_button );

    //移除分类按钮
    remove_category_button = new QToolButton( this );
    remove_category_button->setDefaultAction( ui->menu_action_remove_category );
    ui->mainToolBar->addWidget( remove_category_button );

    //搜索框
    QWidget* spacer = new QWidget( this );

    spacer->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
    ui->mainToolBar->addWidget( spacer );
    searchSquare = new QLineEdit( this );

    searchSquare->setText(tr(""));
    searchSquare->setStyleSheet("QLineEdit {border:1px solid gray; border-radius:9px}");
    //searchSquare->setStyleSheet(" border-radius:10px ");

    searchSquare->setSizePolicy( QSizePolicy::Fixed,QSizePolicy::Fixed );


    //补充wordList
    //if(!myDao){
        myDao = Dao::getInstance();
    //}



    QCompleter *completer= new QCompleter(wordList);
    completer->setCompletionMode(QCompleter::PopupCompletion);
    completer->setCaseSensitivity(Qt::CaseInsensitive);
    searchSquare->setCompleter(completer);
    ui->mainToolBar->addWidget( searchSquare );
//    QWidget* spacer2 = new QWidget( this );





//    spacer2->setSizePolicy( QSizePolicy::Fixed,QSizePolicy::Expanding );
//    ui->mainToolBar->addWidget( spacer2 );
    initToolbarStyle();
    //myDao = Dao::getInstance();

}
Ejemplo n.º 27
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{
    setWindowTitle(tr("vedit"));
    resize(400, 300);

    NewAction = new QAction(tr("New"), this);
    NewAction->setShortcuts(QKeySequence::New);
    connect(NewAction, &QAction::triggered, this, &MainWindow::New);
    OpenAction = new QAction(tr("Open"), this);
    OpenAction->setShortcuts(QKeySequence::Open);
//    OpenAction->setStatusTip(tr("Open an existing file"));
    connect(OpenAction, &QAction::triggered, this, &MainWindow::Open);
    SaveAction = new QAction(tr("Save"), this);
    SaveAction->setShortcuts(QKeySequence::Save);
    connect(SaveAction, &QAction::triggered, this, &MainWindow::Save);
    SaveasAction = new QAction(tr("Save As"), this);
    SaveasAction->setShortcuts(QKeySequence::SaveAs);
    connect(SaveasAction, &QAction::triggered, this, &MainWindow::Saveas);
    CloseAction = new QAction(tr("Close"), this);
    CloseAction->setShortcuts(QKeySequence::Close);
    connect(CloseAction, &QAction::triggered, this, &MainWindow::Close);

    QMenu *menufile = menuBar()->addMenu(tr("File"));
    menufile->addAction(NewAction);
    menufile->addAction(OpenAction);
    menufile->addSeparator();
    menufile->addAction(SaveAction);
    menufile->addAction(SaveasAction);
    menufile->addSeparator();
    menufile->addAction(CloseAction);

    UndoAction = new QAction(tr("Undo"), this);
    UndoAction->setShortcuts(QKeySequence::Undo);
    connect(UndoAction, &QAction::triggered, this, &MainWindow::Undo);
    RedoAction = new QAction(tr("Redo"), this);
    RedoAction->setShortcuts(QKeySequence::Open);
    connect(RedoAction, &QAction::triggered, this, &MainWindow::Redo);
    CutAction = new QAction(tr("Cut"), this);
    CutAction->setShortcuts(QKeySequence::Cut);
    connect(CutAction, &QAction::triggered, this, &MainWindow::Cut);
    CopyAction = new QAction(tr("Copy"), this);
    CopyAction->setShortcuts(QKeySequence::Copy);
    connect(CopyAction, &QAction::triggered, this, &MainWindow::Copy);
    PasteAction = new QAction(tr("Paste"), this);
    PasteAction->setShortcuts(QKeySequence::Paste);
    connect(PasteAction, &QAction::triggered, this, &MainWindow::Paste);

    QMenu *menuedit = menuBar()->addMenu(tr("Edit"));
    menuedit->addAction(UndoAction);
    menuedit->addAction(RedoAction);
    menuedit->addSeparator();
    menuedit->addAction(CutAction);
    menuedit->addAction(CopyAction);
    menuedit->addAction(PasteAction);

    AboutAction = new QAction(tr("About"), this);
    connect(AboutAction, &QAction::triggered, this, &MainWindow::About);

    QMenu *menuhelp = menuBar()->addMenu(tr("help"));
    menuhelp->addAction(AboutAction);

    //statusBar();
}
Ejemplo n.º 28
0
MemoryWindow::MemoryWindow(running_machine* machine, QWidget* parent) :
	WindowQt(machine, nullptr)
{
	setWindowTitle("Debug: Memory View");

	if (parent != nullptr)
	{
		QPoint parentPos = parent->pos();
		setGeometry(parentPos.x()+100, parentPos.y()+100, 800, 400);
	}

	//
	// The main frame and its input and log widgets
	//
	QFrame* mainWindowFrame = new QFrame(this);

	// The top frame & groupbox that contains the input widgets
	QFrame* topSubFrame = new QFrame(mainWindowFrame);

	// The input edit
	m_inputEdit = new QLineEdit(topSubFrame);
	connect(m_inputEdit, &QLineEdit::returnPressed, this, &MemoryWindow::expressionSubmitted);

	// The memory space combo box
	m_memoryComboBox = new QComboBox(topSubFrame);
	m_memoryComboBox->setObjectName("memoryregion");
	m_memoryComboBox->setMinimumWidth(300);
	connect(m_memoryComboBox, static_cast<void(QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &MemoryWindow::memoryRegionChanged);

	// The main memory window
	m_memTable = new DebuggerMemView(DVT_MEMORY, m_machine, this);

	// Layout
	QHBoxLayout* subLayout = new QHBoxLayout(topSubFrame);
	subLayout->addWidget(m_inputEdit);
	subLayout->addWidget(m_memoryComboBox);
	subLayout->setSpacing(3);
	subLayout->setContentsMargins(2,2,2,2);

	QVBoxLayout* vLayout = new QVBoxLayout(mainWindowFrame);
	vLayout->setSpacing(3);
	vLayout->setContentsMargins(2,2,2,2);
	vLayout->addWidget(topSubFrame);
	vLayout->addWidget(m_memTable);

	setCentralWidget(mainWindowFrame);

	//
	// Menu bars
	//

	// Create a data format group
	QActionGroup* dataFormat = new QActionGroup(this);
	dataFormat->setObjectName("dataformat");
	QAction* formatActOne  = new QAction("1-byte chunks", this);
	QAction* formatActTwo  = new QAction("2-byte chunks", this);
	QAction* formatActFour = new QAction("4-byte chunks", this);
	QAction* formatActEight = new QAction("8-byte chunks", this);
	QAction* formatAct32bitFloat = new QAction("32 bit floating point", this);
	QAction* formatAct64bitFloat = new QAction("64 bit floating point", this);
	QAction* formatAct80bitFloat = new QAction("80 bit floating point", this);
	formatActOne->setObjectName("formatActOne");
	formatActTwo->setObjectName("formatActTwo");
	formatActFour->setObjectName("formatActFour");
	formatActEight->setObjectName("formatActEight");
	formatAct32bitFloat->setObjectName("formatAct32bitFloat");
	formatAct64bitFloat->setObjectName("formatAct64bitFloat");
	formatAct80bitFloat->setObjectName("formatAct80bitFloat");
	formatActOne->setCheckable(true);
	formatActTwo->setCheckable(true);
	formatActFour->setCheckable(true);
	formatActEight->setCheckable(true);
	formatAct32bitFloat->setCheckable(true);
	formatAct64bitFloat->setCheckable(true);
	formatAct80bitFloat->setCheckable(true);
	formatActOne->setActionGroup(dataFormat);
	formatActTwo->setActionGroup(dataFormat);
	formatActFour->setActionGroup(dataFormat);
	formatActEight->setActionGroup(dataFormat);
	formatAct32bitFloat->setActionGroup(dataFormat);
	formatAct64bitFloat->setActionGroup(dataFormat);
	formatAct80bitFloat->setActionGroup(dataFormat);
	formatActOne->setShortcut(QKeySequence("Ctrl+1"));
	formatActTwo->setShortcut(QKeySequence("Ctrl+2"));
	formatActFour->setShortcut(QKeySequence("Ctrl+4"));
	formatActEight->setShortcut(QKeySequence("Ctrl+8"));
	formatAct32bitFloat->setShortcut(QKeySequence("Ctrl+9"));
	formatActOne->setChecked(true);
	connect(dataFormat, &QActionGroup::triggered, this, &MemoryWindow::formatChanged);
	// Create a address display group
	QActionGroup* addressGroup = new QActionGroup(this);
	addressGroup->setObjectName("addressgroup");
	QAction* addressActLogical = new QAction("Logical Addresses", this);
	QAction* addressActPhysical = new QAction("Physical Addresses", this);
	addressActLogical->setCheckable(true);
	addressActPhysical->setCheckable(true);
	addressActLogical->setActionGroup(addressGroup);
	addressActPhysical->setActionGroup(addressGroup);
	addressActLogical->setShortcut(QKeySequence("Ctrl+G"));
	addressActPhysical->setShortcut(QKeySequence("Ctrl+Y"));
	addressActLogical->setChecked(true);
	connect(addressGroup, &QActionGroup::triggered, this, &MemoryWindow::addressChanged);

	// Create a reverse view radio
	QAction* reverseAct = new QAction("Reverse View", this);
	reverseAct->setObjectName("reverse");
	reverseAct->setCheckable(true);
	reverseAct->setShortcut(QKeySequence("Ctrl+R"));
	connect(reverseAct, &QAction::toggled, this, &MemoryWindow::reverseChanged);

	// Create increase and decrease bytes-per-line actions
	QAction* increaseBplAct = new QAction("Increase Bytes Per Line", this);
	QAction* decreaseBplAct = new QAction("Decrease Bytes Per Line", this);
	increaseBplAct->setShortcut(QKeySequence("Ctrl+P"));
	decreaseBplAct->setShortcut(QKeySequence("Ctrl+O"));
	connect(increaseBplAct, &QAction::triggered, this, &MemoryWindow::increaseBytesPerLine);
	connect(decreaseBplAct, &QAction::triggered, this, &MemoryWindow::decreaseBytesPerLine);

	// Assemble the options menu
	QMenu* optionsMenu = menuBar()->addMenu("&Options");
	optionsMenu->addActions(dataFormat->actions());
	optionsMenu->addSeparator();
	optionsMenu->addActions(addressGroup->actions());
	optionsMenu->addSeparator();
	optionsMenu->addAction(reverseAct);
	optionsMenu->addSeparator();
	optionsMenu->addAction(increaseBplAct);
	optionsMenu->addAction(decreaseBplAct);


	//
	// Initialize
	//
	populateComboBox();

	// Set to the current CPU's memory view
	setToCurrentCpu();
}
Ejemplo n.º 29
0
void BitcoinGUI::createMenuBar()
{
#ifdef Q_WS_MAC
    // Create a decoupled menu bar on Mac which stays even if the window is closed
    appMenuBar = new QMenuBar();
#else
    // Get the main window's menu bar on other platforms
    appMenuBar = menuBar();
#endif

    // Configure the menus
    QMenu *file = appMenuBar->addMenu(tr("&File"));
    file->addAction(backupWalletAction);
    file->addAction(exportAction);
#ifndef FIRST_CLASS_MESSAGING
    file->addAction(signMessageAction);
    file->addAction(verifyMessageAction);
#endif
    file->addSeparator();
    file->addAction(quitAction);

    QMenu *settings = appMenuBar->addMenu(tr("&Settings"));
    settings->addAction(encryptWalletAction);
    settings->addAction(changePassphraseAction);
    settings->addSeparator();
    settings->addAction(optionsAction);

    QMenu *help = appMenuBar->addMenu(tr("&Help"));
    help->addAction(openRPCConsoleAction);
    help->addSeparator();
    help->addAction(aboutAction);
    help->addAction(aboutQtAction);
}
QgsCategorizedSymbolRendererWidget::QgsCategorizedSymbolRendererWidget( QgsVectorLayer* layer, QgsStyle* style, QgsFeatureRenderer* renderer )
    : QgsRendererWidget( layer, style )
    , mRenderer( nullptr )
    , mModel( nullptr )
{

  // try to recognize the previous renderer
  // (null renderer means "no previous renderer")
  if ( renderer )
  {
    mRenderer = QgsCategorizedSymbolRenderer::convertFromRenderer( renderer );
  }
  if ( !mRenderer )
  {
    mRenderer = new QgsCategorizedSymbolRenderer( QLatin1String( "" ), QgsCategoryList() );
  }

  QString attrName = mRenderer->classAttribute();
  mOldClassificationAttribute = attrName;

  // setup user interface
  setupUi( this );

  mExpressionWidget->setLayer( mLayer );

  cboCategorizedColorRamp->populate( mStyle );
  int randomIndex = cboCategorizedColorRamp->findText( tr( "Random colors" ) );
  if ( randomIndex != -1 )
  {
    cboCategorizedColorRamp->setCurrentIndex( randomIndex );
    mButtonEditRamp->setEnabled( false );
  }

  // set project default color ramp
  QString defaultColorRamp = QgsProject::instance()->readEntry( QStringLiteral( "DefaultStyles" ), QStringLiteral( "/ColorRamp" ), QLatin1String( "" ) );
  if ( defaultColorRamp != QLatin1String( "" ) )
  {
    int index = cboCategorizedColorRamp->findText( defaultColorRamp, Qt::MatchCaseSensitive );
    if ( index >= 0 )
      cboCategorizedColorRamp->setCurrentIndex( index );
  }

  mCategorizedSymbol = QgsSymbol::defaultSymbol( mLayer->geometryType() );

  mModel = new QgsCategorizedSymbolRendererModel( this );
  mModel->setRenderer( mRenderer );

  // update GUI from renderer
  updateUiFromRenderer();

  viewCategories->setModel( mModel );
  viewCategories->resizeColumnToContents( 0 );
  viewCategories->resizeColumnToContents( 1 );
  viewCategories->resizeColumnToContents( 2 );

  viewCategories->setStyle( new QgsCategorizedSymbolRendererViewStyle( viewCategories->style() ) );

  connect( mModel, SIGNAL( rowsMoved() ), this, SLOT( rowsMoved() ) );
  connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( widgetChanged() ) );

  connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SLOT( categoryColumnChanged( QString ) ) );

  connect( viewCategories, SIGNAL( doubleClicked( const QModelIndex & ) ), this, SLOT( categoriesDoubleClicked( const QModelIndex & ) ) );
  connect( viewCategories, SIGNAL( customContextMenuRequested( const QPoint& ) ),  this, SLOT( contextMenuViewCategories( const QPoint& ) ) );

  connect( btnChangeCategorizedSymbol, SIGNAL( clicked() ), this, SLOT( changeCategorizedSymbol() ) );
  connect( btnAddCategories, SIGNAL( clicked() ), this, SLOT( addCategories() ) );
  connect( btnDeleteCategories, SIGNAL( clicked() ), this, SLOT( deleteCategories() ) );
  connect( btnDeleteAllCategories, SIGNAL( clicked() ), this, SLOT( deleteAllCategories() ) );
  connect( btnAddCategory, SIGNAL( clicked() ), this, SLOT( addCategory() ) );
  connect( cbxInvertedColorRamp, SIGNAL( toggled( bool ) ), this, SLOT( applyColorRamp() ) );
  connect( cboCategorizedColorRamp, SIGNAL( currentIndexChanged( int ) ), this, SLOT( applyColorRamp() ) );
  connect( cboCategorizedColorRamp, SIGNAL( sourceRampEdited() ), this, SLOT( applyColorRamp() ) );
  connect( mButtonEditRamp, SIGNAL( clicked() ), cboCategorizedColorRamp, SLOT( editSourceRamp() ) );

  // menus for data-defined rotation/size
  QMenu* advMenu = new QMenu;

  advMenu->addAction( tr( "Match to saved symbols" ), this, SLOT( matchToSymbolsFromLibrary() ) );
  advMenu->addAction( tr( "Match to symbols from file..." ), this, SLOT( matchToSymbolsFromXml() ) );
  advMenu->addAction( tr( "Symbol levels..." ), this, SLOT( showSymbolLevels() ) );

  btnAdvanced->setMenu( advMenu );

  mExpressionWidget->registerExpressionContextGenerator( this );
}