Esempio n. 1
0
/**
 *  Constructs a DlgParameterImp which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f' 
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
DlgParameterImp::DlgParameterImp( QWidget* parent,  Qt::WFlags fl )
  : QDialog( parent, fl|Qt::WindowMinMaxButtonsHint )
{
    this->setupUi(this);
    QStringList groupLabels; 
    groupLabels << tr( "Group" );
    paramGroup = new ParameterGroup(splitter3);
    paramGroup->setHeaderLabels(groupLabels);
    paramGroup->setRootIsDecorated(false);

    QStringList valueLabels; 
    valueLabels << tr( "Name" ) << tr( "Type" ) << tr( "Value" );
    paramValue = new ParameterValue(splitter3);
    paramValue->setHeaderLabels(valueLabels);
    paramValue->setRootIsDecorated(false);
    paramValue->header()->setResizeMode(0, QHeaderView::Stretch);
  
    QSizePolicy policy = paramValue->sizePolicy();
    policy.setHorizontalStretch(3);
    paramValue->setSizePolicy(policy);

#if 0 // This is needed for Qt's lupdate
    qApp->translate( "Gui::Dialog::DlgParameterImp", "System parameter" );
    qApp->translate( "Gui::Dialog::DlgParameterImp", "User parameter" );
#endif

    ParameterManager* sys = App::GetApplication().GetParameterSet("System parameter");
    const std::map<std::string,ParameterManager *>& rcList = App::GetApplication().GetParameterSetList();
    for (std::map<std::string,ParameterManager *>::const_iterator it= rcList.begin();it!=rcList.end();++it) {
        if (it->second != sys) // for now ignore system parameters because they are nowhere used
            parameterSet->addItem(tr(it->first.c_str()), QVariant(QByteArray(it->first.c_str())));
    }

    QByteArray cStr("User parameter");
    parameterSet->setCurrentIndex(parameterSet->findData(cStr));
    onChangeParameterSet(parameterSet->currentIndex());
    if (parameterSet->count() < 2)
        parameterSet->hide();

    connect(parameterSet, SIGNAL(activated(int)), 
            this, SLOT(onChangeParameterSet(int)));
    connect(paramGroup, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), 
            this, SLOT(onGroupSelected(QTreeWidgetItem*)));
    onGroupSelected(paramGroup->currentItem());
}
Esempio n. 2
0
OutputPanePlaceHolder::OutputPanePlaceHolder(Core::IMode *mode, QSplitter* parent)
   : QWidget(parent), d(new OutputPanePlaceHolderPrivate(mode, parent))
{
    setVisible(false);
    setLayout(new QVBoxLayout);
    QSizePolicy sp;
    sp.setHorizontalPolicy(QSizePolicy::Preferred);
    sp.setVerticalPolicy(QSizePolicy::Preferred);
    sp.setHorizontalStretch(0);
    setSizePolicy(sp);
    layout()->setMargin(0);
    connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
            this, SLOT(currentModeChanged(Core::IMode*)));

//    d->m_current = this;
//    Internal::OutputPaneManager *om = Internal::OutputPaneManager::instance();
//    layout()->addWidget(om);
//    om->show();
//    om->updateStatusButtons(isVisible());
}
void Data_analysis_gui::init_controls_area() {
  QVBoxLayout * vbox = new QVBoxLayout();
  controls_box_->setLayout(vbox);
  /*
  controls_box_->setOrientation( Qt::Vertical );
  controls_box_->setColumns( 1 );
  */
  QRect controls_tabwidget_geom = controls_tabwidget_->geometry();
  controls_tabwidget_geom.setWidth( 220 );
  controls_tabwidget_->setGeometry( controls_tabwidget_geom );

  QSizePolicy policy;
  policy.setHorizontalStretch(1);
  policy.setVerticalStretch(1);
  controls_tabwidget_->setSizePolicy(policy);

  //splitter_->setResizeMode( controls_tabwidget_, QSplitter::KeepSize );

  // signal-slot connections for the axis preferences
  QObject::connect( minx_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_x_axis_min() ) );
  QObject::connect( maxx_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_x_axis_max() ) );
  QObject::connect( miny_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_y_axis_min() ) );
  QObject::connect( maxy_edit_, SIGNAL( returnPressed() ),
                    this, SLOT( set_y_axis_max() ) );

  QObject::connect( reset_axis_x_button_, SIGNAL( clicked() ),
                    this, SLOT( reset_x_axis() ) );
  QObject::connect( reset_axis_y_button_, SIGNAL( clicked() ),
                    this, SLOT( reset_y_axis() ) );

  QObject::connect( x_logscale_checkbox_, SIGNAL( toggled( bool ) ),
                    this, SLOT( set_x_axis_logscale( bool ) ) );
  QObject::connect( y_logscale_checkbox_, SIGNAL( toggled( bool ) ),
                    this, SLOT( set_y_axis_logscale( bool ) ) );

}
Esempio n. 4
0
/**
 * @brief constructor
 */
