// ------------------
// HintProposalWidget
// ------------------
FunctionHintProposalWidget::FunctionHintProposalWidget()
    : d(new FunctionHintProposalWidgetPrivate)
{
    QToolButton *downArrow = new QToolButton;
    downArrow->setArrowType(Qt::DownArrow);
    downArrow->setFixedSize(16, 16);
    downArrow->setAutoRaise(true);

    QToolButton *upArrow = new QToolButton;
    upArrow->setArrowType(Qt::UpArrow);
    upArrow->setFixedSize(16, 16);
    upArrow->setAutoRaise(true);

    QHBoxLayout *pagerLayout = new QHBoxLayout(d->m_pager);
    pagerLayout->setMargin(0);
    pagerLayout->setSpacing(0);
    pagerLayout->addWidget(upArrow);
    pagerLayout->addWidget(d->m_numberLabel);
    pagerLayout->addWidget(downArrow);

    QHBoxLayout *popupLayout = new QHBoxLayout(d->m_popupFrame);
    popupLayout->setMargin(0);
    popupLayout->setSpacing(0);
    popupLayout->addWidget(d->m_pager);
    popupLayout->addWidget(d->m_hintLabel);

    connect(upArrow, SIGNAL(clicked()), SLOT(previousPage()));
    connect(downArrow, SIGNAL(clicked()), SLOT(nextPage()));

    qApp->installEventFilter(this);

    setFocusPolicy(Qt::NoFocus);
}
Example #2
0
void Task::setOpen(bool o) {
    QToolButton *b = m_header->toggleButton();
    if (b->isChecked() == o) {
        b->setChecked(o);
        if (b->arrowType()!=Qt::NoArrow) {
            if (o) {
                b->setArrowType(Qt::UpArrow);
            } else {
                b->setArrowType(Qt::DownArrow);
            }
        }
        QwwTaskPanel *tp = parent() ? qobject_cast<QwwTaskPanel*>(parent()->parent()->parent()->parent()) : 0;
        if(tp && tp->isAnimated()){
        if (m_animator.state()!=QTimeLine::NotRunning) {
            m_animator.setDirection(m_animator.direction()==QTimeLine::Forward ? QTimeLine::Backward : QTimeLine::Forward);
        } else {
            m_animBody = new QWidget;
            m_animBody->installEventFilter(this);
#ifndef Q_WS_WIN
            m_animBody->setEnabled(false);
#endif
            m_animBody->setAttribute(Qt::WA_NoSystemBackground, true);
            body()->ensurePolished();
            QSize s = QLayout::closestAcceptableSize(body(), body()->sizeHint()).expandedTo(QSize(width(), 0));
            body()->resize(s);

            body()->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
            body()->setAttribute(Qt::WA_WState_Hidden, false);
            m_animpix = QPixmap::grabWidget(body());
            body()->setAttribute(Qt::WA_WState_Hidden, true);
            if (o) {
                m_animator.setDirection(QTimeLine::Forward);
                m_animator.setFrameRange(0, s.height());
            } else {
                m_animator.setDirection(QTimeLine::Backward);
                m_animator.setFrameRange(0, m_body->height());
            }
            m_body->hide();
            QVBoxLayout *l = (QVBoxLayout*)layout();
            l->addWidget(m_animBody);
            m_animBody->show();
            m_animator.start();
        }
        } else {
            if(o)
                m_body->show();
            else
                m_body->hide();
        }
    }
}
Example #3
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    // create TabListMenu
    QSint::TabListMenu *tabMenu = new QSint::TabListMenu(this);

    // assing ui->tabWidget to the tabMenu
    tabMenu->setTabs(ui->tabWidget);

    // create corner button
    QToolButton *tbTabsDropList = new QToolButton(this);
    tbTabsDropList->setArrowType(Qt::DownArrow);
    tbTabsDropList->setPopupMode(QToolButton::InstantPopup);
    ui->tabWidget->setCornerWidget(tbTabsDropList);

    // assing tabMenu to the tbTabsDropList
    tbTabsDropList->setMenu(tabMenu);


    // just for demo: connect cbUseIcons checkbox to the tabMenu's setAllowIcons() slot
    connect(ui->cbUseIcons, SIGNAL(toggled(bool)), tabMenu, SLOT(setAllowIcons(bool)));
}
Example #4
0
void BookmarksToolBar::build()
{
    clear();
    for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
        QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
        if (m_bookmarksModel->hasChildren(idx)) {
            QToolButton *button = new QToolButton(this);
            button->setPopupMode(QToolButton::InstantPopup);
            button->setArrowType(Qt::DownArrow);
            button->setText(idx.data().toString());
            ModelMenu *menu = new ModelMenu(this);
            connect(menu, SIGNAL(activated(QModelIndex)),
                    this, SLOT(activated(QModelIndex)));
            menu->setModel(m_bookmarksModel);
            menu->setRootIndex(idx);
            menu->addAction(new QAction(menu));
            button->setMenu(menu);
            button->setToolButtonStyle(Qt::ToolButtonTextOnly);
            QAction *a = addWidget(button);
            a->setText(idx.data().toString());
        } else {
            QAction *action = addAction(idx.data().toString());
            action->setData(idx.data(BookmarksModel::UrlRole));
        }
    }
}
Example #5
0
QT_BEGIN_NAMESPACE

static QToolButton *createToolButton(QWidget *parent, Qt::ArrowType at, const QString &name) {
    QToolButton *rc =  new QToolButton();
    rc->setAttribute(Qt::WA_NoChildEventsForParent, true);
    rc->setParent(parent);
    rc->setObjectName(name);
    rc->setArrowType(at);
    rc->setAutoRaise(true);
    rc->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
    rc->setFixedSize(QSize(15, 15));
    return rc;
}
Example #6
0
void BookmarksToolBar::build()
{
    clear();

    for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) {
        QModelIndex idx = m_bookmarksModel->index(i, 0, m_root);
        QVariant variant;
        variant.setValue(idx);

        QString title = idx.data().toString();
        bool folder = m_bookmarksModel->hasChildren(idx);

        QToolButton *button = 0;
        if (folder)
            button = new QToolButton(this);
        else
            button = new BookmarkToolButton(this);

        button->setPopupMode(QToolButton::InstantPopup);
        button->setToolButtonStyle(Qt::ToolButtonTextOnly);

        QAction *action = addWidget(button);
        action->setData(variant);
        action->setText(title);
        button->setDefaultAction(action);

        if (folder) {
            button->setArrowType(Qt::DownArrow);

            ModelMenu *menu = new BookmarksMenu(this);
            menu->setModel(m_bookmarksModel);
            menu->setRootIndex(idx);
            menu->addAction(new QAction(menu));
            action->setMenu(menu);

            connect(menu, SIGNAL(openUrl(const QUrl &, const QString &)),
                    this, SIGNAL(openUrl(const QUrl &, const QString &)));
            connect(menu, SIGNAL(openUrl(const QUrl &, TabWidget::OpenUrlIn, const QString &)),
                    this, SIGNAL(openUrl(const QUrl &, TabWidget::OpenUrlIn, const QString &)));
        } else {
            connect(action, SIGNAL(triggered()),
                    this, SLOT(openBookmark()));
        }
    }