RazorClock::RazorClock(const RazorPanelPluginStartInfo* startInfo, QWidget* parent):
        RazorPanelPlugin(startInfo, parent),
        calendarDialog(0)
{
    setObjectName("Clock");
    clockFormat = "hh:mm";

    gui = new ClockLabel(this);
    gui->setAlignment(Qt::AlignCenter);
    this->layout()->setAlignment(Qt::AlignCenter);
    QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    sizePolicy.setHorizontalStretch(0);
    sizePolicy.setVerticalStretch(0);
    gui->setSizePolicy(sizePolicy);
    this->setSizePolicy(sizePolicy);
    addWidget(gui);

    connect(gui, SIGNAL(fontChanged()), this, SLOT(updateMinWidth()));
    settigsChanged();

    clocktimer = new QTimer(this);
    connect (clocktimer, SIGNAL(timeout()), this, SLOT(updateTime()));
    clocktimer->start(1000);
}
Esempio n. 5
0
void param_plot_window::plot(QStringList &properties,
                             std::vector<float> &values, QString parameter)
{
    parameter.replace("$","/");
    qvtkWidget_ = new QVTKWidget(this);

    setWindowTitle(parameter);

    view_ = vtkSmartPointer<vtkContextView>::New();
    view_->GetRenderer()->SetBackground(1.0,1.0,1.0);
    view_->GetRenderWindow()->SetSize(400,300);
    view_->SetInteractor(qvtkWidget_->GetInteractor());
    qvtkWidget_->SetRenderWindow(view_->GetRenderWindow());

    // Create new table with some points
    chart_ = vtkSmartPointer<vtkChartXY>::New();
    view_->GetScene()->AddItem(chart_);

    QSizePolicy vtkPolicy = qvtkWidget_->sizePolicy();
    vtkPolicy.setHorizontalStretch(3);
    qvtkWidget_->setSizePolicy(vtkPolicy);

    // Create a VTK table for storing data
    table_ = vtkSmartPointer<vtkTable>::New();

    // Create an array for listing property index
    arrId_ = vtkSmartPointer<vtkDoubleArray>::New();
    arrId_->SetName("Id");

    // Label for storing name of property
    labels_ = vtkSmartPointer<vtkStringArray>::New();
    labels_->SetName("Property");

    // Create a float array for storing metric data
    arrMetricValues_ = vtkSmartPointer<vtkFloatArray>::New();
    arrMetricValues_->SetName("Values");

    // Add columns to table
    table_->AddColumn(arrId_);
    table_->AddColumn(labels_);
    table_->AddColumn(arrMetricValues_);
    table_->SetNumberOfRows(properties.size());

    // Write data
    for (unsigned int i = 0; i < properties.size(); ++i)
    {
        // Set ID
        table_->SetValue(i,0,float(i));

        // Set Label
        table_->SetValue(i,1,properties.at(i).toStdString().c_str());

        // Set Value
        table_->SetValue(i,2,values.at(i));
    }

    // Add multiple line plots, setting the colors etc
    vtkPlot *line = 0;
    line = chart_->AddPlot(vtkChart::BAR);
    line->SetInputData(table_, 0, 2);
    line->SetColor(67,	110	,238, 255);

    vtkAxis *x_axis = chart_->GetAxis(vtkAxis::BOTTOM);
    x_axis->SetBehavior(1);
    x_axis->SetMinimum(-1);
    x_axis->SetMaximum(properties.size());
    x_axis->SetTitle("Realizations");
    x_axis->GetTitleProperties()->SetFontSize(16);

    x_axis->SetCustomTickPositions(arrId_,labels_);
    x_axis->GetLabelProperties()->SetOrientation(90);
    x_axis->GetLabelProperties()->SetFontSize(24);


    vtkAxis *y_axis = chart_->GetAxis(vtkAxis::LEFT);
    y_axis->SetTitle("Parameter");
    y_axis->GetTitleProperties()->SetFontSize(14);
    x_axis->GetLabelProperties()->SetFontSize(14);

    chart_->Update();

    view_->GetInteractor()->Initialize();
    view_->GetInteractor()->Start();

    ui->scrollArea->setWidget(qvtkWidget_);
}
Esempio n. 6
0
void VlcWidget::PrepareFullScreen ()
{
    FullScreen_ = false;
    ForbidFullScreen_ = false;
    FullScreenWidget_ = new SignalledWidget;
    FullScreenWidget_->addAction (TogglePlay_);
    FullScreenWidget_->addAction (FullScreenAction_);
    FullScreenWidget_->addAction (Next_);
    FullScreenWidget_->addAction (Prev_);
    FullScreenPanel_ = new SignalledWidget (this, Qt::ToolTip);
    QHBoxLayout *panelLayout = new QHBoxLayout;
    FullScreenTimeLeft_ = new QLabel;
    FullScreenTimeAll_ = new QLabel;
    FullScreenVlcScrollBar_ = new VlcScrollBar (this);
    FullScreenSoundWidget_ = new SoundWidget (this, VlcPlayer_->GetPlayer ());
    FullScreenSoundWidget_->setFixedSize (100, 25);
    QSizePolicy fullScreenVlcScrollBarPolicy (QSizePolicy::Ignored, QSizePolicy::Ignored);
    fullScreenVlcScrollBarPolicy.setHorizontalStretch (255);
    FullScreenVlcScrollBar_->setSizePolicy (fullScreenVlcScrollBarPolicy);

    TogglePlayButton_ = new QToolButton;
    TogglePlayButton_->setDefaultAction (TogglePlay_);
    TogglePlayButton_->setAutoRaise (true);
    StopButton_ = new QToolButton;
    StopButton_->setDefaultAction (Stop_);
    StopButton_->setAutoRaise (true);
    FullScreenButton_ = new QToolButton;
    FullScreenButton_->setDefaultAction (FullScreenAction_);
    FullScreenButton_->setAutoRaise (true);
    NextButton_ = new QToolButton;
    NextButton_->setDefaultAction (Next_);
    NextButton_->setAutoRaise (true);
    PrevButton_ = new QToolButton;
    PrevButton_->setDefaultAction (Prev_);
    PrevButton_->setAutoRaise (true);

    panelLayout->addWidget (PrevButton_);
    panelLayout->addWidget (TogglePlayButton_);
    panelLayout->addWidget (StopButton_);
    panelLayout->addWidget (NextButton_);
    panelLayout->addWidget (FullScreenButton_);
    panelLayout->addWidget (FullScreenTimeLeft_);
    panelLayout->addWidget (FullScreenVlcScrollBar_);
    panelLayout->addWidget (FullScreenTimeAll_);
    panelLayout->addWidget (FullScreenSoundWidget_);
    panelLayout->setContentsMargins (5, 0, 5, 0);

    FullScreenPanel_->setLayout (panelLayout);
    FullScreenPanel_->setWindowOpacity (0.8);

    FullScreenTimeLeft_->show ();
    FullScreenVlcScrollBar_->show ();
    FullScreenWidget_->setMouseTracking (true);
    FullScreenPanel_->setMouseTracking (true);


    connect (FullScreenWidget_,
             SIGNAL (mouseMove (QMouseEvent*)),
             this,
             SLOT (mouseMoveEvent (QMouseEvent*)));

    connect (FullScreenPanel_,
             SIGNAL (mouseMove (QMouseEvent*)),
             this,
             SLOT (mouseMoveEvent (QMouseEvent*)));

    connect (FullScreenVlcScrollBar_,
             SIGNAL (changePosition (double)),
             VlcPlayer_,
             SLOT (changePosition (double)));

    connect (FullScreenWidget_,
             SIGNAL (customContextMenuRequested (QPoint)),
             this,
             SLOT (generateContextMenu (QPoint)));

    connect (FullScreenPanel_,
             SIGNAL (customContextMenuRequested (QPoint)),
             this,
             SLOT (generateContextMenu (QPoint)));

    connect (FullScreenWidget_,
             SIGNAL (shown (QShowEvent*)),
             this,
             SLOT (fullScreenPanelRequested ()));

    connect (FullScreenWidget_,
             SIGNAL (resized (QResizeEvent*)),
             this,
             SLOT (fullScreenPanelRequested ()));
}
Esempio n. 7
0
void VlcWidget::GenerateToolBar ()
{
    Bar_ = new QToolBar (this);
    OpenButton_ = new QToolButton (Bar_);
    Open_ = new QAction (OpenButton_);
    Open_->setProperty ("ActionIcon", "folder");
    Open_->setToolTip (tr ("Open file"));
    OpenButton_->setMenu (GenerateMenuForOpenAction ());
    OpenButton_->setPopupMode (QToolButton::MenuButtonPopup);
    OpenButton_->setDefaultAction (Open_);
    Bar_->addWidget (OpenButton_);

    Prev_ = Bar_->addAction (tr ("Prev"));
    Prev_->setProperty ("ActionIcon", "media-seek-backward");
    Manager_->RegisterAction ("org.vtyulc.prev", Prev_);

    connect (Prev_,
             SIGNAL (triggered ()),
             PlaylistWidget_,
             SLOT (prev ()));

    TogglePlay_ = Bar_->addAction (tr ("Play"));
    Manager_->RegisterAction ("org.vtyulc.toggle_play", TogglePlay_);
    TogglePlay_->setProperty ("ActionIcon", "media-playback-start");
    TogglePlay_->setProperty ("WatchActionIconChange", true);

    Stop_ = Bar_->addAction (tr ("Stop"));
    Stop_->setProperty ("ActionIcon", "media-playback-stop");

    Next_ = Bar_->addAction (tr ("Next"));
    Next_->setProperty ("ActionIcon", "media-seek-forward");
    Manager_->RegisterAction ("org.vtyulc.next", Next_);

    connect (Next_,
             SIGNAL (triggered ()),
             PlaylistWidget_,
             SLOT (next ()));

    FullScreenAction_ = Bar_->addAction (tr ("Fullscreen"));
    FullScreenAction_->setProperty ("ActionIcon", "view-fullscreen");
    Manager_->RegisterAction ("org.vtyulc.toggle_fullscreen", FullScreenAction_);

    TimeLeft_ = new QLabel (this);
    TimeLeft_->setToolTip (tr ("Time left"));
    Bar_->addWidget (TimeLeft_);
    ScrollBar_ = new VlcScrollBar;
    ScrollBar_->setBaseSize (200, 25);
    QWidget *tmp = new QWidget (this);
    QVBoxLayout *layout = new QVBoxLayout;
    layout->setContentsMargins (2, 2, 2, 2);
    layout->addWidget (ScrollBar_);
    tmp->setLayout (layout);
    QSizePolicy pol;
    pol.setHorizontalStretch (255);
    pol.setHorizontalPolicy (QSizePolicy::Ignored);
    pol.setVerticalPolicy (QSizePolicy::Expanding);
    tmp->setSizePolicy(pol);
    Bar_->addWidget (tmp);
    TimeAll_ = new QLabel;
    TimeAll_->setToolTip (tr ("Length"));
    Bar_->addWidget (TimeAll_);
    SoundWidget_ = new SoundWidget (this, VlcPlayer_->GetPlayer ());
    SoundWidget_->setFixedSize (100, 25);
    SoundWidget_->setToolTip (tr ("Volume"));
    layout = new QVBoxLayout;
    layout->addWidget (SoundWidget_);
    layout->setContentsMargins (2, 2, 2, 2);
    tmp = new QWidget (this);
    tmp->setLayout (layout);
    Bar_->addWidget (tmp);
}
void TransferFunctionPropertyDialog::generateWidget() {
    vec2 minEditorDims = vec2(255.0f, 100.0f);

    tfEditorView_ = new TransferFunctionEditorView(tfProperty_);
    tfProperty_->get().addObserver(tfEditorView_);
    // put origin to bottom left corner
    tfEditorView_->scale(1.0, -1.0);
    tfEditorView_->setAlignment(Qt::AlignLeft | Qt::AlignBottom);
    tfEditorView_->setMinimumSize(minEditorDims.x, minEditorDims.y);
    tfEditorView_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    tfEditorView_->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    
    tfEditor_ = new TransferFunctionEditor(&tfProperty_->get(), tfEditorView_);
    connect(tfEditor_, SIGNAL(doubleClick()), this, SLOT(showColorDialog()));
    connect(tfEditor_, SIGNAL(selectionChanged()), this, SLOT(updateColorWheel()));
    tfEditorView_->setScene(tfEditor_);

    zoomVSlider_ = new RangeSliderQt(Qt::Vertical, this);
    zoomVSlider_->setRange(0, sliderRange_);
    zoomVSlider_->setMinSeparation(5);
    // flip slider values to compensate for vertical slider layout
    zoomVSlider_->setValue(sliderRange_ - static_cast<int>(tfProperty_->getZoomV().y*sliderRange_),
                           sliderRange_ - static_cast<int>(tfProperty_->getZoomV().x*sliderRange_));
    connect(zoomVSlider_, SIGNAL(valuesChanged(int, int)),
            this, SLOT(changeVerticalZoom(int, int)));
    
    zoomHSlider_ = new RangeSliderQt(Qt::Horizontal, this);
    zoomHSlider_->setRange(0, sliderRange_);
    zoomHSlider_->setMinSeparation(5);
    zoomHSlider_->setValue(static_cast<int>(tfProperty_->getZoomH().x*sliderRange_),
                           static_cast<int>(tfProperty_->getZoomH().y*sliderRange_));
    connect(zoomHSlider_, SIGNAL(valuesChanged(int, int)),
            this, SLOT(changeHorizontalZoom(int, int)));

    maskSlider_ = new RangeSliderQt(Qt::Horizontal, this);
    maskSlider_->setRange(0, sliderRange_);
    maskSlider_->setValue(static_cast<int>(tfProperty_->getMask().x*sliderRange_),
                          static_cast<int>(tfProperty_->getMask().y*sliderRange_));
    connect(maskSlider_, SIGNAL(valuesChanged(int, int)),
            this, SLOT(changeMask(int, int)));
    
    colorWheel_ = new ColorWheel();
    connect(colorWheel_, SIGNAL(colorChange(QColor)), this, SLOT(setPointColor(QColor)));
    
    btnClearTF_ = new QPushButton("Reset");
    connect(btnClearTF_, SIGNAL(clicked()), tfEditor_, SLOT(resetTransferFunction()));
    btnClearTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
    
    btnImportTF_ = new QPushButton("Import");
    connect(btnImportTF_, SIGNAL(clicked()), this, SLOT(importTransferFunction()));
    btnImportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));
    
    btnExportTF_ = new QPushButton("Export");
    connect(btnExportTF_, SIGNAL(clicked()), this, SLOT(exportTransferFunction()));
    btnExportTF_->setStyleSheet(QString("min-width: 30px; padding-left: 7px; padding-right: 7px;"));

    tfPreview_ = new QLabel();
    tfPreview_->setMinimumSize(1,20);
    QSizePolicy sliderPol = tfPreview_->sizePolicy();
    sliderPol.setHorizontalStretch(3);
    tfPreview_->setSizePolicy(sliderPol);
    
    cmbInterpolation_ = new QComboBox();
    cmbInterpolation_->addItem("Interpolation: Linear");
    //cmbInterpolation_->addItem("Interpolation: Cubic"); // Not implemented... (yet)
    cmbInterpolation_->setCurrentIndex(tfProperty_->get().getInterpolationType());
    connect(cmbInterpolation_, SIGNAL(currentIndexChanged(int)),
            this, SLOT(switchInterpolationType(int)));
    
    chkShowHistogram_ = new QComboBox();
    chkShowHistogram_->addItem("Histogram: Off");
    chkShowHistogram_->addItem("Histogram: 100%");
    chkShowHistogram_->addItem("Histogram: 99%");
    chkShowHistogram_->addItem("Histogram: 95%");
    chkShowHistogram_->addItem("Histogram: 90%");
    chkShowHistogram_->addItem("Histogram: Log");
    chkShowHistogram_->setCurrentIndex(tfProperty_->getShowHistogram());
    connect(chkShowHistogram_, SIGNAL(currentIndexChanged(int)), this, SLOT(showHistogram(int)));
    
    pointMoveMode_ = new QComboBox();
    pointMoveMode_->addItem("Point Movement: Free");
    pointMoveMode_->addItem("Point Movement: Restrict");
    pointMoveMode_->addItem("Point Movement: Push");
    pointMoveMode_->setCurrentIndex(0);
    connect(pointMoveMode_, SIGNAL(currentIndexChanged(int)), this, SLOT(changeMoveMode(int)));

    colorDialog_ = new QColorDialog(this);
    colorDialog_->hide();
    colorDialog_->setOption(QColorDialog::ShowAlphaChannel, true);
    colorDialog_->setOption(QColorDialog::NoButtons, true);
    colorDialog_->setWindowModality(Qt::NonModal);
    colorDialog_->setWindowTitle(QString::fromStdString(tfProperty_->getDisplayName()));
    connect(colorDialog_, SIGNAL(currentColorChanged(QColor)),
            this, SLOT(setPointColorDialog(QColor)));
    
    QFrame* leftPanel = new QFrame(this);
    QGridLayout* leftLayout = new QGridLayout();
    leftLayout->setContentsMargins(0, 0, 0, 0);
    leftLayout->setSpacing(7);
    leftLayout->addWidget(zoomVSlider_,  0, 0);
    leftLayout->addWidget(tfEditorView_, 0, 1);
    leftLayout->addWidget(zoomHSlider_,  1, 1);
    leftLayout->addWidget(tfPreview_,    2, 1);
    leftLayout->addWidget(maskSlider_,   3, 1);
    leftPanel->setLayout(leftLayout);
    
    QFrame* rightPanel = new QFrame(this);
    QVBoxLayout* rightLayout = new QVBoxLayout();
    rightLayout->setContentsMargins(0, 0, 0, 0);
    rightLayout->setSpacing(7);
    rightLayout->setAlignment(Qt::AlignTop);
    rightLayout->addWidget(colorWheel_);
    rightLayout->addWidget(cmbInterpolation_);
    rightLayout->addWidget(chkShowHistogram_);
    rightLayout->addWidget(pointMoveMode_);
    rightLayout->addStretch(3);
    QHBoxLayout* rowLayout = new QHBoxLayout();
    rowLayout->addWidget(btnClearTF_);
    rowLayout->addWidget(btnImportTF_);
    rowLayout->addWidget(btnExportTF_);
    rightLayout->addLayout(rowLayout);


    rightPanel->setLayout(rightLayout);
    
    QWidget* mainPanel = new QWidget(this);
    QHBoxLayout* mainLayout = new QHBoxLayout();
    mainLayout->setContentsMargins(7, 7, 7, 7);
    mainLayout->setSpacing(7);
    mainLayout->addWidget(leftPanel);
    mainLayout->addWidget(rightPanel);
    mainPanel->setLayout(mainLayout);
    
    setWidget(mainPanel);
    connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
            this, SLOT(dockLocationChanged(Qt::DockWidgetArea)));
    
    initialize(tfProperty_);
    setFloating(true);
    setVisible(false);
}
Esempio n. 9
0
// Convert simple DOM types
QVariant domPropertyToVariant(const DomProperty *p)
{
    // requires non-const virtual nameToIcon, etc.
    switch(p->kind()) {
    case DomProperty::Bool:
        return QVariant(p->elementBool() == QFormBuilderStrings::instance().trueValue);

    case DomProperty::Cstring:
        return QVariant(p->elementCstring().toUtf8());

    case DomProperty::Point: {
        const DomPoint *point = p->elementPoint();
        return QVariant(QPoint(point->elementX(), point->elementY()));
    }

    case DomProperty::PointF: {
        const DomPointF *pointf = p->elementPointF();
        return QVariant(QPointF(pointf->elementX(), pointf->elementY()));
    }

    case DomProperty::Size: {
        const DomSize *size = p->elementSize();
        return QVariant(QSize(size->elementWidth(), size->elementHeight()));
    }

    case DomProperty::SizeF: {
        const DomSizeF *sizef = p->elementSizeF();
        return QVariant(QSizeF(sizef->elementWidth(), sizef->elementHeight()));
    }

    case DomProperty::Rect: {
        const DomRect *rc = p->elementRect();
        const QRect g(rc->elementX(), rc->elementY(), rc->elementWidth(), rc->elementHeight());
        return QVariant(g);
    }

    case DomProperty::RectF: {
        const DomRectF *rcf = p->elementRectF();
        const QRectF g(rcf->elementX(), rcf->elementY(), rcf->elementWidth(), rcf->elementHeight());
        return QVariant(g);
    }

    case DomProperty::String:
        return QVariant(p->elementString()->text());

    case DomProperty::Number:
        return QVariant(p->elementNumber());

    case DomProperty::UInt:
        return QVariant(p->elementUInt());

    case DomProperty::LongLong:
        return QVariant(p->elementLongLong());

    case DomProperty::ULongLong:
        return QVariant(p->elementULongLong());

    case DomProperty::Double:
        return QVariant(p->elementDouble());

    case DomProperty::Char: {
        const DomChar *character = p->elementChar();
        const QChar c(character->elementUnicode());
        return QVariant::fromValue(c);
    }

    case DomProperty::Color: {
        const DomColor *color = p->elementColor();
        QColor c(color->elementRed(), color->elementGreen(), color->elementBlue());
        if (color->hasAttributeAlpha())
            c.setAlpha(color->attributeAlpha());
        return QVariant::fromValue(c);
    }

    case DomProperty::Font: {
        const DomFont *font = p->elementFont();

        QFont f;
        if (font->hasElementFamily() && !font->elementFamily().isEmpty())
            f.setFamily(font->elementFamily());
        if (font->hasElementPointSize() && font->elementPointSize() > 0)
            f.setPointSize(font->elementPointSize());
        if (font->hasElementWeight() && font->elementWeight() > 0)
            f.setWeight(font->elementWeight());
        if (font->hasElementItalic())
            f.setItalic(font->elementItalic());
        if (font->hasElementBold())
            f.setBold(font->elementBold());
        if (font->hasElementUnderline())
            f.setUnderline(font->elementUnderline());
        if (font->hasElementStrikeOut())
            f.setStrikeOut(font->elementStrikeOut());
        if (font->hasElementKerning())
            f.setKerning(font->elementKerning());
        if (font->hasElementAntialiasing())
            f.setStyleStrategy(font->elementAntialiasing() ? QFont::PreferDefault : QFont::NoAntialias);
        if (font->hasElementStyleStrategy()) {
            f.setStyleStrategy(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QFont::StyleStrategy>("styleStrategy", font->elementStyleStrategy().toLatin1()));
        }
        return QVariant::fromValue(f);
    }

    case DomProperty::Date: {
        const DomDate *date = p->elementDate();
        return QVariant(QDate(date->elementYear(), date->elementMonth(), date->elementDay()));
    }

    case DomProperty::Time: {
        const DomTime *t = p->elementTime();
        return QVariant(QTime(t->elementHour(), t->elementMinute(), t->elementSecond()));
    }

    case DomProperty::DateTime: {
        const DomDateTime *dateTime = p->elementDateTime();
        const QDate d(dateTime->elementYear(), dateTime->elementMonth(), dateTime->elementDay());
        const QTime tm(dateTime->elementHour(), dateTime->elementMinute(), dateTime->elementSecond());
        return QVariant(QDateTime(d, tm));
    }

    case DomProperty::Url: {
        const DomUrl *url = p->elementUrl();
        return QVariant(QUrl(url->elementString()->text()));
    }

#ifndef QT_NO_CURSOR
    case DomProperty::Cursor:
        return QVariant::fromValue(QCursor(static_cast<Qt::CursorShape>(p->elementCursor())));

    case DomProperty::CursorShape:
        return QVariant::fromValue(QCursor(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, Qt::CursorShape>("cursorShape", p->elementCursorShape().toLatin1())));
#endif

    case DomProperty::Locale: {
        const DomLocale *locale = p->elementLocale();
        return QVariant::fromValue(QLocale(enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Language>("language", locale->attributeLanguage().toLatin1()),
                    enumKeyOfObjectToValue<QAbstractFormBuilderGadget, QLocale::Country>("country", locale->attributeCountry().toLatin1())));
    }
    case DomProperty::SizePolicy: {
        const DomSizePolicy *sizep = p->elementSizePolicy();

        QSizePolicy sizePolicy;
        sizePolicy.setHorizontalStretch(sizep->elementHorStretch());
        sizePolicy.setVerticalStretch(sizep->elementVerStretch());

        const QMetaEnum sizeType_enum = metaEnum<QAbstractFormBuilderGadget>("sizeType");

        if (sizep->hasElementHSizeType()) {
            sizePolicy.setHorizontalPolicy((QSizePolicy::Policy) sizep->elementHSizeType());
        } else if (sizep->hasAttributeHSizeType()) {
            const QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeHSizeType().toLatin1());
            sizePolicy.setHorizontalPolicy(sp);
        }

        if (sizep->hasElementVSizeType()) {
            sizePolicy.setVerticalPolicy((QSizePolicy::Policy) sizep->elementVSizeType());
        } else if (sizep->hasAttributeVSizeType()) {
            const  QSizePolicy::Policy sp = enumKeyToValue<QSizePolicy::Policy>(sizeType_enum, sizep->attributeVSizeType().toLatin1());
            sizePolicy.setVerticalPolicy(sp);
        }

        return QVariant::fromValue(sizePolicy);
    }

    case DomProperty::StringList:
        return QVariant(p->elementStringList()->elementString());

    default:
        uiLibWarning(QCoreApplication::translate("QFormBuilder", "Reading properties of the type %1 is not supported yet.").arg(p->kind()));
        break;
    }

    return QVariant();
}
Esempio n. 10
0
BackstageOSF::BackstageOSF(QWidget *parent) : BackstagePage(parent)
{
	QGridLayout *layout = new QGridLayout(this);
	layout->setSpacing(0);
	layout->setContentsMargins(0, 0, 0, 0);
	setLayout(layout);

	QWidget *topRow = new QWidget(this);
	layout->addWidget(topRow);

	QGridLayout *topRowLayout = new QGridLayout();
	topRowLayout->setContentsMargins(0, 6, 12, 0);
	topRow->setLayout(topRowLayout);

	QLabel *label = new QLabel("Open Science Framework", topRow);
	QSizePolicy sp = label->sizePolicy();
	sp.setHorizontalStretch(1);
	label->setSizePolicy(sp);
	label->setContentsMargins(12, 12, 12, 1);
	topRowLayout->addWidget(label, 0, 0);

	_nameButton = new QToolButton(topRow);
	_nameButton->hide();
	topRowLayout->addWidget(_nameButton, 0, 1);

	connect(_nameButton, SIGNAL(clicked(bool)), this, SLOT(nameClicked()));

	QWidget *buttonsWidget = new QWidget(this);
	buttonsWidget->setContentsMargins(0, 0, 0, 0);
	layout->addWidget(buttonsWidget);

	QGridLayout *buttonsWidgetLayout = new QGridLayout(buttonsWidget);
	buttonsWidgetLayout->setContentsMargins(0, 0, 12, 0);
	buttonsWidget->setLayout(buttonsWidgetLayout);

	_breadCrumbs = new BreadCrumbs(buttonsWidget);
	buttonsWidgetLayout->addWidget(_breadCrumbs, 0, 0);

	_newFolderButton = new QToolButton(buttonsWidget);
	_newFolderButton->setText("New Folder");
	_newFolderButton->hide();
	buttonsWidgetLayout->addWidget(_newFolderButton, 0, 2);

	_fileNameContainer = new QWidget(this);
	_fileNameContainer->hide();
	_fileNameContainer->setObjectName("browseContainer");
	layout->addWidget(_fileNameContainer);

	QHBoxLayout *saveLayout = new QHBoxLayout(_fileNameContainer);
	_fileNameContainer->setLayout(saveLayout);

	_fileNameTextBox = new QLineEdit(_fileNameContainer);
	QSizePolicy policy = _fileNameTextBox->sizePolicy();
	policy.setHorizontalStretch(1);
	_fileNameTextBox->setSizePolicy(policy);
	_fileNameTextBox->setEnabled(false);

	saveLayout->addWidget(_fileNameTextBox);

	_saveButton = new QPushButton(_fileNameContainer);
	_saveButton->setText("Save");
	_saveButton->setEnabled(false);
	saveLayout->addWidget(_saveButton, 0, Qt::AlignRight);

	QWidget *line;

	line = new QWidget(this);
	line->setFixedHeight(1);
	line->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line);

	_model = new FSBMOSF();

	connect(_model, SIGNAL(authenticationSuccess()), this, SLOT(updateUserDetails()));
	connect(_model, SIGNAL(authenticationClear()), this, SLOT(updateUserDetails()));

	_fsBrowser = new FSBrowser(this);
	_fsBrowser->setViewType(FSBrowser::ListView);
	_fsBrowser->setFSModel(_model);
	layout->addWidget(_fsBrowser);

	_breadCrumbs->setModel(_model);
	_breadCrumbs->setEnabled(false);

	connect(_fsBrowser, SIGNAL(entryOpened(QString)), this, SLOT(notifyDataSetOpened(QString)));
	connect(_fsBrowser, SIGNAL(entrySelected(QString)), this, SLOT(notifyDataSetSelected(QString)));

	connect(_saveButton, SIGNAL(clicked()), this, SLOT(saveClicked()));
	connect(_newFolderButton, SIGNAL(clicked(bool)), this, SLOT(newFolderClicked()));

	line = new QWidget(this);
	line->setFixedWidth(1);
	line->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
	line->setStyleSheet("QWidget { background-color: #A3A4A5 ; }");
	layout->addWidget(line, 0, 1, 6, 1);

	QWidget *about = new QWidget(this);
	about->setObjectName("aboutOSF");
	about->setStyleSheet("#aboutOSF { border-top: 1px solid #A3A4A5 ; }");
	layout->addWidget(about);

	QHBoxLayout *aboutLayout = new QHBoxLayout(about);
	aboutLayout->setSpacing(12);
	about->setLayout(aboutLayout);

	HyperlinkLabel *aboutOSF = new HyperlinkLabel(about);
	aboutOSF->setText("<a href='https://osf.io/getting-started/'>About the OSF</a>");

	HyperlinkLabel *registerOSF = new HyperlinkLabel(about);
	registerOSF->setText("<a href='https://osf.io/'>Register</a>");

	aboutLayout->addWidget(aboutOSF);
	aboutLayout->addWidget(registerOSF);
	aboutLayout->addStretch(1);
}
Esempio n. 11
0
DatabaseWidget::DatabaseWidget(Database* db, QWidget* parent)
    : QStackedWidget(parent)
    , m_db(db)
    , m_searchUi(new Ui::SearchWidget())
    , m_searchWidget(new QWidget())
    , m_newGroup(Q_NULLPTR)
    , m_newEntry(Q_NULLPTR)
    , m_newParent(Q_NULLPTR)
{
    m_searchUi->setupUi(m_searchWidget);

    m_searchTimer = new QTimer(this);
    m_searchTimer->setSingleShot(true);

    m_mainWidget = new QWidget(this);
    QLayout* layout = new QHBoxLayout(m_mainWidget);
    QSplitter* splitter = new QSplitter(m_mainWidget);

    QWidget* rightHandSideWidget = new QWidget(splitter);
    m_searchWidget->setParent(rightHandSideWidget);

    m_groupView = new GroupView(db, splitter);
    m_groupView->setObjectName("groupView");
    m_groupView->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(m_groupView, SIGNAL(customContextMenuRequested(QPoint)),
            SLOT(emitGroupContextMenuRequested(QPoint)));

    m_entryView = new EntryView(rightHandSideWidget);
    m_entryView->setObjectName("entryView");
    m_entryView->setContextMenuPolicy(Qt::CustomContextMenu);
    m_entryView->setGroup(db->rootGroup());
    connect(m_entryView, SIGNAL(customContextMenuRequested(QPoint)),
            SLOT(emitEntryContextMenuRequested(QPoint)));

    QSizePolicy policy;
    policy = m_groupView->sizePolicy();
    policy.setHorizontalStretch(30);
    m_groupView->setSizePolicy(policy);
    policy = rightHandSideWidget->sizePolicy();
    policy.setHorizontalStretch(70);
    rightHandSideWidget->setSizePolicy(policy);

    QAction* closeAction = new QAction(m_searchWidget);
    QIcon closeIcon = filePath()->icon("actions", "dialog-close");
    closeAction->setIcon(closeIcon);
    m_searchUi->closeSearchButton->setDefaultAction(closeAction);
    m_searchUi->closeSearchButton->setShortcut(Qt::Key_Escape);
    m_searchWidget->hide();
    m_searchUi->caseSensitiveCheckBox->setVisible(false);

    QVBoxLayout* vLayout = new QVBoxLayout(rightHandSideWidget);
    vLayout->setMargin(0);
    vLayout->addWidget(m_searchWidget);
    vLayout->addWidget(m_entryView);

    rightHandSideWidget->setLayout(vLayout);

    splitter->addWidget(m_groupView);
    splitter->addWidget(rightHandSideWidget);

    layout->addWidget(splitter);
    m_mainWidget->setLayout(layout);

    m_editEntryWidget = new EditEntryWidget();
    m_editEntryWidget->setObjectName("editEntryWidget");
    m_historyEditEntryWidget = new EditEntryWidget();
    m_editGroupWidget = new EditGroupWidget();
    m_editGroupWidget->setObjectName("editGroupWidget");
    m_changeMasterKeyWidget = new ChangeMasterKeyWidget();
    m_changeMasterKeyWidget->headlineLabel()->setText(tr("Change master key"));
    QFont headlineLabelFont = m_changeMasterKeyWidget->headlineLabel()->font();
    headlineLabelFont.setBold(true);
    headlineLabelFont.setPointSize(headlineLabelFont.pointSize() + 2);
    m_changeMasterKeyWidget->headlineLabel()->setFont(headlineLabelFont);
    m_databaseSettingsWidget = new DatabaseSettingsWidget();
    m_databaseSettingsWidget->setObjectName("databaseSettingsWidget");
    m_databaseOpenWidget = new DatabaseOpenWidget();
    m_databaseOpenWidget->setObjectName("databaseOpenWidget");
    m_keepass1OpenWidget = new KeePass1OpenWidget();
    m_keepass1OpenWidget->setObjectName("keepass1OpenWidget");
    m_unlockDatabaseWidget = new UnlockDatabaseWidget();
    m_unlockDatabaseWidget->setObjectName("unlockDatabaseWidget");
    addWidget(m_mainWidget);
    addWidget(m_editEntryWidget);
    addWidget(m_editGroupWidget);
    addWidget(m_changeMasterKeyWidget);
    addWidget(m_databaseSettingsWidget);
    addWidget(m_historyEditEntryWidget);
    addWidget(m_databaseOpenWidget);
    addWidget(m_keepass1OpenWidget);
    addWidget(m_unlockDatabaseWidget);

    connect(m_groupView, SIGNAL(groupChanged(Group*)), this, SLOT(clearLastGroup(Group*)));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), SIGNAL(groupChanged()));
    connect(m_groupView, SIGNAL(groupChanged(Group*)), m_entryView, SLOT(setGroup(Group*)));
    connect(m_entryView, SIGNAL(entryActivated(Entry*, EntryModel::ModelColumn)),
            SLOT(entryActivationSignalReceived(Entry*, EntryModel::ModelColumn)));
    connect(m_entryView, SIGNAL(entrySelectionChanged()), SIGNAL(entrySelectionChanged()));
    connect(m_editEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_editEntryWidget, SIGNAL(historyEntryActivated(Entry*)), SLOT(switchToHistoryView(Entry*)));
    connect(m_historyEditEntryWidget, SIGNAL(editFinished(bool)), SLOT(switchBackToEntryEdit()));
    connect(m_editGroupWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_changeMasterKeyWidget, SIGNAL(editFinished(bool)), SLOT(updateMasterKey(bool)));
    connect(m_databaseSettingsWidget, SIGNAL(editFinished(bool)), SLOT(switchToView(bool)));
    connect(m_databaseOpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
    connect(m_keepass1OpenWidget, SIGNAL(editFinished(bool)), SLOT(openDatabase(bool)));
    connect(m_unlockDatabaseWidget, SIGNAL(editFinished(bool)), SLOT(unlockDatabase(bool)));
    connect(this, SIGNAL(currentChanged(int)), this, SLOT(emitCurrentModeChanged()));
    connect(m_searchUi->searchEdit, SIGNAL(textChanged(QString)), this, SLOT(startSearchTimer()));
    connect(m_searchUi->caseSensitiveCheckBox, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchCurrentRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchUi->searchRootRadioButton, SIGNAL(toggled(bool)), this, SLOT(startSearch()));
    connect(m_searchTimer, SIGNAL(timeout()), this, SLOT(search()));
    connect(closeAction, SIGNAL(triggered()), this, SLOT(closeSearch()));

    setCurrentWidget(m_mainWidget);
}
Esempio n. 12
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent)
{

    // set working dir to executable work directory
    QDir::setCurrent(QCoreApplication::applicationDirPath());
    QString resDir = ResourceFinder::getPath();
    
    //chess::FuncT *f = new chess::FuncT();
    //f->run_pgn_speedtest();
    //f->run_polyglot();
    /*
    f->run_pgnt();
    f->run_pgn_scant();
    */

    // reconstruct gameModel
    this->gameModel = new GameModel();
    this->gameModel->restoreGameState();
    this->gameModel->getGame()->setTreeWasChanged(true);

    this->boardViewController = new BoardViewController(gameModel, this);
    this->moveViewController = new MoveViewController(gameModel, this);
    this->moveViewController->setFocus();
    this->engineViewController = new EngineView(gameModel, this);
    engineViewController->setFocusPolicy(Qt::NoFocus);
    moveViewController->setFocusPolicy(Qt::ClickFocus);

    this->name = new QLabel();
    name->setText("<b>Robert James Fisher - Reuben Fine</b><br/>New York(USA) 1963.03.??");
    name->setAlignment(Qt::AlignCenter);
    name->setBuddy(moveViewController);

    QHBoxLayout *hbox_name_editHeader = new QHBoxLayout();
    QPushButton *editHeader = new QPushButton();
    QPixmap pxEditHeader(*this->fromSvgToPixmap(editHeader->iconSize(),resDir + "/res/icons/document-properties.svg"));
    editHeader->setIcon(QIcon(pxEditHeader));

    hbox_name_editHeader->addStretch(1);
    hbox_name_editHeader->addWidget(this->name);
    hbox_name_editHeader->addStretch(1);
    hbox_name_editHeader->addWidget(editHeader);

    this->uciController     = new UciController();
    this->modeController    = new ModeController(gameModel, uciController, this);
    this->editController    = new EditController(gameModel, this);
    this->fileController    = new FileController(gameModel, this);

    QSize btnSize           = QSize(this->height()/19, this->height()/19);
    QSize btnSizeLR         = QSize(this->height()/14, this->height()/14);
    QPushButton *left       = new QPushButton();
    QPushButton *right      = new QPushButton();
    QPushButton *beginning  = new QPushButton();
    QPushButton *end        = new QPushButton();

    left->setIconSize(btnSizeLR);
    right->setIconSize(btnSizeLR);
    beginning->setIconSize(btnSize);
    end->setIconSize(btnSize);

    QPixmap pxRight(*this->fromSvgToPixmap(right->iconSize(),resDir + "/res/icons/go-next.svg"));
    QPixmap pxLeft(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-previous.svg"));
    QPixmap pxBeginning(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-first.svg"));
    QPixmap pxEnd(*this->fromSvgToPixmap(left->iconSize(),resDir + "/res/icons/go-last.svg"));

    right->setIcon(QIcon(pxRight));
    left->setIcon(QIcon(pxLeft));
    beginning->setIcon(QIcon(pxBeginning));
    end->setIcon(QIcon(pxEnd));

    QWidget *mainWidget = new QWidget();

    // setup the main window
    // consisting of:
    //
    // <-------menubar---------------------------->
    // <chess-     ->   <label w/ game data      ->
    // <board      ->   <moves_edit_view---------->
    // <view       ->   <engine output view      ->


    QSizePolicy *spLeft = new QSizePolicy();
    spLeft->setHorizontalStretch(1);

    QSizePolicy *spRight = new QSizePolicy();
    spRight->setHorizontalStretch(2);

    QHBoxLayout *hbox_buttons = new QHBoxLayout();
    hbox_buttons->addStretch(1);
    hbox_buttons->addWidget(beginning);
    hbox_buttons->addWidget(left);
    hbox_buttons->addWidget(right);
    hbox_buttons->addWidget(end);
    hbox_buttons->addStretch(1);

    QHBoxLayout *hbox_right_engine_buttons = new QHBoxLayout();

    this->pbEngineOnOff = new OnOffButton(this); //new QPushButton("OFF");
    this->lblMultiPv    = new QLabel(this->tr("Lines:"), this);
    this->spinMultiPv   = new QSpinBox(this);
    this->spinMultiPv->setRange(1,4);
    this->spinMultiPv->setValue(1);
    this->lblMultiPv->setBuddy(this->spinMultiPv);

    QPushButton *editEngines = new QPushButton();
    QPixmap pxEditEngines(*this->fromSvgToPixmap(editEngines->iconSize(),resDir + "/res/icons/document-properties.svg"));
    editEngines->setIcon(QIcon(pxEditEngines));

    hbox_right_engine_buttons->addWidget(pbEngineOnOff);
    hbox_right_engine_buttons->addWidget(this->lblMultiPv);
    hbox_right_engine_buttons->addWidget(this->spinMultiPv);
    hbox_right_engine_buttons->addStretch(1);
    hbox_right_engine_buttons->addWidget(editEngines);

    QVBoxLayout *vbox_right = new QVBoxLayout();
    vbox_right->addLayout(hbox_name_editHeader);
    vbox_right->addWidget(moveViewController);
    vbox_right->addLayout(hbox_buttons);

    vbox_right->setStretch(0,1);
    vbox_right->setStretch(1,4);
    vbox_right->setStretch(2,1);

    QVBoxLayout *vbox_left = new QVBoxLayout();
    vbox_left->addWidget(boardViewController);

    QWidget *lHboxWidget = new QWidget(this);
    lHboxWidget->setLayout(vbox_left);
    QWidget *rHboxWidget = new QWidget(this);
    rHboxWidget->setLayout(vbox_right);
    this->splitterLeftRight = new QSplitter(this);
    splitterLeftRight->addWidget(lHboxWidget);
    splitterLeftRight->addWidget(rHboxWidget);

    QSplitterHandle *handleLeftRight = splitterLeftRight->handle(1);
    QHBoxLayout *layoutSplitterLeftRight = new QHBoxLayout(handleLeftRight);
    layoutSplitterLeftRight->setSpacing(0);
    layoutSplitterLeftRight->setMargin(0);

    QFrame *frameLeftRight = new QFrame(handleLeftRight);
    frameLeftRight->setFrameShape(QFrame::VLine);
    frameLeftRight->setFrameShadow(QFrame::Sunken);
    layoutSplitterLeftRight->addWidget(frameLeftRight);


    this->splitterTopDown = new QSplitter(this);
    splitterTopDown->addWidget(splitterLeftRight);
    splitterTopDown->setOrientation(Qt::Vertical);

    QVBoxLayout *completeLayout = new QVBoxLayout();
    completeLayout->addLayout(hbox_right_engine_buttons);
    completeLayout->addWidget(engineViewController);
    QWidget* bottomWidget = new QWidget(this);
    bottomWidget->setLayout(completeLayout);
    splitterTopDown->addWidget(bottomWidget);

    QHBoxLayout *completeLayoutWithSplitter = new QHBoxLayout();
    completeLayoutWithSplitter->addWidget(splitterTopDown);

    QSplitterHandle *handleTopDown = splitterTopDown->handle(1);
    QHBoxLayout *layoutSplitterTopDown = new QHBoxLayout(handleTopDown);
    layoutSplitterTopDown->setSpacing(0);
    layoutSplitterTopDown->setMargin(0);

    QFrame *frameTopDown = new QFrame(handleTopDown);
    frameTopDown->setFrameShape(QFrame::HLine);
    frameTopDown->setFrameShadow(QFrame::Sunken);
    layoutSplitterTopDown->addWidget(frameTopDown);


    QMenu *m_game = this->menuBar()->addMenu(this->tr("Game"));
    QAction* actionNewGame = m_game->addAction(this->tr("New..."));
    QAction* actionOpen = m_game->addAction(this->tr("Open File"));
    QAction* actionSaveAs =  m_game->addAction("Save Current Game As");
    m_game->addSeparator();
    QAction* actionPrintGame = m_game->addAction(this->tr("Print Game"));
    QAction* actionPrintPosition = m_game->addAction(this->tr("Print Position"));
    QAction *save_diagram = m_game->addAction(this->tr("Save Position as Image..."));
    m_game->addSeparator();
    QAction *actionQuit = m_game->addAction(this->tr("Quit"));

    actionNewGame->setShortcut(QKeySequence::New);
    actionOpen->setShortcut(QKeySequence::Open);
    //save_game->setShortcut(QKeySequence::Save);
    actionSaveAs->setShortcut(QKeySequence::SaveAs);
    actionPrintGame->setShortcut(QKeySequence::Print);
    actionQuit->setShortcut(QKeySequence::Quit);

    // EDIT MENU
    QMenu *m_edit = this->menuBar()->addMenu(this->tr("Edit"));
    QAction *actionCopyGame = m_edit->addAction(this->tr("Copy Game"));
    QAction *actionCopyPosition = m_edit->addAction(this->tr("Copy Position"));
    QAction *actionPaste = m_edit->addAction(this->tr("Paste"));
    m_edit->addSeparator();
    QAction *actionEditGameData = m_edit->addAction(this->tr("Edit Game Data"));
    QAction *actionEnterPosition = m_edit->addAction(this->tr("&Enter Position"));
    m_edit->addSeparator();
    QAction *actionFlipBoard = m_edit->addAction(this->tr("&Flip Board"));
    this->actionShowSearchInfo = m_edit->addAction(this->tr("Show Search &Info"));
    QAction *actionColorStyle = m_edit->addAction(this->tr("Color Style..."));
    QAction *actionResetLayout = m_edit->addAction(this->tr("Reset Layout"));
    actionCopyGame->setShortcut(QKeySequence::Copy);
    actionPaste->setShortcut(QKeySequence::Paste);
    actionEnterPosition->setShortcut('e');
    actionFlipBoard->setCheckable(true);
    actionFlipBoard->setChecked(false);
    actionShowSearchInfo->setCheckable(true);
    actionShowSearchInfo->setChecked(true);

    // MODE MENU
    QMenu *m_mode = this->menuBar()->addMenu(this->tr("Mode"));
    QActionGroup *mode_actions = new QActionGroup(this);
    this->actionAnalysis = mode_actions->addAction(this->tr("&Analysis Mode"));
    this->actionPlayWhite = mode_actions->addAction(this->tr("Play as &White"));
    this->actionPlayBlack = mode_actions->addAction(this->tr("Play as &Black"));
    this->actionEnterMoves = mode_actions->addAction(this->tr("Enter &Moves"));
    actionAnalysis->setCheckable(true);
    actionPlayWhite->setCheckable(true);
    actionPlayBlack->setCheckable(true);
    actionEnterMoves->setCheckable(true);
    mode_actions->setExclusive(true);
    m_mode->addAction(actionAnalysis);
    m_mode->addAction(actionPlayWhite);
    m_mode->addAction(actionPlayBlack);
    m_mode->addAction(actionEnterMoves);
    m_mode->addSeparator();
    QAction* actionFullGameAnalysis = m_mode->addAction(this->tr("Full Game Analysis"));
    QAction* actionEnginePlayout = m_mode->addAction(this->tr("Playout Position"));
    m_mode->addSeparator();
    QAction *actionSetEngines = m_mode->addAction(this->tr("Engines..."));
    QShortcut *sc_analysis_mode = new QShortcut(QKeySequence(Qt::Key_A), this);
    sc_analysis_mode->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_play_white = new QShortcut(QKeySequence(Qt::Key_W), this);
    sc_play_white->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_play_black = new QShortcut(QKeySequence(Qt::Key_B), this);
    sc_play_black->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_enter_move_mode_m = new QShortcut(QKeySequence(Qt::Key_M), this);
    QShortcut *sc_enter_move_mode_esc = new QShortcut(QKeySequence(Qt::Key_Escape), this);
    sc_enter_move_mode_m->setContext(Qt::ApplicationShortcut);
    sc_enter_move_mode_esc->setContext(Qt::ApplicationShortcut);

    // DATABASE MENU
    QMenu *m_database = this->menuBar()->addMenu(this->tr("Database"));
    QAction* actionDatabaseWindow = m_database->addAction(this->tr("Browse Games"));
    QAction* actionLoadNextGame = m_database->addAction(this->tr("Next Game"));
    QAction* actionLoadPreviousGame = m_database->addAction(this->tr("Previous Game"));

    // HELP MENU
    QMenu *m_help = this->menuBar()->addMenu(this->tr("Help "));
    QAction *actionAbout = m_help->addAction(this->tr("About"));
    QAction *actionHomepage = m_help->addAction(this->tr("Jerry-Homepage"));


    // TOOLBAR
    this->toolbar = addToolBar("main toolbar");
    this->toolbar->setMovable(false);
    //this->toolbar->setFixedHeight(72);
    //this->toolbar->setIconSize(QSize(72,72));
    QSize iconSize = toolbar->iconSize() * this->devicePixelRatio();
    toolbar->setIconSize(iconSize);
    if(SHOW_ICON_TEXT) {
        toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
    }
    QString doc_new(resDir + "/res/icons/document-new.svg");
    QPixmap *tbNew = this->fromSvgToPixmap(iconSize,doc_new);
    QAction *tbActionNew = toolbar->addAction(QIcon(*tbNew), this->tr("New"));

    QString doc_open(resDir + "/res/icons/document-open.svg");
    QPixmap *tbOpen = this->fromSvgToPixmap(iconSize, doc_open);
    QAction *tbActionOpen = toolbar->addAction(QIcon(*tbOpen), this->tr("Open"));

    QString doc_save(resDir + "/res/icons/document-save.svg");
    QPixmap *tbSaveAs = this->fromSvgToPixmap(iconSize, doc_save);
    QAction *tbActionSaveAs = toolbar->addAction(QIcon(*tbSaveAs), this->tr("Save As"));

    QString doc_print(resDir + "/res/icons/document-print.svg");
    QPixmap *tbPrint = this->fromSvgToPixmap(iconSize, doc_print);
    QAction *tbActionPrint = toolbar->addAction(QIcon(*tbPrint), this->tr("Print"));

    toolbar->addSeparator();

    QString view_ref(resDir + "/res/icons/view-refresh.svg");
    QPixmap *tbFlip = this->fromSvgToPixmap(iconSize, view_ref);
    QAction *tbActionFlip = toolbar->addAction(QIcon(*tbFlip), this->tr("Flip Board"));

    toolbar->addSeparator();

    QString edt_cpy(resDir + "/res/icons/edit-copy-pgn.svg");
    QPixmap *tbCopyGame = this->fromSvgToPixmap(iconSize, edt_cpy);
    QAction *tbActionCopyGame = toolbar->addAction(QIcon(*tbCopyGame), this->tr("Copy Game"));

    QString cpy_fen(resDir + "/res/icons/edit-copy-fen.svg");
    QPixmap *tbCopyPosition = this->fromSvgToPixmap(iconSize, cpy_fen);
    QAction *tbActionCopyPosition = toolbar->addAction(QIcon(*tbCopyPosition), this->tr("Copy Position"));

    QString edt_pst(resDir + "/res/icons/edit-paste.svg");
    QPixmap *tbPaste = this->fromSvgToPixmap(iconSize, edt_pst);
    QAction *tbActionPaste = toolbar->addAction(QIcon(*tbPaste), this->tr("Paste"));

    QString new_brd(resDir + "/res/icons/document-enter-position.svg");
    QPixmap *tbEnterPosition = this->fromSvgToPixmap(iconSize, new_brd);
    QAction *tbActionEnterPosition = toolbar->addAction(QIcon(*tbEnterPosition), this->tr("Enter Position"));

    toolbar->addSeparator();

    QString brd_ana(resDir + "/res/icons/emblem-system.svg");
    QPixmap *tbAnalysis = this->fromSvgToPixmap(iconSize, brd_ana);
    QAction *tbActionAnalysis = toolbar->addAction(QIcon(*tbAnalysis), this->tr("Full Analysis"));

    toolbar->addSeparator();

    QString db_icn(resDir + "/res/icons/database.svg");
    QPixmap *tbDatabase = this->fromSvgToPixmap(iconSize, db_icn);
    QAction *tbActionDatabase = toolbar->addAction(QIcon(*tbDatabase), this->tr("Browse Games"));

    QString prevGame_icn(resDir + "/res/icons/go-previous.svg");
    QPixmap *tbPrevGame = this->fromSvgToPixmap(iconSize, prevGame_icn);
    QAction *tbActionPrevGame = toolbar->addAction(QIcon(*tbPrevGame), this->tr("Prev. Game"));

    QString nextGame_icn(resDir + "/res/icons/go-next.svg");
    QPixmap *tbNextGame = this->fromSvgToPixmap(iconSize, nextGame_icn);
    QAction *tbActionNextGame = toolbar->addAction(QIcon(*tbNextGame), this->tr("Next Game"));

    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    toolbar->addWidget(spacer);

    QString hlp_clc(resDir + "/res/icons/help-browser.svg");
    QPixmap *tbHelp = this->fromSvgToPixmap(iconSize, hlp_clc);
    QAction *tbActionHelp = toolbar->addAction(QIcon(*tbHelp), this->tr("About"));

    // toolbar shortcuts
    QShortcut *sc_flip = new QShortcut(QKeySequence(Qt::Key_F), this);
    sc_flip->setContext(Qt::ApplicationShortcut);
    QShortcut *sc_enter_pos = new QShortcut(QKeySequence(Qt::Key_E), this);
    sc_enter_pos->setContext(Qt::ApplicationShortcut);


    /*
    // FILE
    // Game
    QAction* actionNewGame = this->createAction("document-new", this->tr("New Game"), iconSize);
    QAction* actionOpen = this->createAction("document-open", this->tr("Open File"), iconSize);
    QAction* actionSaveAs = this->createAction("document-save", this->tr("Save Current\nGame As"), iconSize);
    // Print
    QAction* actionPrintGame = this->createAction("document-print", this->tr("Print Game"), iconSize);
    QAction* actionPrintPosition = this->createAction("document-print-board", this->tr("Print Position"), iconSize);
    // Layout
    QAction* actionColorStyle = this->createAction("applications-graphics", this->tr("Board Style"), iconSize);
    QAction* actionResetLayout = this->createAction("preferences-system-session", this->tr("Reset Layout"), iconSize);
    // Quit
    QAction* actionQuit = this->createAction("system-log-out", this->tr("Exit"), iconSize);
    // Homepage
    QAction* actionHomepage = this->createAction("internet-web-browser", this->tr("Homepage"), iconSize);
    // Help (About)
    QAction* actionAbout = this->createAction("help-browser", this->tr("About"), iconSize);

    // START
    // Game
    QAction* actionPaste = this->createAction("edit-paste", this->tr("Paste\nGame/Position"), iconSize);
    QAction* actionCopyGame = this->createAction("edit-copy-pgn", this->tr("Copy Game"), iconSizeSmall);
    QAction* actionCopyPosition = this->createAction("edit-copy-fen", this->tr("Copy Position"), iconSizeSmall);
    // Edit
    QAction* actionEditGameData = this->createAction("edit-copy-fen", this->tr("Edit\nMeta Data"), iconSize);
    QAction* actionEnterPosition = this->createAction("document-enter-position", this->tr("Setup\nNew Position"), iconSize);
    QAction* actionFlipBoard = this->createAction("view-refresh", this->tr("Flip Board"), iconSize);
    //QAction* actionShowSearchInfo = this->createAction("view-refresh", this->tr("Show\nSearch Info"), iconSize);
    // Mode
    QAction* actionAnalysis = this->createAction("edit-find", this->tr("Infinite\nAnalysis"), iconSize);
    QAction* actionPlayWhite = this->createAction("play-white", this->tr("Play\nWhite"), iconSize);
    QAction* actionPlayBlack = this->createAction("play-black", this->tr("Play\nBlack"), iconSize);
    QAction* actionEnterMoves = this->createAction("text-pencil", this->tr("Enter\nMoves"), iconSize);
    // Analysis
    QAction* actionFullGameAnalysis = this->createAction("edit-find-replace", this->tr("Full\nGame Analysis"), iconSize);
    QAction* actionEnginePlayout = this->createAction("dialog-information", this->tr("Engine\nPlayout"), iconSize);
    // Database
    QAction* actionDatabaseWindow = this->createAction("database", this->tr("Show\nDatabase"), iconSize);
    QAction* actionLoadPreviousGame = this->createAction("go-previous", this->tr("Previous Game"), iconSizeSmall);
    QAction* actionLoadNextGame = this->createAction("go-previous", this->tr("Next Game"), iconSizeSmall);
    */

    mainWidget->setLayout(completeLayoutWithSplitter);

    this->setCentralWidget(mainWidget);
    QStatusBar *statusbar = this->statusBar();
    statusbar->showMessage("");
    this->setContextMenuPolicy(Qt::NoContextMenu);

    // SIGNALS AND SLOTS

    connect(actionNewGame, &QAction::triggered, this->fileController, &FileController::newGame);
    connect(actionOpen, &QAction::triggered, this->fileController, &FileController::openGame);
    connect(actionSaveAs, &QAction::triggered, this->fileController, &FileController::saveAsNewGame);
    connect(actionPrintGame, &QAction::triggered, this->fileController, &FileController::printGame);
    connect(actionPrintPosition, &QAction::triggered, this->fileController, &FileController::printPosition);

    connect(actionColorStyle, &QAction::triggered, modeController, &ModeController::onOptionsClicked);
    connect(actionResetLayout, &QAction::triggered, this, &MainWindow::resetLayout);
    connect(actionQuit, &QAction::triggered, this, &QCoreApplication::quit);
    connect(actionHomepage, &QAction::triggered, this, &MainWindow::goToHomepage);
    connect(actionAbout, &QAction::triggered, this, &MainWindow::showAbout);

    connect(actionPaste, &QAction::triggered, this->editController, &EditController::paste);
    connect(actionCopyGame, &QAction::triggered, this->editController, &EditController::copyGameToClipBoard);
    connect(actionCopyPosition, &QAction::triggered, this->editController, &EditController::copyPositionToClipBoard);

    connect(actionEditGameData, &QAction::triggered, editController, &EditController::editHeaders);
    connect(actionEnterPosition, &QAction::triggered, editController, &EditController::enterPosition);
    connect(actionFlipBoard, &QAction::triggered, this->boardViewController, &BoardViewController::flipBoard);
    //connect(actionShowSearchInfo, &QAction::triggered, this->engineViewController, &EngineView::flipShowEval);

    connect(actionShowSearchInfo, &QAction::triggered, this->engineViewController, &EngineView::flipShowEval);

    connect(actionAnalysis, &QAction::triggered, modeController, &ModeController::onActivateAnalysisMode);
    connect(actionEnterMoves, &QAction::triggered, modeController, &ModeController::onActivateEnterMovesMode);
    connect(actionPlayWhite, &QAction::triggered, modeController, &ModeController::onActivatePlayWhiteMode);
    connect(actionPlayBlack, &QAction::triggered, modeController, &ModeController::onActivatePlayBlackMode);
    connect(actionFullGameAnalysis, &QAction::triggered, modeController, &ModeController::onActivateGameAnalysisMode);
    connect(actionEnginePlayout, &QAction::triggered, modeController, &ModeController::onActivatePlayoutPositionMode);

    connect(actionSetEngines, &QAction::triggered, this->modeController, &ModeController::onSetEnginesClicked);

    connect(actionDatabaseWindow, &QAction::triggered, fileController, &FileController::openDatabase);
    connect(actionLoadNextGame, &QAction::triggered, fileController, &FileController::toolbarNextGameInPGN);
    connect(actionLoadPreviousGame, &QAction::triggered, fileController, &FileController::toolbarPrevGameInPGN);

    // toolbar buttons

    connect(sc_flip, &QShortcut::activated, actionFlipBoard, &QAction::trigger);

    connect(tbActionNew,  &QAction::triggered, actionNewGame, &QAction::trigger);
    connect(tbActionOpen,  &QAction::triggered, actionOpen, &QAction::trigger);
    connect(tbActionSaveAs,  &QAction::triggered, actionSaveAs, &QAction::trigger);
    connect(tbActionPrint,  &QAction::triggered, actionPrintGame, &QAction::trigger);
    connect(tbActionFlip,  &QAction::triggered, actionFlipBoard, &QAction::trigger);
    connect(tbActionCopyGame,  &QAction::triggered, actionCopyGame, &QAction::trigger);
    connect(tbActionCopyPosition,  &QAction::triggered, actionCopyPosition, &QAction::trigger);
    connect(tbActionPaste,  &QAction::triggered, actionPaste, &QAction::trigger);
    connect(tbActionEnterPosition,  &QAction::triggered, actionEnterPosition, &QAction::trigger);
    connect(tbActionAnalysis,  &QAction::triggered, actionFullGameAnalysis, &QAction::trigger);
    connect(tbActionDatabase,  &QAction::triggered, actionDatabaseWindow, &QAction::trigger);
    connect(tbActionPrevGame,  &QAction::triggered, actionLoadPreviousGame, &QAction::trigger);
    connect(tbActionNextGame,  &QAction::triggered, actionLoadNextGame, &QAction::trigger);
    connect(tbActionHelp,  &QAction::triggered, actionAbout, &QAction::trigger);

    // other signals
    connect(gameModel, &GameModel::stateChange, this, &MainWindow::onStateChange);

    connect(gameModel, &GameModel::stateChange, this->boardViewController, &BoardViewController::onStateChange);
    connect(gameModel, &GameModel::stateChange, this->moveViewController, &MoveViewController::onStateChange);
    connect(gameModel, &GameModel::stateChange, this->modeController, &ModeController::onStateChange);

    connect(right, &QPushButton::clicked, this->moveViewController, &MoveViewController::onForwardClick);
    connect(left, &QPushButton::clicked, this->moveViewController, &MoveViewController::onBackwardClick);

    connect(editEngines, &QPushButton::clicked, this->modeController, &ModeController::onSetEnginesClicked);
    connect(pbEngineOnOff, &QPushButton::toggled, this, &MainWindow::onEngineToggle);
    connect(editHeader, &QPushButton::clicked, editController, &EditController::editHeaders);

    //connect(enter_moves, &QAction::triggered, modeController, &ModeController::onActivateEnterMovesMode);

    connect(uciController, &UciController::bestmove, modeController, &ModeController::onBestMove);
    connect(uciController, &UciController::updateInfo, this->engineViewController, &EngineView::onNewInfo);
    connect(uciController, &UciController::bestPv, modeController, &ModeController::onBestPv);
    connect(uciController, &UciController::mateDetected, modeController, &ModeController::onMateDetected);
    connect(uciController, &UciController::eval, modeController, &ModeController::onEval);

    connect(fileController, &FileController::newGameEnterMoves, modeController, &ModeController::onActivateEnterMovesMode);
    connect(fileController, &FileController::newGamePlayBlack, modeController, &ModeController::onActivatePlayBlackMode);
    connect(fileController, &FileController::newGamePlayWhite, modeController, &ModeController::onActivatePlayWhiteMode);   

    connect(beginning, &QPushButton::pressed, this->moveViewController, &MoveViewController::onSeekToBeginning);
    connect(end, &QPushButton::pressed, this->moveViewController, &MoveViewController::onSeekToEnd);

    connect(this->spinMultiPv, qOverload<int>(&QSpinBox::valueChanged), this->modeController, &ModeController::onMultiPVChanged);

    this->gameModel->setMode(MODE_ENTER_MOVES);
    this->actionEnterMoves->setChecked(true);
    gameModel->triggerStateChange();

    this->resetLayout();

}
Esempio n. 13
0
FSBrowser::FSBrowser(QWidget *parent, FSBrowser::BrowseMode mode) : QWidget(parent)
{
	QLabel *label = NULL;

	_browseMode = mode;
	_viewType = FSBrowser::IconView;

	QGridLayout *layout = new QGridLayout(this);
	layout->setContentsMargins(12, 12, 0, 0);  //Position all file and folder elements asn recent file label
	setLayout(layout);
		
	switch(mode)
		
	{		
	case FSBrowser::BrowseRecentFiles:
		label = new QLabel("Recent Files");
		break;
		
	case FSBrowser::BrowseExamples:
		label = new QLabel("Examples");		
		break;
		
	case FSBrowser::BrowseCurrent:
		layout->addWidget(new QLabel(QString("Double-click on the file below to synchronize or use ") + getShortCutKey() + "-Y"));
		break;
		
	default:
		break;		
	}
	
	if (label)
	{
		QFont f= QFont("SansSerif");
		f.setPointSize(18);
		label->setFont(f);
		QSizePolicy sp = label->sizePolicy();
		sp.setHorizontalStretch(1);
		label->setSizePolicy(sp);
		label->setContentsMargins(0, 0, 0, 0);
		layout->addWidget(label);
	}
	
	_scrollArea = new VerticalScrollArea(this);
	_scrollArea->setFrameShape(QScrollArea::NoFrame);
	layout->addWidget(_scrollArea);

	_scrollPane = new QWidget;
	_scrollArea->setWidget(_scrollPane);

	_scrollPaneLayout = new QVBoxLayout(_scrollPane);
	_scrollPaneLayout->setSpacing(1);
	_scrollPaneLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
	_scrollPane->setLayout(_scrollPaneLayout);

	_buttonGroup = new QButtonGroup(this);

	_authWidget = new AuthWidget(this);
	_authWidget->hide();

	_processLabel = new QLabel(this);
	_processLabel->setAlignment(Qt::AlignCenter);
	_processLabel->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
	_processLabel->setMovie(new QMovie(":/icons/loading.gif", QByteArray(), _processLabel));
	_processLabel->setHidden(true);
	layout->addWidget(_processLabel);

	connect(_authWidget, SIGNAL(loginRequested(QString,QString)), this, SLOT(loginRequested(QString,QString)));
}
Esempio n. 14
0
//-----------------------------------------------------------------------------------------------
// constructs the view
//-----------------------------------------------------------------------------------------------
void InspectorProdWell::construct()
{
    setWindowTitle("Production Well " + p_well->name() + " Properties");

    QScrollArea *scroll_area = new QScrollArea(this);

    widget = new QWidget(this);
    widget->setMinimumSize(600, 300);

    scroll_area->setAlignment(Qt::AlignCenter);
    scroll_area->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    scroll_area->setWidget(widget);

    QSizePolicy policy = scroll_area->sizePolicy();
    policy.setVerticalStretch(1);
    policy.setHorizontalStretch(1);
    policy.setVerticalPolicy(QSizePolicy::Expanding);

    QVBoxLayout *layout_main = new QVBoxLayout(this);
    setLayout(layout_main);

    QVBoxLayout *layout = new QVBoxLayout(widget);
    int row = 0;

    widget->setLayout(layout);

    // ---- setting up the control variables -----
    box_control = new QGroupBox("Control Variables", widget);
    box_control->setStyleSheet("QGroupBox{border:2px solid gray;border-radius:5px;margin-top: 1ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top center;padding:0 3px;}");
    box_control->setFixedWidth(500);
    QVBoxLayout *layout_control = new QVBoxLayout(box_control);

    box_control->setLayout(layout_control);


    for(int i = 0; i < p_well->numberOfControls(); ++i)
    {
        WellControl *wc = p_well->control(i);
        InspectorWellControl *iwc = new InspectorWellControl(wc->endTime(), wc->controlVar()->value(), wc->controlVar()->max(), wc->controlVar()->min(), wc->type(), widget, i == 0);
        m_controls.push_back(iwc);
        layout_control->addWidget(iwc);
    }

    // show/hide
    p_btn_control = new QPushButton("-", widget);
    p_btn_control->setFixedSize(25, 25);
    p_btn_control->setCheckable(true);
    p_btn_control->setChecked(false);
    connect(p_btn_control, SIGNAL(toggled(bool)), this, SLOT(hideControls(bool)));
    layout_control->addWidget(p_btn_control);



    layout->addWidget(box_control, 0, Qt::AlignHCenter);
    ++row;

    // ---- setting up the gas lift variables -----
    if(p_well->hasGasLift())
    {
        box_gaslift = new QGroupBox("Gas Lift Variables", widget);
        box_gaslift->setStyleSheet("QGroupBox{border:2px solid gray;border-radius:5px;margin-top: 1ex;} QGroupBox::title{subcontrol-origin: margin;subcontrol-position:top center;padding:0 3px;}");
        box_gaslift->setFixedWidth(500);

        QVBoxLayout *layout_gaslift = new QVBoxLayout(box_gaslift);
        //layout_control->setSizeConstraint(QLayout::SetFixedSize);
        box_gaslift->setLayout(layout_gaslift);

        for(int i = 0; i < p_well->numberOfGasLiftControls(); ++i)
        {
            WellControl *gl = p_well->gasLiftControl(i);
            InspectorGasLift *igl = new InspectorGasLift(gl->endTime(), gl->controlVar()->value(), gl->controlVar()->max(), gl->controlVar()->min(), widget, i == 0);
            m_gaslift.push_back(igl);
            layout_gaslift->addWidget(igl);
        }

        // show/hide
        p_btn_gaslift = new QPushButton("-", widget);
        p_btn_gaslift->setFixedSize(25, 25);
        p_btn_gaslift->setCheckable(true);
        p_btn_gaslift->setChecked(false);
        connect(p_btn_gaslift, SIGNAL(toggled(bool)), this, SLOT(hideGasLift(bool)));
        layout_gaslift->addWidget(p_btn_gaslift);


        layout->addWidget(box_gaslift, 0, Qt::AlignHCenter);
        ++row;


    }
Esempio n. 15
0
Arranger::Arranger(ArrangerView* parent, const char* name)
   : QWidget(parent)
      {
      setObjectName(name);
      _raster  = 0;      // measure
      selected = 0;
      showTrackinfoFlag = true;
      
      cursVal = INT_MAX;
      
      _parentWin=parent;
      
      setFocusPolicy(Qt::NoFocus);
      
      //---------------------------------------------------
      //  ToolBar
      //    create toolbar in toplevel widget
      //---------------------------------------------------

      parent->addToolBarBreak();
      QToolBar* toolbar = parent->addToolBar(tr("Arranger"));
      toolbar->setObjectName("ArrangerToolbar");
      
      QLabel* label = new QLabel(tr("Cursor"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      cursorPos = new PosLabel(0);
      cursorPos->setEnabled(false);
      cursorPos->setFixedHeight(22);
      toolbar->addWidget(cursorPos);

      label = new QLabel(tr("Snap"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      _rasterCombo = new QComboBox();
      for (int i = 0; i < 6; i++)
            _rasterCombo->insertItem(i, tr(gArrangerRasterStrings[i]), gArrangerRasterTable[i]);
      _rasterCombo->setCurrentIndex(1);
      // Set the audio record part snapping. Set to 0 (bar), the same as this combo box intial raster.
      MusEGlobal::song->setArrangerRaster(0);
      toolbar->addWidget(_rasterCombo);
      connect(_rasterCombo, SIGNAL(activated(int)), SLOT(rasterChanged(int)));
      _rasterCombo->setFocusPolicy(Qt::TabFocus);

      // Song len
      label = new QLabel(tr("Len"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);

      // song length is limited to 10000 bars; the real song len is limited
      // by overflows in tick computations
      lenEntry = new SpinBox(1, 10000, 1);
      lenEntry->setFocusPolicy(Qt::StrongFocus);
      lenEntry->setValue(MusEGlobal::song->len());
      lenEntry->setToolTip(tr("song length - bars"));
      lenEntry->setWhatsThis(tr("song length - bars"));
      toolbar->addWidget(lenEntry);
      connect(lenEntry, SIGNAL(valueChanged(int)), SLOT(songlenChanged(int)));

      label = new QLabel(tr("Pitch"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      
      globalPitchSpinBox = new SpinBox(-127, 127, 1);
      globalPitchSpinBox->setFocusPolicy(Qt::StrongFocus);
      globalPitchSpinBox->setValue(MusEGlobal::song->globalPitchShift());
      globalPitchSpinBox->setToolTip(tr("midi pitch"));
      globalPitchSpinBox->setWhatsThis(tr("global midi pitch shift"));
      toolbar->addWidget(globalPitchSpinBox);
      connect(globalPitchSpinBox, SIGNAL(valueChanged(int)), SLOT(globalPitchChanged(int)));
      
      label = new QLabel(tr("Tempo"));
      label->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
      label->setIndent(3);
      toolbar->addWidget(label);
      
      globalTempoSpinBox = new SpinBox(50, 200, 1, toolbar);
      globalTempoSpinBox->setFocusPolicy(Qt::StrongFocus);
      globalTempoSpinBox->setSuffix(QString("%"));
      globalTempoSpinBox->setValue(MusEGlobal::tempomap.globalTempo());
      globalTempoSpinBox->setToolTip(tr("midi tempo"));
      globalTempoSpinBox->setWhatsThis(tr("midi tempo"));
      toolbar->addWidget(globalTempoSpinBox);
      connect(globalTempoSpinBox, SIGNAL(valueChanged(int)), SLOT(globalTempoChanged(int)));
      
      QToolButton* tempo50  = new QToolButton();
      tempo50->setText(QString("50%"));
      tempo50->setFocusPolicy(Qt::NoFocus);
      toolbar->addWidget(tempo50);
      connect(tempo50, SIGNAL(clicked()), SLOT(setTempo50()));
      
      QToolButton* tempo100 = new QToolButton();
      tempo100->setText(tr("N"));
      tempo100->setFocusPolicy(Qt::NoFocus);
      toolbar->addWidget(tempo100);
      connect(tempo100, SIGNAL(clicked()), SLOT(setTempo100()));
      
      QToolButton* tempo200 = new QToolButton();
      tempo200->setText(QString("200%"));
      tempo200->setFocusPolicy(Qt::NoFocus);
      toolbar->addWidget(tempo200);
      connect(tempo200, SIGNAL(clicked()), SLOT(setTempo200()));

      QVBoxLayout* box  = new QVBoxLayout(this);
      box->setContentsMargins(0, 0, 0, 0);
      box->setSpacing(0);
      box->addWidget(MusECore::hLine(this), Qt::AlignTop);

      //---------------------------------------------------
      //  Tracklist
      //---------------------------------------------------

      int xscale = -100;
      int yscale = 1;

      split  = new Splitter(Qt::Horizontal, this, "split");
      split->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
      box->addWidget(split, 1000);

      tracklist = new QWidget(split);

      split->setStretchFactor(split->indexOf(tracklist), 0);
      QSizePolicy tpolicy = QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
      tpolicy.setHorizontalStretch(0);
      tpolicy.setVerticalStretch(100);
      tracklist->setSizePolicy(tpolicy);

      editor = new QWidget(split);
      split->setStretchFactor(split->indexOf(editor), 1);
      QSizePolicy epolicy = QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
      epolicy.setHorizontalStretch(255);
      epolicy.setVerticalStretch(100);
      editor->setSizePolicy(epolicy);

      //---------------------------------------------------
      //    Track Info
      //---------------------------------------------------

      infoScroll = new ScrollBar(Qt::Vertical, true, tracklist);
      infoScroll->setObjectName("infoScrollBar");
      //genTrackInfo(tracklist); // Moved below

      // Track-Info Button
      ib  = new QToolButton(tracklist);
      ib->setText(tr("TrackInfo"));
      ib->setCheckable(true);
      ib->setChecked(showTrackinfoFlag);
      ib->setFocusPolicy(Qt::NoFocus);
      connect(ib, SIGNAL(toggled(bool)), SLOT(showTrackInfo(bool)));
      
      // set up the header
      header = new Header(tracklist, "header");
      header->setFixedHeight(30);

      QFontMetrics fm1(header->font());
      int fw = 11;

      header->setColumnLabel(tr("R"), COL_RECORD, fm1.width('R')+fw);
      header->setColumnLabel(tr("M"), COL_MUTE, fm1.width('M')+fw);
      header->setColumnLabel(tr("S"), COL_SOLO, fm1.width('S')+fw);
      header->setColumnLabel(tr("C"), COL_CLASS, fm1.width('C')+fw);
      header->setColumnLabel(tr("Track"), COL_NAME, 100);
      header->setColumnLabel(tr("Port"), COL_OPORT, 60);
      header->setColumnLabel(tr("Ch"), COL_OCHANNEL, 30);
      header->setColumnLabel(tr("T"), COL_TIMELOCK, fm1.width('T')+fw);
      header->setColumnLabel(tr("Automation"), COL_AUTOMATION, 75);
      header->setColumnLabel(tr("Clef"), COL_CLEF, 75);
      for (unsigned i=0;i<custom_columns.size();i++)
        header->setColumnLabel(custom_columns[i].name, COL_CUSTOM_MIDICTRL_OFFSET+i, MAX(fm1.width(custom_columns[i].name)+fw, 30));
      header->setSectionResizeMode(COL_RECORD, QHeaderView::Fixed);
      header->setSectionResizeMode(COL_MUTE, QHeaderView::Fixed);
      header->setSectionResizeMode(COL_SOLO, QHeaderView::Fixed);
      header->setSectionResizeMode(COL_CLASS, QHeaderView::Fixed);
      header->setSectionResizeMode(COL_NAME, QHeaderView::Interactive);
      header->setSectionResizeMode(COL_OPORT, QHeaderView::Interactive);
      header->setSectionResizeMode(COL_OCHANNEL, QHeaderView::Fixed);
      header->setSectionResizeMode(COL_TIMELOCK, QHeaderView::Fixed);
      header->setSectionResizeMode(COL_AUTOMATION, QHeaderView::Interactive);
      header->setSectionResizeMode(COL_CLEF, QHeaderView::Interactive);
      for (unsigned i=0;i<custom_columns.size();i++)
        header->setSectionResizeMode(COL_CUSTOM_MIDICTRL_OFFSET+i, QHeaderView::Interactive);

      setHeaderToolTips();
      setHeaderWhatsThis();
      header->setSectionsMovable (true);
      header->restoreState(header_state);

      list = new TList(header, tracklist, "tracklist");
      
      // Do this now that the list is available.
      genTrackInfo(tracklist);
      
      connect(list, SIGNAL(selectionChanged(MusECore::Track*)), SLOT(trackSelectionChanged()));
      connect(list, SIGNAL(selectionChanged(MusECore::Track*)), SIGNAL(selectionChanged()));
      connect(list, SIGNAL(selectionChanged(MusECore::Track*)), midiTrackInfo, SLOT(setTrack(MusECore::Track*)));
      connect(header, SIGNAL(sectionResized(int,int,int)), list, SLOT(redraw()));
      connect(header, SIGNAL(sectionMoved(int,int,int)), list, SLOT(redraw()));

      //  tracklist:
      //
      //         0         1         2
      //   +-----------+--------+---------+
      //   | Trackinfo | scroll | Header  | 0
      //   |           | bar    +---------+
      //   |           |        | TList   | 1
      //   +-----------+--------+---------+
      //   |             hline            | 2
      //   +-----+------------------------+
      //   | ib  |                        | 3
      //   +-----+------------------------+

      connect(infoScroll, SIGNAL(valueChanged(int)), SLOT(trackInfoScroll(int)));
      tgrid  = new TLLayout(tracklist); // layout manager for this
      tgrid->wadd(0, trackInfo);
      tgrid->wadd(1, infoScroll);
      tgrid->wadd(2, header);
      tgrid->wadd(3, list);
      tgrid->wadd(4, MusECore::hLine(tracklist));
      tgrid->wadd(5, ib);

      //---------------------------------------------------
      //    Editor
      //---------------------------------------------------

      int offset = AL::sigmap.ticksMeasure(0);
      hscroll = new ScrollScale(-2000, -5, xscale, MusEGlobal::song->len(), Qt::Horizontal, editor, -offset);
      hscroll->setFocusPolicy(Qt::NoFocus);
      ib->setFixedHeight(hscroll->sizeHint().height());

      vscroll = new QScrollBar(editor);
      vscroll->setMinimum(0);
      vscroll->setMaximum(20*20);
      vscroll->setSingleStep(5);
      vscroll->setPageStep(25); // FIXME: too small steps here for me (flo), better control via window height?
      vscroll->setValue(0);
      vscroll->setOrientation(Qt::Vertical);      

      list->setScroll(vscroll);

      QList<int> vallist;
      vallist.append(tgrid->maximumSize().width());
      split->setSizes(vallist);

      QGridLayout* egrid  = new QGridLayout(editor);
      egrid->setColumnStretch(0, 50);
      egrid->setRowStretch(2, 50);
      egrid->setContentsMargins(0, 0, 0, 0);  
      egrid->setSpacing(0);  

      time = new MTScale(&_raster, editor, xscale);
      time->setOrigin(-offset, 0);
      canvas = new PartCanvas(&_raster, editor, xscale, yscale);
      canvas->setBg(MusEGlobal::config.partCanvasBg);
      canvas->setCanvasTools(arrangerTools);
      canvas->setOrigin(-offset, 0);
      canvas->setFocus();

      list->setFocusProxy(canvas); // Make it easy for track list popup line editor to give focus back to canvas.

      connect(canvas, SIGNAL(setUsedTool(int)), this, SIGNAL(setUsedTool(int)));
      connect(canvas, SIGNAL(trackChanged(MusECore::Track*)), list, SLOT(selectTrack(MusECore::Track*)));
      connect(list, SIGNAL(keyPressExt(QKeyEvent*)), canvas, SLOT(redirKeypress(QKeyEvent*)));
      connect(canvas, SIGNAL(selectTrackAbove()), list, SLOT(selectTrackAbove()));
      connect(canvas, SIGNAL(selectTrackBelow()), list, SLOT(selectTrackBelow()));
      connect(canvas, SIGNAL(editTrackNameSig()), list, SLOT(editTrackNameSlot()));

      connect(canvas, SIGNAL(muteSelectedTracks()), list, SLOT(muteSelectedTracksSlot()));
      connect(canvas, SIGNAL(soloSelectedTracks()), list, SLOT(soloSelectedTracksSlot()));

      connect(canvas, SIGNAL(horizontalZoom(bool, const QPoint&)), SLOT(horizontalZoom(bool, const QPoint&)));
      connect(canvas, SIGNAL(horizontalZoom(int, const QPoint&)), SLOT(horizontalZoom(int, const QPoint&)));
      connect(lenEntry,           SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(lenEntry,           SIGNAL(escapePressed()), SLOT(focusCanvas()));
      connect(globalPitchSpinBox, SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(globalPitchSpinBox, SIGNAL(escapePressed()), SLOT(focusCanvas()));
      connect(globalTempoSpinBox, SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(globalTempoSpinBox, SIGNAL(escapePressed()), SLOT(focusCanvas()));
      connect(midiTrackInfo,      SIGNAL(returnPressed()), SLOT(focusCanvas()));
      connect(midiTrackInfo,      SIGNAL(escapePressed()), SLOT(focusCanvas()));
      
      //connect(this,      SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*)));
      connect(list,      SIGNAL(redirectWheelEvent(QWheelEvent*)), canvas, SLOT(redirectedWheelEvent(QWheelEvent*)));
      connect(trackInfo, SIGNAL(redirectWheelEvent(QWheelEvent*)), infoScroll, SLOT(redirectedWheelEvent(QWheelEvent*)));
      
      egrid->addWidget(time, 0, 0, 1, 2);
      egrid->addWidget(MusECore::hLine(editor), 1, 0, 1, 2);

      egrid->addWidget(canvas,  2, 0);
      egrid->addWidget(vscroll, 2, 1);
      egrid->addWidget(hscroll, 3, 0, Qt::AlignBottom);

      connect(vscroll, SIGNAL(valueChanged(int)), canvas, SLOT(setYPos(int)));
      connect(hscroll, SIGNAL(scrollChanged(int)), canvas, SLOT(setXPos(int)));
      connect(hscroll, SIGNAL(scaleChanged(int)),  canvas, SLOT(setXMag(int)));
      connect(vscroll, SIGNAL(valueChanged(int)), list,   SLOT(setYPos(int)));
      connect(hscroll, SIGNAL(scrollChanged(int)), time,   SLOT(setXPos(int)));
      connect(hscroll, SIGNAL(scaleChanged(int)),  time,   SLOT(setXMag(int)));
      connect(canvas,  SIGNAL(timeChanged(unsigned)),   SLOT(setTime(unsigned)));
      connect(canvas,  SIGNAL(verticalScroll(unsigned)),SLOT(verticalScrollSetYpos(unsigned)));
      connect(canvas,  SIGNAL(horizontalScroll(unsigned)),hscroll, SLOT(setPos(unsigned)));
      connect(canvas,  SIGNAL(horizontalScrollNoLimit(unsigned)),hscroll, SLOT(setPosNoLimit(unsigned))); 
      connect(time,    SIGNAL(timeChanged(unsigned)),   SLOT(setTime(unsigned)));

      connect(list, SIGNAL(verticalScrollSetYpos(int)), vscroll, SLOT(setValue(int)));

      connect(canvas, SIGNAL(tracklistChanged()), list, SLOT(tracklistChanged()));
      connect(canvas, SIGNAL(dclickPart(MusECore::Track*)), SIGNAL(editPart(MusECore::Track*)));
      connect(canvas, SIGNAL(startEditor(MusECore::PartList*,int)),   SIGNAL(startEditor(MusECore::PartList*, int)));

      connect(MusEGlobal::song,   SIGNAL(songChanged(MusECore::SongChangedFlags_t)), SLOT(songChanged(MusECore::SongChangedFlags_t)));
      connect(canvas, SIGNAL(followEvent(int)), hscroll, SLOT(setOffset(int)));
      connect(canvas, SIGNAL(selectionChanged()), SIGNAL(selectionChanged()));
      connect(canvas, SIGNAL(dropSongFile(const QString&)), SIGNAL(dropSongFile(const QString&)));
      connect(canvas, SIGNAL(dropMidiFile(const QString&)), SIGNAL(dropMidiFile(const QString&)));

      connect(canvas, SIGNAL(toolChanged(int)), SIGNAL(toolChanged(int)));
      connect(MusEGlobal::song,   SIGNAL(controllerChanged(MusECore::Track*, int)), SLOT(controllerChanged(MusECore::Track*, int)));

      configChanged();  // set configuration values
      if(canvas->part())
        midiTrackInfo->setTrack(canvas->part()->track());   
      showTrackInfo(showTrackinfoFlag);
      
      // Take care of some tabbies!
      setTabOrder(tempo200, trackInfo);
      setTabOrder(trackInfo, infoScroll);
      setTabOrder(infoScroll, list);
      setTabOrder(list, canvas);
      //setTabOrder(canvas, ib);
      //setTabOrder(ib, hscroll);
      }
Esempio n. 16
0
CompositionWidget::CompositionWidget(void)
{
	/* ViewGroup */
	QGroupBox* viewGroup = new QGroupBox(this);
	QGroupBox* meshViewGroup = new QGroupBox(viewGroup);
	meshViewGroup->setTitle(tr("Mesh View"));
	mMeshViewer = new MeshViewer(meshViewGroup);
	QGroupBox* skeletonViewGroup = new QGroupBox(viewGroup);
	skeletonViewGroup->setTitle(tr("Skeleton View"));
	mSkeletonViewer = new SkeletonViewer(skeletonViewGroup);
	 
	/* ControlGroup */
	QGroupBox* buttonGroup = new QGroupBox(this);
	buttonGroup->setTitle(QObject::tr("Drape"));
	QPushButton* extractSkeletonButton = new QPushButton(buttonGroup);
	extractSkeletonButton->setText(QObject::tr("Extract Skeleton"));	 
	QPushButton* findNeckButton = new QPushButton(buttonGroup);
	findNeckButton->setText(QObject::tr("Deform Cloth"));
	QPushButton* moveClothButton = new QPushButton(buttonGroup);
	moveClothButton->setText(QObject::tr("Move Cloth"));
	QPushButton* resolvePenetrationButton = new QPushButton(buttonGroup);
	resolvePenetrationButton->setText(QObject::tr("Resolve Penetration"));
	QPushButton* physicalSimuationButton = new QPushButton(buttonGroup);
	physicalSimuationButton->setText(QObject::tr("PhysicalSimuate"));
	QPushButton* physicalSimuationStopButton = new QPushButton(buttonGroup);
	physicalSimuationStopButton->setText(QObject::tr("Stop PhysicalSimuation"));
	 
	/* Layout */
	QHBoxLayout* mainLayout = new QHBoxLayout(this);
	QSizePolicy sizePolicy = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
	sizePolicy.setHorizontalStretch(4);
	viewGroup->setSizePolicy(sizePolicy);
	sizePolicy.setHorizontalStretch(1);
	buttonGroup->setSizePolicy(sizePolicy);
	mainLayout->addWidget(viewGroup);
	mainLayout->addWidget(buttonGroup);


	QVBoxLayout* viewGroupLayout = new QVBoxLayout(viewGroup);
	viewGroupLayout->addWidget(meshViewGroup);
	viewGroupLayout->addWidget(skeletonViewGroup);
	QVBoxLayout* meshViewGroupLayout = new QVBoxLayout(meshViewGroup);
	meshViewGroupLayout->addWidget(mMeshViewer);
	QVBoxLayout* skeletonViewGroupLayout = new QVBoxLayout(skeletonViewGroup);
	skeletonViewGroupLayout->addWidget(mSkeletonViewer);
	
	QVBoxLayout* buttonGroupLayout = new QVBoxLayout(buttonGroup);
	buttonGroupLayout->addWidget(extractSkeletonButton);
	buttonGroupLayout->addWidget(findNeckButton);
	buttonGroupLayout->addWidget(moveClothButton);
	buttonGroupLayout->addWidget(resolvePenetrationButton);
	buttonGroupLayout->addWidget(physicalSimuationButton);
	buttonGroupLayout->addWidget(physicalSimuationStopButton);

	connect(extractSkeletonButton, SIGNAL(clicked()), this, SLOT(extractSkeleton()));
	connect(moveClothButton, SIGNAL(clicked()), this, SLOT(moveCloth()));
	connect(findNeckButton, SIGNAL(clicked()), this, SLOT(deformCloth()));
	connect(resolvePenetrationButton, SIGNAL(clicked()), this, SLOT(resolvePenetration()));
	connect(physicalSimuationButton, SIGNAL(clicked()), this, SLOT(startPhysicalSimulation()));
	connect(physicalSimuationStopButton, SIGNAL(clicked()), this, SLOT(stopPhysicalSimulation()));

//	SkeletonUtility utility;
//	utility.readIntoContainer("humanskeleton.txt");
//	utility.readIntoContainer("clothskeleton.txt");
//
// 	for (int i = 0; i < globalSkeletonContainer.size(); i++)
// 	{
// 		Skeleton& skeleton = globalSkeletonContainer.getSkeletonRef(i);
// 		skeleton.findNeck();
// 		skeleton.findHand();
// 	}
//  	utility.skeletonMatch(globalSkeletonContainer.getSkeletonRef(0), globalSkeletonContainer.getSkeletonRef(1));
// 
//  	mSkeletonViewer->updateSkeleton();		

	mInterval = 1000/25;
}