Example #7
0
MainWindow::MainWindow()
{
	ui.setupUi(this);

	this->setWindowTitle(tr("Texture Atlas Maker v0.96  (18-08-2011)"));

	readSettings();

///////////////////////////////////////////////
	QGridLayout *gridLayout_2 = new QGridLayout(ui.page_textures);



	TextureListWidget *listViewTextures = new TextureListWidget(ui.page_textures);
	listViewTextures->setObjectName(QString::fromUtf8("listViewTextures"));
			QSizePolicy sizePolicy2(QSizePolicy::Minimum, QSizePolicy::Expanding);
			sizePolicy2.setHorizontalStretch(0);
			sizePolicy2.setVerticalStretch(0);
			sizePolicy2.setHeightForWidth(listViewTextures->sizePolicy().hasHeightForWidth());
			listViewTextures->setSizePolicy(sizePolicy2);
	gridLayout_2->addWidget(listViewTextures, 0, 0, 1, 4);


	QToolButton *toolButtonAddFile = new QToolButton(ui.page_textures);
	toolButtonAddFile->setText(tr("add file"));
	toolButtonAddFile->setObjectName(QString::fromUtf8("toolButtonAddFile"));
	gridLayout_2->addWidget(toolButtonAddFile, 1, 0, 1, 2);

	QToolButton *toolButtonAddFolder = new QToolButton(ui.page_textures);
	toolButtonAddFolder->setText(tr("add folder"));
	toolButtonAddFolder->setObjectName(QString::fromUtf8("toolButtonAddFolder"));
	gridLayout_2->addWidget(toolButtonAddFolder, 2, 0, 1, 2);

	QToolButton *toolExport = new QToolButton(ui.page_textures);
	toolExport->setText(tr("export"));
	toolExport->setToolTip(tr("Export selected images"));
	gridLayout_2->addWidget(toolExport, 1, 2, 1, 2);


	QToolButton *toolButtonClear = new QToolButton(ui.page_textures);
	toolButtonClear->setText(tr("clear"));
	toolButtonClear->setObjectName(QString::fromUtf8("toolButtonClear"));
	gridLayout_2->addWidget(toolButtonClear, 2, 2, 1, 2);




	comboBoxResolution = new QComboBox(ui.page_textures);
	comboBoxResolution->setObjectName(QString::fromUtf8("comboBoxResolution"));
	gridLayout_2->addWidget(comboBoxResolution, 3, 0, 1, 2);




	QToolButton *toolButtonAddResolution = new QToolButton(ui.page_textures);
	toolButtonAddResolution->setText(tr("+"));
	toolButtonAddResolution->setObjectName(QString::fromUtf8("toolButtonAddResolution"));
	toolButtonAddResolution->setArrowType(Qt::NoArrow);

	gridLayout_2->addWidget(toolButtonAddResolution, 3, 2, 1, 1);
////////////////////////////////////////

	/////////////////


	comboBoxResolution->addItem("2048*2048", 2048);
	comboBoxResolution->addItem("1024*1024", 1024);
	comboBoxResolution->addItem("512*512", 512);
	comboBoxResolution->addItem("256*256", 256);
	comboBoxResolution->addItem("128*128", 128);

	textureModel = new TextureModel(this);

	listViewTextures->setModel(textureModel);

	ui.workArea->setAcceptDrops(true);
	ui.workArea->setTextureModel(textureModel);
	ui.workArea->setUpdatesEnabled(true);
	ui.workArea->update();


	connect(toolButtonAddFile,SIGNAL(clicked(bool)), this,SLOT(AddFile()));
	connect(toolButtonAddFolder,SIGNAL(clicked(bool)), this,SLOT(AddFolder()));
	connect(toolButtonClear,SIGNAL(clicked(bool)), textureModel,SLOT(clear()));
	connect(toolExport,SIGNAL(clicked(bool)), listViewTextures,SLOT(saveSelectedImages()));


	connect(comboBoxResolution,SIGNAL(currentIndexChanged(int)), this,SLOT(resolutionAtlasChange()));
	connect(toolButtonAddResolution,SIGNAL(clicked(bool)), this,SLOT(AddNewResolution()));



	QAction *bindingAction = ui.toolBar->addAction(tr("binding"));
	bindingAction->setCheckable(true);
	bindingAction->setChecked(false);
	connect(bindingAction, SIGNAL(triggered(bool)), ui.workArea,SLOT(setBinding(bool)));

	QAction *remakeAction = ui.toolBar->addAction(tr("remake"));
	connect(remakeAction,SIGNAL(triggered(bool)), textureModel,SLOT(arrangeImages()));


	QAction *autoRemakeAction = ui.toolBar->addAction(tr("auto arrange"));
	autoRemakeAction->setCheckable(true);
	autoRemakeAction->setChecked(textureModel->isAutoArrangeImages());
	connect(autoRemakeAction, SIGNAL(triggered(bool)), textureModel,SLOT(setAutoArrangeImages(bool)));


	QAction *loadAction = new QAction(tr("&Open"), this);
	connect(loadAction,SIGNAL(triggered(bool)), this,SLOT(loadFile()));
	loadAction->setShortcut(QKeySequence::Open);

	QAction *saveAction = new QAction(tr("&Save"), this);
	saveAction->setShortcut(QKeySequence::Save);
	connect(saveAction,SIGNAL(triggered(bool)), this,SLOT(save()));

	QAction *saveAsAct = new QAction(tr("Save &As..."), this);
	saveAsAct->setShortcuts(QKeySequence::SaveAs);
	saveAsAct->setStatusTip(tr("Save the atlas under a new name"));
	connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));

	QAction *exitAct = new QAction(tr("E&xit"), this);
	exitAct->setShortcuts(QKeySequence::Quit);
	exitAct->setStatusTip(tr("Exit the application"));
	connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));

	QMenu *fileMenuAct = ui.menubar->addMenu(tr("File"));
	fileMenuAct->addAction(loadAction);
	fileMenuAct->addSeparator();
	fileMenuAct->addAction(saveAction);
	fileMenuAct->addAction(saveAsAct);
	fileMenuAct->addSeparator();
	fileMenuAct->addAction(exitAct);


	ui.workArea->setBinding(bindingAction->isChecked());


	connect(textureModel,SIGNAL(cantMakeAtlas()), this,SLOT(CantMakeAtlas()));

	comboBoxResolution->setCurrentIndex(1);
	resolutionAtlasChange();
}
PFSViewMainWin::PFSViewMainWin(  float window_min, float window_max ):
  QMainWindow( 0 )
{
  currentFrame = frameList.end();
  
  QScrollArea *pfsViewArea = new PFSViewWidgetArea( this );
  
  pfsView = (PFSViewWidget*)pfsViewArea->widget();
  
  setCentralWidget( pfsViewArea );

  setWindowIcon( QIcon( ":icons/appicon.png" ) );

  QAction *nextFrameAct = new QAction( tr( "&Next frame" ), this );
  nextFrameAct->setStatusTip( tr( "Load next frame" ) );
  nextFrameAct->setShortcut( Qt::Key_PageDown );
  connect( nextFrameAct, SIGNAL(triggered()), this, SLOT(gotoNextFrame()) );

  QAction *previousFrameAct = new QAction( tr( "&Previous frame" ), this );
  previousFrameAct->setStatusTip( tr( "Load previous frame" ) );
  previousFrameAct->setShortcut( Qt::Key_PageUp );
  connect( previousFrameAct, SIGNAL(triggered()), this, SLOT(gotoPreviousFrame()) );
  
  QToolBar *toolBar = addToolBar( tr( "Navigation" ) );
//  toolBar->setHorizontalStretchable( true );

  QToolButton *previousFrameBt = new QToolButton( toolBar );
  previousFrameBt->setArrowType( Qt::LeftArrow );
  previousFrameBt->setMinimumWidth( 15 );
  connect( previousFrameBt, SIGNAL(clicked()), this, SLOT(gotoPreviousFrame()) );
  previousFrameBt->setToolTip( "Goto previous frame" );
  toolBar->addWidget( previousFrameBt );
  
  QToolButton *nextFrameBt = new QToolButton( toolBar );
  nextFrameBt->setArrowType( Qt::RightArrow );
  nextFrameBt->setMinimumWidth( 15 );
  connect( nextFrameBt, SIGNAL(clicked()), this, SLOT(gotoNextFrame()) );
  nextFrameBt->setToolTip( "Goto next frame" );
  toolBar->addWidget( nextFrameBt );

  QLabel *channelSelLabel = new QLabel( "&Channel", toolBar );
  channelSelection = new QComboBox( toolBar );
  channelSelLabel->setBuddy( channelSelection );
  connect( channelSelection, SIGNAL( activated( int ) ),
    this, SLOT( setChannelSelection(int) ) );
  toolBar->addWidget( channelSelLabel );
  toolBar->addWidget( channelSelection );
  
  toolBar->addSeparator();

  QLabel *mappingMethodLabel = new QLabel( "&Mapping", toolBar );
  mappingMethodLabel->setAlignment(  Qt::AlignRight | Qt::AlignVCenter ); // | 
//				    Qt::TextExpandTabs | Qt::TextShowMnemonic );
  mappingMethodCB = new QComboBox( toolBar );
  mappingMethodLabel->setBuddy( mappingMethodCB );
  mappingMethodCB->addItem( "Linear" );
  mappingMethodCB->addItem( "Gamma 1.4" );
  mappingMethodCB->addItem( "Gamma 1.8" );
  mappingMethodCB->addItem( "Gamma 2.2" );
  mappingMethodCB->addItem( "Gamma 2.6" );
  mappingMethodCB->addItem( "Logarithmic" );
  mappingMethodCB->setCurrentIndex( 3 );
  connect( mappingMethodCB, SIGNAL( activated( int ) ),
    this, SLOT( setLumMappingMethod(int) ) );
  toolBar->addWidget( mappingMethodLabel );
  toolBar->addWidget( mappingMethodCB );
  
//  addToolBar( Qt::BottomToolBarArea, toolBar );  
  
  QToolBar *toolBarLR = addToolBar( tr( "Histogram" ) );
  lumRange = new LuminanceRangeWidget( toolBarLR );
  connect( lumRange, SIGNAL( updateRangeWindow() ), this,
    SLOT( updateRangeWindow() ) );
  toolBarLR->addWidget( lumRange );
//  addToolBar( toolBar );

  
  pointerPosAndVal = new QLabel( statusBar() );
  statusBar()->addWidget( pointerPosAndVal );
//  QFont fixedFont = QFont::defaultFont();
//  fixedFont.setFixedPitch( true );
//  pointerPosAndVal->setFont( fixedFont );
  zoomValue = new QLabel( statusBar() );
  statusBar()->addWidget( zoomValue );
  exposureValue = new QLabel( statusBar() );
  statusBar()->addWidget( exposureValue );

  connect( pfsView, SIGNAL(updatePointerValue()),
             this, SLOT(updatePointerValue()) );



  QMenu *frameMenu = menuBar()->addMenu( tr( "&Frame" ) );
  frameMenu->addAction( nextFrameAct );
  frameMenu->addAction( previousFrameAct );
  frameMenu->addSeparator();
  frameMenu->addAction( "&Save image...", this, SLOT(saveImage()), QKeySequence::Save ); 
  frameMenu->addAction( "&Copy image to clipboard", this, SLOT(copyImage()), QKeySequence::Copy ); 
  frameMenu->addSeparator();
  frameMenu->addAction( "&Quit", qApp, SLOT(quit()), Qt::Key_Q ); //QKeySequence::Quit
  QShortcut *shortcut = new QShortcut( QKeySequence::Close, this );
  connect( shortcut, SIGNAL(activated()), qApp, SLOT(quit()) );
  
  
  QAction *act;
  QMenu *viewMenu = menuBar()->addMenu( tr( "&View" ) );

  act = viewMenu->addAction( "&Zoom in", pfsView, SLOT(zoomIn()), Qt::Key_Period ); // QKeySequence::ZoomIn -- not doing it -- silly binding under Linux
  connect( act, SIGNAL(triggered()), this, SLOT(updateZoomValue()) );
  act = viewMenu->addAction( "Zoom &out", pfsView, SLOT(zoomOut()), Qt::Key_Comma ); 
  connect( act, SIGNAL(triggered()), this, SLOT(updateZoomValue()) );
  act = viewMenu->addAction( "Zoom &1:1", pfsView, SLOT(zoomOriginal()), Qt::Key_N ); 
  connect( act, SIGNAL(triggered()), this, SLOT(updateZoomValue()) );
  viewMenu->addAction( "&Fit window to content", this, SLOT(updateViewSize()), Qt::Key_C ); 

  viewMenu->addSeparator();  

  QMenu *infnanMenu = viewMenu->addMenu( "NaN and &Inf values" );
  QActionGroup *infnanActGrp = new QActionGroup( this );
  infnanActGrp->setExclusive( true );
  QAction *infnanHideAct = new QAction( tr( "&Hide" ), this );
  infnanHideAct->setCheckable(true);
  infnanHideAct->setData(0);
  infnanActGrp->addAction( infnanHideAct );
  infnanMenu->addAction( infnanHideAct );
  QAction *infnanMarkAct = new QAction( tr( "Mark with &red color" ), this );
  infnanMarkAct->setCheckable(true);
  infnanMarkAct->setData(1);
  infnanActGrp->addAction( infnanMarkAct );
  infnanMenu->addAction( infnanMarkAct );
  infnanMarkAct->setChecked( true );
  connect( infnanActGrp, SIGNAL(triggered(QAction*)), pfsView, SLOT(setInfNaNTreatment(QAction*)) );

  QMenu *colorClipMenu = viewMenu->addMenu( "&Color clipping" );
  QActionGroup *colorClipActGrp = new QActionGroup( this );
  colorClipActGrp->setExclusive( true );
  QAction *colorClipSimpleAct = new QAction( tr( "&Simple clipping" ), this );
  colorClipSimpleAct->setCheckable(true);
  colorClipSimpleAct->setData(CLIP_SIMPLE);
  colorClipSimpleAct->setShortcut( Qt::CTRL + Qt::Key_H );
  colorClipActGrp->addAction( colorClipSimpleAct );
  colorClipMenu->addAction( colorClipSimpleAct );
  QAction *colorClipCodedAct = new QAction( tr( "&Color-coded clipping" ), this );
  colorClipCodedAct->setCheckable(true);
  colorClipCodedAct->setShortcut( Qt::CTRL + Qt::Key_J );
  colorClipCodedAct->setData(CLIP_COLORCODED);
  colorClipActGrp->addAction( colorClipCodedAct );
  colorClipMenu->addAction( colorClipCodedAct );
  QAction *colorClipBriHueAct = new QAction( tr( "&Keep brightness and hue" ), this );
  colorClipBriHueAct->setCheckable(true);
  colorClipBriHueAct->setShortcut( Qt::CTRL + Qt::Key_K );
  colorClipBriHueAct->setData(CLIP_KEEP_BRI_HUE);
  colorClipActGrp->addAction( colorClipBriHueAct );
  colorClipMenu->addAction( colorClipBriHueAct );
  colorClipSimpleAct->setChecked( true );
  connect( colorClipActGrp, SIGNAL(triggered(QAction*)), pfsView, SLOT(setRGBClippingMethod(QAction*)) );

  QMenu *negativeMenu = viewMenu->addMenu( "&Negative values" );
  QActionGroup *negativeActGrp = new QActionGroup( this );
  negativeActGrp->setExclusive( true );
  act = new QAction( tr( "&Black" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_BLACK);
  act->setShortcut( Qt::ALT + Qt::Key_B );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  act->setChecked( true );
  act = new QAction( tr( "Mark with &red color" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_MARK_AS_RED);
  act->setShortcut( Qt::ALT + Qt::Key_R );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  act = new QAction( tr( "Use &green color scale" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_GREEN_SCALE);
  act->setShortcut( Qt::ALT + Qt::Key_G );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  act = new QAction( tr( "Use &absolute values" ), this );
  act->setCheckable(true);
  act->setData(NEGATIVE_ABSOLUTE);
  act->setShortcut( Qt::ALT + Qt::Key_A );
  negativeActGrp->addAction( act );
  negativeMenu->addAction( act );
  connect( negativeActGrp, SIGNAL(triggered(QAction*)), pfsView, SLOT(setNegativeTreatment(QAction*)) );
  
  viewMenu->addSeparator();
  
  QMenu *colorCoordMenu = viewMenu->addMenu( "Color coo&rdinates" );
  QActionGroup *colorCoordActGrp = new QActionGroup( this );
  colorCoordActGrp->setExclusive( true );
  act = new QAction( tr( "&RGB" ), this );
  act->setCheckable(true);
  act->setData(CC_RGB);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_R );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  act->setChecked( true );
  act = new QAction( tr( "&XYZ" ), this );
  act->setCheckable(true);
  act->setData(CC_XYZ);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_X );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  act = new QAction( tr( "Y&u'v'" ), this );
  act->setCheckable(true);
  act->setData(CC_Yupvp);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_U );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  act = new QAction( tr( "Yx&y" ), this );
  act->setCheckable(true);
  act->setData(CC_Yxy);
  act->setShortcut( Qt::SHIFT + Qt::ALT + Qt::Key_Y );
  colorCoordActGrp->addAction( act );
  colorCoordMenu->addAction( act );
  connect( colorCoordActGrp, SIGNAL(triggered(QAction*)), this, SLOT(setColorCoord(QAction*)) );
  

  QMenu *mappingMenu = menuBar()->addMenu( tr( "&Tone mapping" ) );
  
  
  mappingMenu->addAction( "Increase exposure", lumRange, 
			SLOT(increaseExposure()), Qt::Key_Minus ); 
  mappingMenu->addAction( "Decrease exposure", lumRange, 
			SLOT(decreaseExposure()), Qt::Key_Equal );
  mappingMenu->addAction( "Extend dynamic range", lumRange, 
			SLOT(extendRange()), Qt::Key_BracketRight ); 
  mappingMenu->addAction( "Shrink dynamic range", lumRange, 
			SLOT(shrinkRange()), Qt::Key_BracketLeft );
  mappingMenu->addAction( "Fit to dynamic range", lumRange, 
			SLOT(fitToDynamicRange()), Qt::Key_Backslash );
  mappingMenu->addAction( "Low dynamic range", lumRange, 
			SLOT(lowDynamicRange()), Qt::ALT + Qt::Key_L );


  QMenu *mapfuncMenu = mappingMenu->addMenu( "&Mapping function" );
  QActionGroup *mapfuncActGrp = new QActionGroup( this );
  mapfuncActGrp->setExclusive( true );
  mappingAct[0] = act = new QAction( tr( "&Linear" ), this );
  act->setCheckable(true);
  act->setData(0);
  act->setShortcut( Qt::Key_L );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[1] = act = new QAction( tr( "Gamma 1.&4" ), this );
  act->setCheckable(true);
  act->setData(1);
  act->setShortcut( Qt::Key_1 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[2] = act = new QAction( tr( "Gamma 1.&8" ), this );
  act->setCheckable(true);
  act->setData(2);
  act->setShortcut( Qt::Key_2 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[3] = act = new QAction( tr( "Gamma 2.&2" ), this );
  act->setCheckable(true);
  act->setData(3);
  act->setChecked( true );
  act->setShortcut( Qt::Key_3 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[4] = act = new QAction( tr( "Gamma 2.&6" ), this );
  act->setCheckable(true);
  act->setData(4);
  act->setShortcut( Qt::Key_4 );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  mappingAct[5] = act = new QAction( tr( "L&ogarithmic" ), this );
  act->setCheckable(true);
  act->setData(5);
  act->setShortcut( Qt::Key_O );
  mapfuncActGrp->addAction( act );
  mapfuncMenu->addAction( act );
  connect( mapfuncActGrp, SIGNAL(triggered(QAction*)), this, SLOT(setLumMappingMethod(QAction*)) );

  
  QMenu *helpMenu = menuBar()->addMenu( tr( "&Help" ) );
  helpMenu->addAction( "&About", this, SLOT(showAboutdialog()) );
  
  colorCoord = CC_RGB;
  
  //Window should not be larger than desktop
  // TODO: how to find desktop size - gnome taksbars
//  setMaximumSize( QApplication::desktop()->width(), QApplication::desktop()->height() );

  try {
    
    if( !readNextFrame() ) 
      throw PFSViewException();
    
    if( window_min < window_max )
      lumRange->setRangeWindowMinMax( window_min, window_max );  
    
  } catch( pfs::Exception ex ) {
    QMessageBox::critical( this, "pfsview error", ex.getMessage() );
    throw PFSViewException();
  }

}
//------------------------------------------------------------------------------------------
void Controller::setupGUI()
{
    ////////////////////////////////////////////////////////////////////////////////
    // environment textures
    QGridLayout* envTextureLayout = new QGridLayout;

    cbEnvTexture = new QComboBox;
    envTextureLayout->addWidget(cbEnvTexture, 0, 0, 1, 3);
    cbEnvTexture->addItem("None");
    cbEnvTexture->addItem("Sky1");
    cbEnvTexture->addItem("Sky2");
    cbEnvTexture->addItem("Sky3");

    QToolButton* btnPreviousEnvTexture = new QToolButton;
    btnPreviousEnvTexture->setArrowType(Qt::LeftArrow);
    envTextureLayout->addWidget(btnPreviousEnvTexture, 0, 3, 1, 1);

    QToolButton* btnNextEnvTexture = new QToolButton;
    btnNextEnvTexture->setArrowType(Qt::RightArrow);
    envTextureLayout->addWidget(btnNextEnvTexture, 0, 4, 1, 1);

    connect(btnPreviousEnvTexture, SIGNAL(clicked()), this, SLOT(prevEnvTexture()));
    connect(btnNextEnvTexture, SIGNAL(clicked()), this, SLOT(nextEnvTexture()));

    QGroupBox* envTextureGroup = new QGroupBox("Background");
    envTextureGroup->setLayout(envTextureLayout);

    ////////////////////////////////////////////////////////////////////////////////
    // floor textures
    QGridLayout* floorTextureLayout = new QGridLayout;

    cbFloorTexture = new QComboBox;
    floorTextureLayout->addWidget(cbFloorTexture, 0, 0, 1, 3);
    cbFloorTexture->addItem("None");
    cbFloorTexture->addItem("Checkerboard 1");
    cbFloorTexture->addItem("Checkerboard 2");
    cbFloorTexture->addItem("Stone 1");
    cbFloorTexture->addItem("Stone 2");
    cbFloorTexture->addItem("Wood 1");
    cbFloorTexture->addItem("Wood 2");

    QToolButton* btnPreviousFloorTexture = new QToolButton;
    btnPreviousFloorTexture->setArrowType(Qt::LeftArrow);
    floorTextureLayout->addWidget(btnPreviousFloorTexture, 0, 3, 1, 1);

    QToolButton* btnNextFloorTexture = new QToolButton;
    btnNextFloorTexture->setArrowType(Qt::RightArrow);
    floorTextureLayout->addWidget(btnNextFloorTexture, 0, 4, 1, 1);

    connect(btnPreviousFloorTexture, SIGNAL(clicked()), this, SLOT(prevFloorTexture()));
    connect(btnNextFloorTexture, SIGNAL(clicked()), this, SLOT(nextFloorTexture()));

//    cbFloorTexture->setCurrentIndex(1);
    QGroupBox* floorTextureGroup = new QGroupBox("Floor");
    floorTextureGroup->setLayout(floorTextureLayout);

    ////////////////////////////////////////////////////////////////////////////////
    // frame time
    sldFrameTime = new QSlider(Qt::Horizontal);
    sldFrameTime ->setRange(1, 100);
    sldFrameTime ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QSpinBox* spFrameTime = new QSpinBox;
    spFrameTime->setRange(1, 100);

    connect(sldFrameTime, &QSlider::valueChanged, spFrameTime, &QSpinBox::setValue);
    connect(spFrameTime, SIGNAL(valueChanged(int)), sldFrameTime, SLOT(setValue(int)));

    QGridLayout* frameTimeLayout = new QGridLayout;
    frameTimeLayout->addWidget(sldFrameTime, 0, 0,  1, 5);
    frameTimeLayout->addWidget(spFrameTime, 0, 5, 1, 1);

    QGroupBox* frameTimeGroup = new QGroupBox("Frame Sleep(ms)");
    frameTimeGroup->setLayout(frameTimeLayout);


    ///////////////////////////////////////////////////////////////////////////////
    // frame stride
    sldFrameStride = new QSlider(Qt::Horizontal);
    sldFrameStride ->setRange(1, 100);
    sldFrameStride ->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);

    QSpinBox* spFrameStride = new QSpinBox;
    spFrameStride->setRange(1, 100);

    connect(sldFrameStride, &QSlider::valueChanged, spFrameStride, &QSpinBox::setValue);
    connect(spFrameStride, SIGNAL(valueChanged(int)), sldFrameStride, SLOT(setValue(int)));

    QGridLayout* frameStrideLayout = new QGridLayout;
    frameStrideLayout->addWidget(sldFrameStride, 0, 0, 1, 5);
    frameStrideLayout->addWidget(spFrameStride, 0, 5, 1, 1);

    QGroupBox* frameStrideGroup = new QGroupBox("Frame Stride");
    frameStrideGroup->setLayout(frameStrideLayout);



    ////////////////////////////////////////////////////////////////////////////////
    /// color modes
    QRadioButton* rdbColorRandom = new QRadioButton(QString("Random"));
    QRadioButton* rdbColorRamp = new QRadioButton(QString("Ramp"));
    QRadioButton* rdbColorParticleType = new QRadioButton(QString("Particle Type"));
    QRadioButton* rdbColorDensity = new QRadioButton(QString("Density"));
    QRadioButton* rdbColorStiffness = new QRadioButton(QString("Stiffness"));
    QRadioButton* rdbColorActivity = new QRadioButton(QString("Activity"));


    rdbColorParticleType->setChecked(true);

    QGridLayout* colorModesLayout = new QGridLayout;
    colorModesLayout->addWidget(rdbColorRandom, 0, 0);
    colorModesLayout->addWidget(rdbColorRamp, 0, 1);
    colorModesLayout->addWidget(rdbColorParticleType, 1, 0);
    colorModesLayout->addWidget(rdbColorDensity, 1, 1);
    colorModesLayout->addWidget(rdbColorStiffness, 2, 0);
    colorModesLayout->addWidget(rdbColorActivity, 2, 1);


//    colorModesLayout->addWidget(rdbColorVelocity, 1, 1);


    QGroupBox* colorModesGroup = new QGroupBox;
    colorModesGroup->setTitle(tr("Color Mode"));
    colorModesGroup->setLayout(colorModesLayout);

    signalMapperParticleColor = new QSignalMapper(this);
    connect(rdbColorRandom, SIGNAL(clicked()), signalMapperParticleColor,
            SLOT(map()));
    connect(rdbColorRamp, SIGNAL(clicked()), signalMapperParticleColor,
            SLOT(map()));
    connect(rdbColorParticleType, SIGNAL(clicked()), signalMapperParticleColor,
            SLOT(map()));
    connect(rdbColorDensity, SIGNAL(clicked()), signalMapperParticleColor,
            SLOT(map()));
    connect(rdbColorStiffness, SIGNAL(clicked()), signalMapperParticleColor,
            SLOT(map()));
    connect(rdbColorActivity, SIGNAL(clicked()), signalMapperParticleColor,
            SLOT(map()));


    signalMapperParticleColor->setMapping(rdbColorRandom,
                                          (int) COLOR_RANDOM);
    signalMapperParticleColor->setMapping(rdbColorRamp, (int) COLOR_RAMP);
    signalMapperParticleColor->setMapping(rdbColorParticleType,
                                          (int) COLOR_PARTICLE_TYPE);
    signalMapperParticleColor->setMapping(rdbColorDensity, (int) COLOR_DENSITY);
    signalMapperParticleColor->setMapping(rdbColorStiffness, (int) COLOR_STIFFNESS);
    signalMapperParticleColor->setMapping(rdbColorActivity, (int) COLOR_ACTIVITY);

    wgSPHParticleColor = new ColorSelector;
    wgSPHParticleColor->setAutoFillBackground(true);
    wgSPHParticleColor->setColor(QColor(209, 115, 255));

    wgPDParticleColor = new ColorSelector;
    wgPDParticleColor->setAutoFillBackground(true);
    wgPDParticleColor->setColor(QColor(107, 255, 128));

    QGridLayout* particleColorLayout = new QGridLayout;
    particleColorLayout->addWidget(new QLabel("SPH Particle:"), 0, 0, Qt::AlignRight);
    particleColorLayout->addWidget(wgSPHParticleColor, 0, 1, 1, 2);
    particleColorLayout->addWidget(new QLabel("PD Particle:"), 1, 0, Qt::AlignRight);
    particleColorLayout->addWidget(wgPDParticleColor, 1, 1, 1, 2);

    QGroupBox* particleColorGroup = new QGroupBox("Particles' Color");
    particleColorGroup->setLayout(particleColorLayout);

    ////////////////////////////////////////////////////////////////////////////////
    /// particle viewing modes
    ////////////////////////////////////////////////////////////////////////////////
    QRadioButton* rdbPVSphere = new QRadioButton(QString("Sphere"));
    QRadioButton* rdbPVPoint = new QRadioButton(QString("Point"));
    QRadioButton* rdbPVOpaqueSurface = new QRadioButton(QString("Surface Only"));
    QRadioButton* rdbPVTransparentSurface = new QRadioButton(QString("Surface & Texture"));

    rdbPVSphere->setChecked(true);

    QGridLayout* pViewingModesLayout = new QGridLayout;
    pViewingModesLayout->addWidget(rdbPVSphere, 0, 0);
    pViewingModesLayout->addWidget(rdbPVPoint, 1, 0);

    pViewingModesLayout->addWidget(rdbPVOpaqueSurface, 0, 1);
    pViewingModesLayout->addWidget(rdbPVTransparentSurface, 1, 1);


    QGroupBox* pViewingModesGroup = new QGroupBox;
    pViewingModesGroup->setTitle(tr("Particle Viewing Mode"));
    pViewingModesGroup->setLayout(pViewingModesLayout);


    signalMapperParticleViewing = new QSignalMapper(this);
    connect(rdbPVSphere, SIGNAL(clicked(bool)), signalMapperParticleViewing,
            SLOT(map()));
    connect(rdbPVPoint, SIGNAL(clicked(bool)), signalMapperParticleViewing,
            SLOT(map()));
    connect(rdbPVOpaqueSurface, SIGNAL(clicked(bool)), signalMapperParticleViewing,
            SLOT(map()));
    connect(rdbPVTransparentSurface, SIGNAL(clicked(bool)), signalMapperParticleViewing,
            SLOT(map()));

    signalMapperParticleViewing->setMapping(rdbPVSphere,
                                            (int) SPHERES_VIEW);
    signalMapperParticleViewing->setMapping(rdbPVPoint, (int) POINTS_VIEW);
    signalMapperParticleViewing->setMapping(rdbPVOpaqueSurface,
                                            (int) OPAQUE_SURFACE_VIEW);
    signalMapperParticleViewing->setMapping(rdbPVTransparentSurface,
                                            (int) TRANSPARENT_SURFACE_VIEW);

    ////////////////////////////////////////////////////////////////////////////////
    /// simulation info
    ////////////////////////////////////////////////////////////////////////////////
    QVBoxLayout* simInfoLayout = new QVBoxLayout;
    simInfoLayout->setContentsMargins(0, 0, 0, 0);


    listSimInfo = new QListWidget;

//    for(int i = 0; i < 100; ++i)
//    {
//        listSimInfo->addItem(QString("Item: %1").arg(i));
//    }

    simInfoLayout->addWidget(listSimInfo);

    QGroupBox* simInfoGroup = new QGroupBox;
    simInfoGroup->setTitle("Simulation info");
    simInfoGroup->setLayout(simInfoLayout);


    ////////////////////////////////////////////////////////////////////////////////
    /// buttons
    ////////////////////////////////////////////////////////////////////////////////

    btnPause = new QPushButton(QString("Pause"));
    btnPause->setCheckable(true);
    btnNextFrame = new QPushButton(QString("Next Frame"));
    btnReset = new QPushButton(QString("Reset"));
    btnReverse = new QPushButton(QString("Reverse"));
    btnReverse->setCheckable(true);
    btnRepeatPlay = new QPushButton(QString("Repeat"));
    btnRepeatPlay->setCheckable(true);
    btnClipYZPlane= new QPushButton(QString("Clip YZ Plane"));
    btnClipYZPlane->setCheckable(true);
    btnDualViewport= new QPushButton(QString("Dual Viewport"));
    btnDualViewport->setCheckable(true);
    btnHideInvisibleParticles= new QPushButton(QString("Hide Invsb Particles"));
    btnHideInvisibleParticles->setCheckable(true);



    ////////////////////////////////////////////////////////////////////////////////
    /// controls's layout
    ////////////////////////////////////////////////////////////////////////////////

    QVBoxLayout* controlLayout = new QVBoxLayout;
    controlLayout->addWidget(envTextureGroup);
    controlLayout->addWidget(floorTextureGroup);
    controlLayout->addWidget(frameTimeGroup);
    controlLayout->addWidget(frameStrideGroup);
    controlLayout->addWidget(pViewingModesGroup);
    controlLayout->addWidget(colorModesGroup);
    controlLayout->addWidget(particleColorGroup);
    controlLayout->addWidget(simInfoGroup);
    controlLayout->addStretch();

    controlLayout->addWidget(btnPause);
//    controlLayout->addWidget(btnNextFrame);
    controlLayout->addWidget(btnReset);
    controlLayout->addWidget(btnRepeatPlay);
    controlLayout->addWidget(btnReverse);
    controlLayout->addWidget(btnClipYZPlane);
    controlLayout->addWidget(btnDualViewport);
    controlLayout->addWidget(btnHideInvisibleParticles);




    setLayout(controlLayout);
    setFixedWidth(300);
}
IncrementalSearchBar::IncrementalSearchBar(QWidget* parent)
    : QWidget(parent)
    , _foundMatch(false)
    , _searchEdit(0)
    ,_caseSensitive(0)
    ,_regExpression(0)
    ,_highlightMatches(0)
{
    QHBoxLayout* layout = new QHBoxLayout(this);

    QToolButton* close = new QToolButton(this);
    close->setObjectName( QLatin1String("close-button" ));
    close->setToolTip( i18n("Close the search bar") );
    close->setAutoRaise(true);
    close->setIcon(KIcon("dialog-close"));
    connect( close , 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") );

    layout->addWidget(close);
    layout->addWidget(findLabel);
    layout->addWidget(_searchEdit);
    layout->addWidget(findNext);
    layout->addWidget(findPrev);
    layout->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)) );

    layout->addStretch();

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

    setLayout(layout);
}
Example #11
0
GlobStore::GlobStore(QWidget *parent)
            : QWidget(parent)
{
    int l1;

    midiControl = new MidiControl(this);
    midiControl->ID = -2;
    midiControl->parentDockID = -2;

    activeStore = 0;
    currentRequest = 0;
    switchAtBeat = 0;

    storeSignalMapper = new QSignalMapper(this);
    connect(storeSignalMapper, SIGNAL(mapped(int)),
             this, SLOT(storeAll(int)));

    timeModeBox = new QComboBox;
    timeModeBox->addItem(tr("End of"));
    timeModeBox->addItem(tr("After"));
    connect(timeModeBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModeBox(int)));

    switchAtBeatBox = new QComboBox;
    for (l1 = 0; l1 < 16; l1++) {
        switchAtBeatBox->addItem(QString::number(l1 + 1)+" beats");
    }
    switchAtBeatBox->hide();
    connect(switchAtBeatBox, SIGNAL(activated(int)),
             this, SLOT(updateSwitchAtBeat(int)));

    timeModuleBox = new QComboBox;
    timeModuleBox->setCurrentIndex(0);
    connect(timeModuleBox, SIGNAL(activated(int)),
             this, SLOT(updateTimeModule(int)));

    QWidget *indicatorBox = new QWidget;
    QHBoxLayout *indicatorLayout = new QHBoxLayout;
    indicator = new Indicator(20, ' ');
    indicatorBox->setMinimumHeight(30);
    indicatorBox->setMinimumWidth(30);
    indicatorLayout->addWidget(indicator);
    indicatorLayout->setMargin(2);
    indicatorLayout->setSpacing(1);
    indicatorBox->setLayout(indicatorLayout);

    QHBoxLayout *timeModeLayout = new QHBoxLayout;
    timeModeLayout->addWidget(timeModeBox);
    timeModeLayout->addWidget(timeModuleBox);
    timeModeLayout->addWidget(switchAtBeatBox);
    timeModeLayout->addWidget(indicatorBox);
    timeModeLayout->setSpacing(0);
    timeModeLayout->addStretch();

    QHBoxLayout *upperRowLayout = new QHBoxLayout;
    upperRowLayout->addLayout(timeModeLayout);
    upperRowLayout->addStretch();

    QAction* removeStoreAction = new QAction(tr("&Remove"), this);
    QToolButton *removeStoreButton = new QToolButton;
    removeStoreButton->setDefaultAction(removeStoreAction);
    removeStoreButton->setFixedSize(60, 20);
    removeStoreButton->setArrowType (Qt::ArrowType(1));
    connect(removeStoreAction, SIGNAL(triggered()), this, SLOT(removeLocation()));

    QToolButton *toolButton = new QToolButton;
    toolButton->setText("Global");
    toolButton->setMinimumSize(QSize(56,32));
    midiControl->addMidiLearnMenu("GlobRestore", toolButton, 0);
    
    QFrame *topRow = new QFrame;
    QVBoxLayout *topRowLayout = new QVBoxLayout;
    topRowLayout->addWidget(toolButton);
    topRowLayout->addStretch();
    topRowLayout->setSpacing(0);
    topRowLayout->setMargin(0);
    topRow->setFrameStyle(QFrame::StyledPanel);
    topRow->setMinimumSize(QSize(48,48));;
    topRow->setLayout(topRowLayout);

    QVBoxLayout *buttonLayout = new QVBoxLayout;
    buttonLayout->addWidget(topRow);

    QVBoxLayout *columnLayout = new QVBoxLayout;
    columnLayout->addLayout(buttonLayout);
    columnLayout->addWidget(removeStoreButton);
    columnLayout->addStretch(1);

    indivButtonLayout = new QHBoxLayout;
    indivButtonLayout->setSpacing(0);
    indivButtonLayout->setMargin(0);
    indivButtonLayout->addLayout(columnLayout);
    indivButtonLayout->setSizeConstraint(QLayout::SetFixedSize);

    QHBoxLayout *secondRowLayout = new QHBoxLayout;
    secondRowLayout->addLayout(indivButtonLayout);
    secondRowLayout->addStretch(1);

    QVBoxLayout *centLayout = new QVBoxLayout;
    centLayout->addLayout(upperRowLayout);
    centLayout->addLayout(secondRowLayout);
    centLayout->addStretch(1);

    addLocation();

    setLayout(centLayout);
    schedRestoreVal = 0;
    schedRestore = false;
    dispReqIx = 0;
    dispReqSelected = 0;
    needsGUIUpdate = false;
    modified = false;
}
Example #12
0
FiGroupWidget::FiGroupWidget(FClass* parent)
             : FWidget(parent, FUNC)
{
  mEditing = false;

  QPixmap icon(10, 10);

  mGroupView = new MyTableWidget(this);
  //mGroupView->setDragEnabled(false);
  //mGroupView->setAcceptDrops(false);
  mGroupView->setEditTriggers(QAbstractItemView::EditKeyPressed);

  connect(mGroupView, SIGNAL(currentRowChanged(int))
          , this, SLOT(groupRowChanged(int)));
  connect(mGroupView, SIGNAL(cellDoubleClicked(int, int))
          , this, SLOT(groupOpen(int, int)));
  connect(mGroupView, SIGNAL(cellChanged(int, int))
          , this, SLOT(groupEdited(int, int)));
  connect(mGroupView, SIGNAL(dragToNirvana())
          , this, SLOT(removeGroup()));

  mMotherName = new QLabel(this);
  //mMotherName->setWordWrap(true);
  mMotherName->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);

  QToolButton* btn = new QToolButton(this);
  btn->setAutoRaise(true);
  btn->setArrowType(Qt::UpArrow);
  btn->setToolTip("Up to Mother Group");
  connect(btn, SIGNAL(clicked(bool)), this, SLOT(groupUp()));

  QToolButton* newGroupBtn = new QToolButton(this);
  newGroupBtn->setAutoRaise(true);
  icon.fill(Qt::green);
  newGroupBtn->setIcon(icon);
  newGroupBtn->setToolTip("Add New Group");
  connect(newGroupBtn, SIGNAL(clicked(bool)), this, SLOT(newGroup()));

  //mMotherName->setAlignment(Qt::AlignVertical_Mask);
  //mMotherName->setOrientation(Qt::Vertical);
  QGridLayout* gbox = new QGridLayout;
  gbox->setMargin(0);
  gbox->addWidget(mMotherName, 0, 0);
  gbox->addWidget(newGroupBtn, 0, 1);
  gbox->addWidget(btn, 0, 2);
  gbox->addWidget(mGroupView, 1, 0, 1, 3);
  QWidget* gboxw = new QWidget;
  gboxw->setLayout(gbox);

  mMemberView = new MyTableWidget;

  connect( mMemberView, SIGNAL(currentRowChanged(int))
          , this, SLOT(memberRowChanged(int)));
  connect( mMemberView, SIGNAL(dragInFromTableView(QTableView*))
          , this, SLOT(userDragInData(QTableView*)));
  connect(mMemberView, SIGNAL(dragToNirvana())
          , this, SLOT(removeFromGroup()));

  mSplitter = new QSplitter(Qt::Vertical);
  //mSplitter->addWidget(mGroupView);
  mSplitter->addWidget(gboxw);
  mSplitter->addWidget(mMemberView);
  mSplitter->setStretchFactor(0, 1);
  mSplitter->setStretchFactor(1, 3);

  QGridLayout* layout = new QGridLayout;
  layout->setMargin(0);
  layout->addWidget(mSplitter, 0, 0);
  //layout->addWidget(, 0, 1);

  setLayout(layout);
}
IncrementalSearchBar::IncrementalSearchBar(QWidget* aParent)
    : QWidget(aParent)
    , _searchEdit(0)
    , _caseSensitive(0)
    , _regExpression(0)
    , _highlightMatches(0)
    , _reverseSearch(0)
    , _findNextButton(0)
    , _findPreviousButton(0)
    , _searchFromButton(0)
{
    QHBoxLayout* barLayout = new QHBoxLayout(this);

    QToolButton* closeButton = new QToolButton(this);
    closeButton->setObjectName(QStringLiteral("close-button"));
    closeButton->setToolTip(i18nc("@info:tooltip", "Close the search bar"));
    closeButton->setAutoRaise(true);
    closeButton->setIcon(QIcon::fromTheme(QStringLiteral("dialog-close")));
    connect(closeButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::closeClicked);

    QLabel* findLabel = new QLabel(i18nc("@label:textbox", "Find:"), this);
    _searchEdit = new QLineEdit(this);
    _searchEdit->setClearButtonEnabled(true);
    _searchEdit->installEventFilter(this);
    _searchEdit->setObjectName(QStringLiteral("search-edit"));
    _searchEdit->setToolTip(i18nc("@info:tooltip", "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 , &QTimer::timeout , this , &Konsole::IncrementalSearchBar::notifySearchChanged);
    connect(_searchEdit , &QLineEdit::textChanged , _searchTimer , static_cast<void(QTimer::*)()>(&QTimer::start));

    _findNextButton = new QToolButton(this);
    _findNextButton->setObjectName(QStringLiteral("find-next-button"));
    _findNextButton->setText(i18nc("@action:button Go to the next phrase", "Next"));
    _findNextButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    _findNextButton->setToolTip(i18nc("@info:tooltip", "Find the next match for the current search phrase"));
    connect(_findNextButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::findNextClicked);

    _findPreviousButton = new QToolButton(this);
    _findPreviousButton->setObjectName(QStringLiteral("find-previous-button"));
    _findPreviousButton->setText(i18nc("@action:button Go to the previous phrase", "Previous"));
    _findPreviousButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
    _findPreviousButton->setToolTip(i18nc("@info:tooltip", "Find the previous match for the current search phrase"));
    connect(_findPreviousButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::findPreviousClicked);


    _searchFromButton = new QToolButton(this);
    _searchFromButton->setObjectName(QStringLiteral("search-from-button"));
    connect(_searchFromButton , &QToolButton::clicked , this , &Konsole::IncrementalSearchBar::searchFromClicked);

    QToolButton* optionsButton = new QToolButton(this);
    optionsButton->setObjectName(QStringLiteral("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(i18nc("@info:tooltip", "Display the options menu"));

    barLayout->addWidget(closeButton);
    barLayout->addWidget(findLabel);
    barLayout->addWidget(_searchEdit);
    barLayout->addWidget(_findNextButton);
    barLayout->addWidget(_findPreviousButton);
    barLayout->addWidget(_searchFromButton);
    barLayout->addWidget(optionsButton);

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

    _caseSensitive = optionsMenu->addAction(i18nc("@item:inmenu", "Case sensitive"));
    _caseSensitive->setCheckable(true);
    _caseSensitive->setToolTip(i18nc("@info:tooltip", "Sets whether the search is case sensitive"));
    connect(_caseSensitive, &QAction::toggled, this, &Konsole::IncrementalSearchBar::matchCaseToggled);

    _regExpression = optionsMenu->addAction(i18nc("@item:inmenu", "Match regular expression"));
    _regExpression->setCheckable(true);
    connect(_regExpression, &QAction::toggled, this, &Konsole::IncrementalSearchBar::matchRegExpToggled);

    _highlightMatches = optionsMenu->addAction(i18nc("@item:inmenu", "Highlight all matches"));
    _highlightMatches->setCheckable(true);
    _highlightMatches->setToolTip(i18nc("@info:tooltip", "Sets whether matching text should be highlighted"));
    _highlightMatches->setChecked(true);
    connect(_highlightMatches, &QAction::toggled, this, &Konsole::IncrementalSearchBar::highlightMatchesToggled);

    _reverseSearch = optionsMenu->addAction(i18n("Search backwards"));
    _reverseSearch->setCheckable(true);
    _reverseSearch->setToolTip(i18n("Sets whether search should start from the bottom"));
    _reverseSearch->setChecked(true);
    connect(_reverseSearch, &QAction::toggled, this, &Konsole::IncrementalSearchBar::updateButtonsAccordingToReverseSearchSetting);
    updateButtonsAccordingToReverseSearchSetting();

    barLayout->addStretch();

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

    setLayout(barLayout);
}