Beispiel #1
0
//! [0]
Window::Window()
{
    glWidget = new GLWidget;

    xSlider = createSlider();
    ySlider = createSlider();
    zSlider = createSlider();

    connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
    connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
    connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
    connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
    connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
    connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));
//! [0]

//! [1]
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(glWidget);
    mainLayout->addWidget(xSlider);
    mainLayout->addWidget(ySlider);
    mainLayout->addWidget(zSlider);
    setLayout(mainLayout);

    xSlider->setValue(15 * 16);
    ySlider->setValue(345 * 16);
    zSlider->setValue(0 * 16);
    setWindowTitle(tr("Hello GL"));
}
//! [0]
FLGLWindow::FLGLWindow(QWidget * parent) : QWidget(parent), mdi_(parent)
{
    QGLFormat glFormat;
    glFormat.setVersion( 4, 1 );
    glFormat.setProfile( QGLFormat::CoreProfile ); // Requires >=Qt-4.8.0
    glFormat.setSampleBuffers( true );
    glWidget = new FLGLWidget(glFormat);

    xSlider = createSlider();
    ySlider = createSlider();
    zSlider = createSlider();

    connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
    connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
    connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
    connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
    connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
    connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));
////! [0]
//
////! [1]
    QHBoxLayout *mainLayout = new QHBoxLayout;
    mainLayout->addWidget(glWidget);
    mainLayout->addWidget(xSlider);
    mainLayout->addWidget(ySlider);
    mainLayout->addWidget(zSlider);
    setLayout(mainLayout);

    xSlider->setValue(0);
    ySlider->setValue(0);
    zSlider->setValue(0);
    setWindowTitle(tr("Hello GL"));
}
Beispiel #3
0
Window::Window(MainWindow *mw)
    :mainWindow(mw)
{

    glWidget = new GLWidget;
    debugText = new QTextEdit;

    gameobjectList = new QListWidget;

      xSlider = createSlider();
      ySlider = createSlider();
      zSlider = createSlider();

      connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
      connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
      connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
      connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
      connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
      connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));

      QVBoxLayout *mainLayout = new QVBoxLayout;
       QHBoxLayout *container = new QHBoxLayout;
       container->addWidget(glWidget);
       container->addWidget(xSlider);
       container->addWidget(ySlider);
       container->addWidget(zSlider);

       QWidget *w = new QWidget;
       w->setLayout(container);
       mainLayout->addWidget(w);
       dockBtn = new QPushButton(tr("Undock"), this);
       connect(dockBtn, SIGNAL(clicked()), this, SLOT(dockUndock()));
       addPlaneBtn = new QPushButton(tr("Add Plane"));
       connect(addPlaneBtn, SIGNAL(clicked()), glWidget, SLOT(addObject()));


       mainLayout->addWidget(dockBtn);
       mainLayout->addWidget(addPlaneBtn);

       mainLayout->addWidget(debugText);

       container->addWidget(gameobjectList);

       setLayout(mainLayout);

       xSlider->setValue(15 * 16);
       ySlider->setValue(345 * 16);
       zSlider->setValue(0 * 16);

       setWindowTitle(tr("Hello GL"));

       QtDebugConsole * dbgConsole = new QtDebugConsole();
       Hodhr::Debug::setInstance(dbgConsole);

       // Debug::setLogBuffer(*debugText);

}
Beispiel #4
0
Widget::Widget(QWidget *parent)
    : QWidget(parent)
{
	view = new QGraphicsView;
	scene = new tethraScene;
	layout = new QVBoxLayout;
	view->setScene(scene);
	layout->addWidget(view);

	xSlider = new QSlider(Qt::Horizontal);
	xSlider->setRange(-90, 90);
	xSlider->setSingleStep(1);
	xSlider->setPageStep(10);
	xSlider->setTickInterval(10);
	xSlider->setTickPosition(QSlider::TicksBelow);

	ySlider = createSlider();

	layout->addWidget(xSlider);
	layout->addWidget(ySlider);

	this->setLayout(layout);
	connect(xSlider, SIGNAL(valueChanged(int)), scene, SLOT(rotateOX(int)));
	connect(ySlider, SIGNAL(valueChanged(int)), scene, SLOT(rotateOY(int)));
	this->resize(QSize(500,600));
}
LabledSlider::LabledSlider(QWidget *parent, const QString& sName): QWidget(parent){
  name = sName;
  createSlider();
  createLabels();
  createLayout();

}
MenuPanel::MenuPanel(MenuElements& elements,
                     const sf::Vector2f& position) :
    m_position(position)
{
    for(auto button = begin(elements.buttons); button != end(elements.buttons); ++button)
        createButton(*button);

    for(auto checkbox = begin(elements.checkboxes); checkbox != end(elements.checkboxes); ++checkbox)
        createCheckBox(*checkbox);

    for(auto slider = begin(elements.slider); slider != end(elements.slider); ++slider)
        createSlider(*slider);

    for(auto label = begin(elements.labels); label != end(elements.labels); ++label)
        createLabel(*label);

    for(auto sprite = begin(elements.sprites); sprite != end(elements.sprites); ++sprite)
        createSprite(*sprite);
    
    for(auto inputbox = begin(elements.infobox); inputbox != end(elements.infobox); ++inputbox)
        createInputBox(*inputbox);

    for(auto it = begin(elements.animationContainer); it != end(elements.animationContainer); ++it)
        createAnimationContainer(std::move(*it));

    setCorrelation();
    std::sort(m_elements.begin(), m_elements.end(), 
        [](const std::unique_ptr<MenuElement>& a, const std::unique_ptr<MenuElement>& b) -> bool
    { 
        return a->getId() < b->getId(); 
    });
}
// on "init" you need to initialize your instance
bool GameScene_02::init()
{
    if ( !LayerColor::initWithColor(Color4B(255,255,255,255)) )
    {
        return false;
    }
    visibleSize = Director::getInstance()->getVisibleSize();

    auto backGround = Sprite::create("Game/Level_1/background.png");
    addChild(backGround,0);
    backGround->setAnchorPoint(Vec2::ZERO);
    Timers = Label::create();
    addChild(Timers);
    Timers->setPosition(100, visibleSize.height - 40);
    Timers->setColor(Color3B::ORANGE);
    Timers->setSystemFontSize(48);
    createMenu();
    createSlider();
    createBall();
    creatBricks();
    this->scheduleUpdate();
    slider->startTimer();

    return true;
}
    void iUserControlColorChooser::initExpanded()
    {
        _expandedGrid = static_cast<iWidgetGrid*>(iWidgetManager::getInstance().createWidget("Grid"));
        _allWidgets.push_back(_expandedGrid);
        _expandedGrid->setHorizontalAlignment(iHorizontalAlignment::Left);
        _expandedGrid->setVerticalAlignment(iVerticalAlignment::Top);
        _expandedGrid->setBorder(0);
        _expandedGrid->setCellSpacing(4);
        _expandedGrid->appendRows(1);

        _expandedSliderGrid = static_cast<iWidgetGrid*>(iWidgetManager::getInstance().createWidget("Grid"));
        _allWidgets.push_back(_expandedSliderGrid);
        _expandedSliderGrid->appendCollumns(2);
        _expandedSliderGrid->appendRows(7);
        _expandedSliderGrid->setBorder(0);
        _expandedSliderGrid->setCellSpacing(4);
        _expandedSliderGrid->setHorizontalAlignment(iHorizontalAlignment::Left);

        _sliderH = createSlider("special\\gradientH.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedH));
        _sliderS = createSlider("special\\gradientS.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedS));
        _sliderV = createSlider("special\\gradientV.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedV));
        _sliderR = createSlider("special\\gradientR.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedR));
        _sliderG = createSlider("special\\gradientG.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedG));
        _sliderB = createSlider("special\\gradientB.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedB));
        _sliderA = createSlider("special\\gradientA.png", iChangeDelegate(this, &iUserControlColorChooser::onSliderChangedA));
        _sliderA->setBackgroundTexture("special\\checker.png");

        _colorViewExpanded = static_cast<iWidgetColor*>(iWidgetManager::getInstance().createWidget("Color"));
        _allWidgets.push_back(_colorViewExpanded);
        _colorViewExpanded->setWidth(54);
        _colorViewExpanded->setHorizontalAlignment(iHorizontalAlignment::Right);
        _colorViewExpanded->setHeight(21);

        _expandedSliderGrid->addWidget(_labelH, 0, 0);
        _expandedSliderGrid->addWidget(_labelS, 0, 1);
        _expandedSliderGrid->addWidget(_labelV, 0, 2);
        _expandedSliderGrid->addWidget(_labelRExpanded, 0, 3);
        _expandedSliderGrid->addWidget(_labelGExpanded, 0, 4);
        _expandedSliderGrid->addWidget(_labelBExpanded, 0, 5);
        _expandedSliderGrid->addWidget(_labelAExpanded, 0, 6);

        _expandedSliderGrid->addWidget(_sliderH, 1, 0);
        _expandedSliderGrid->addWidget(_sliderS, 1, 1);
        _expandedSliderGrid->addWidget(_sliderV, 1, 2);
        _expandedSliderGrid->addWidget(_sliderR, 1, 3);
        _expandedSliderGrid->addWidget(_sliderG, 1, 4);
        _expandedSliderGrid->addWidget(_sliderB, 1, 5);
        _expandedSliderGrid->addWidget(_sliderA, 1, 6);

        _expandedSliderGrid->addWidget(_valueChooserH, 2, 0);
        _expandedSliderGrid->addWidget(_valueChooserS, 2, 1);
        _expandedSliderGrid->addWidget(_valueChooserV, 2, 2);
        _expandedSliderGrid->addWidget(_valueChooserRExpanded, 2, 3);
        _expandedSliderGrid->addWidget(_valueChooserGExpanded, 2, 4);
        _expandedSliderGrid->addWidget(_valueChooserBExpanded, 2, 5);
        _expandedSliderGrid->addWidget(_valueChooserAExpanded, 2, 6);

        _expandedGrid->addWidget(_expandedSliderGrid, 0, 0);
        _expandedGrid->addWidget(_colorViewExpanded, 0, 1);
    }
Beispiel #9
0
Grabber::Grabber(QWidget *parent)
   : QMainWindow(parent)
{
    centralWidget = new QWidget(this);
    setCentralWidget(centralWidget);

    setWindowTitle("Grabber");

    glWidget    = new GLWidget;
    pixmapLabel = new QLabel;

    glWidgetArea = new QScrollArea;
    glWidgetArea->setWidget(glWidget);
    glWidgetArea->setWidgetResizable(true);
    glWidgetArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    glWidgetArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    glWidgetArea->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    glWidgetArea->setMinimumSize(50, 50);

    pixmapLabelArea = new QScrollArea;
    pixmapLabelArea->setWidget(pixmapLabel);
    pixmapLabelArea->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    pixmapLabelArea->setMinimumSize(50, 50);

    // removed SIGNAL() to pass a string, removed SLOT() to pass a string
    xSlider = createSlider("xRotationChanged(int)", "setXRotation(int)");
    ySlider = createSlider("yRotationChanged(int)", "setYRotation(int)");
    zSlider = createSlider("zRotationChanged(int)", "setZRotation(int)");

    createActions();
    createMenus();

    QGridLayout *centralLayout = new QGridLayout;
    centralLayout->addWidget(glWidgetArea, 0, 0);
    centralLayout->addWidget(pixmapLabelArea, 0, 1);
    centralLayout->addWidget(xSlider, 1, 0, 1, 2);
    centralLayout->addWidget(ySlider, 2, 0, 1, 2);
    centralLayout->addWidget(zSlider, 3, 0, 1, 2);
    centralWidget->setLayout(centralLayout);

    xSlider->setValue(15 * 16);
    ySlider->setValue(345 * 16);
    zSlider->setValue(0 * 16);    
}
Beispiel #10
0
Slider::Slider(int x, int y, int w, int h, float &v): value(v)
{
    left = x;
    top = y;
    width = w;
    height = h;
    background = NULL;
    createSlider(height);
    highlight = false;
    dragging = false;
}
Beispiel #11
0
Window::Window(MainWindow *mw)
    : mainWindow(mw)
{
    glWidget = new GLWidget;

    xSlider = createSlider();
    ySlider = createSlider();
    zSlider = createSlider();

    connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
    connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
    connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
    connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
    connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
    connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));

    QVBoxLayout *mainLayout = new QVBoxLayout;
    QHBoxLayout *container = new QHBoxLayout;
    container->addWidget(glWidget);
    container->addWidget(xSlider);
    container->addWidget(ySlider);
    container->addWidget(zSlider);

    QWidget *w = new QWidget;
    w->setLayout(container);
    mainLayout->addWidget(w);
    dockBtn = new QPushButton(tr("Undock"), this);
    connect(dockBtn, SIGNAL(clicked()), this, SLOT(this->close()));
    mainLayout->addWidget(dockBtn);

    setLayout(mainLayout);

    xSlider->setValue(15 * 16);
    ySlider->setValue(345 * 16);
    zSlider->setValue(0 * 16);

    setWindowTitle(tr("Hello GL"));
}
Beispiel #12
0
Window::Window(MainWindow *mw)
    : mainWindow(mw)
{
    glWidget = new GLWidget;

    xSlider = createSlider();
    ySlider = createSlider();
    zSlider = createSlider();

    connect(xSlider, &QSlider::valueChanged, glWidget, &GLWidget::setXRotation);
    connect(glWidget, &GLWidget::xRotationChanged, xSlider, &QSlider::setValue);
    connect(ySlider, &QSlider::valueChanged, glWidget, &GLWidget::setYRotation);
    connect(glWidget, &GLWidget::yRotationChanged, ySlider, &QSlider::setValue);
    connect(zSlider, &QSlider::valueChanged, glWidget, &GLWidget::setZRotation);
    connect(glWidget, &GLWidget::zRotationChanged, zSlider, &QSlider::setValue);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    QHBoxLayout *container = new QHBoxLayout;
    container->addWidget(glWidget);
    container->addWidget(xSlider);
    container->addWidget(ySlider);
    container->addWidget(zSlider);

    QWidget *w = new QWidget;
    w->setLayout(container);
    mainLayout->addWidget(w);
    dockBtn = new QPushButton(tr("Undock"), this);
    connect(dockBtn, &QPushButton::clicked, this, &Window::dockUndock);
    mainLayout->addWidget(dockBtn);

    setLayout(mainLayout);

    xSlider->setValue(15 * 16);
    ySlider->setValue(345 * 16);
    zSlider->setValue(0 * 16);

    setWindowTitle(tr("Hello GL"));
}
Beispiel #13
0
Equalizer::Equalizer(QWidget *parent, Database *db, GlobalData *gData) : DialogBase(parent, gData)
{
    this->db = db;
    this->gData = gData;
    equalizerValues = gData->equalizerValues;

    setWindowTitle(tr("Equalizador » ")+AppName);

    createLabels();
    createButtons();
    createSlider();
    createWidgets();
    createEvents();
    createBoxLayout();
}
Beispiel #14
0
Equalizer::Equalizer(QWidget *parent) : DialogBase(parent)
{
    oldValues = Global::equalizerValues;
    currentIndex = Database::value("Current", "EqualizerPreset").toInt();
    isNewPreset = false;
    lastId = false;
    presetComboUpdate = false;

    createLabels();
    createButtons();
    createSlider();
    createBoxLayout();
    createEvents();
    setWindowTitle("Equalizador » "+AppName);
}
Beispiel #15
0
void GLWindow::init() {

    setAttribute(Qt::WA_DeleteOnClose);

    createSlider();

    createButton();

    createTimer();

    setupLayout();

    setupConnections();

    timerStart();
}
Beispiel #16
0
Slider::Slider(QWidget *parent, int sliderType):
    QWidget(parent)
{
    d_slider = createSlider(this, sliderType);

    QFlags<Qt::AlignmentFlag> alignment;
    switch(d_slider->scalePosition())
    {
        case QwtSlider::NoScale:
            if ( d_slider->orientation() == Qt::Horizontal )
                alignment = Qt::AlignHCenter | Qt::AlignTop;
            else
                alignment = Qt::AlignVCenter | Qt::AlignLeft;
            break;
        case QwtSlider::LeftScale:
            alignment = Qt::AlignVCenter | Qt::AlignRight;
            break;
        case QwtSlider::RightScale:
            alignment = Qt::AlignVCenter | Qt::AlignLeft;
            break;
        case QwtSlider::TopScale:
            alignment = Qt::AlignHCenter | Qt::AlignBottom;
            break;
        case QwtSlider::BottomScale:
            alignment = Qt::AlignHCenter | Qt::AlignTop;
            break;
    }

    d_label = new QLabel("0", this);
    d_label->setAlignment(alignment);
    d_label->setFixedWidth(d_label->fontMetrics().width("10000.9"));

    connect(d_slider, SIGNAL(valueChanged(double)), SLOT(setNum(double)));

    QBoxLayout *layout;
    if ( d_slider->orientation() == Qt::Horizontal )
        layout = new QHBoxLayout(this);
    else
        layout = new QVBoxLayout(this);

    layout->addWidget(d_slider);
    layout->addWidget(d_label);
}
OIndicator& OIndicator::createIndicator(const SHORT x, const SHORT y,
                                        const SHORT cx, const SHORT cy)
{
 createSlider(x, y, cx, cy);

 setFont("8.Helv");

 setTickSize        (2).
 setTickSize        (5,   0).
 setTickSize        (5,  25).
 setTickSize        (5,  50).
 setTickSize        (5,  75).
 setTickSize        (5, 100).
 setSliderScaleText ("0",     0).
 setSliderScaleText ("25",   25).
 setSliderScaleText ("50",   50).
 setSliderScaleText ("75",   75).
 setSliderScaleText ("100", 100);
 
 return(*this);
}
Beispiel #18
0
/**
 * Lay out the widgets (portrait mode).
 */
void HomeScreen::setupUI()
{
	// Get the handle to the main layout and the screen.
	mMainLayout = getMainLayout();
	mScreen = getScreen();
	mLabel = getTopLabel();
	mSearchButton = getTopButtonRight();
	// We do not need a Back button in this screen,
	// so we can dismiss it.
	MAWidgetHandle backBtn = getTopButtonLeft();
	maWidgetDestroy(backBtn);

	// The creation of the main layout is already done in the base class
	// constructor, called at derived object creation.
	// So, we can use  a handle for the main layout at any point.

	// Set the text for the button widget in the top layout.
	setButtonText(mSearchButton, " NEXT ");

	// Add a label before the Progress bar.
	mProgressLabel = createLabel(
			mScreenWidth,
			" Please wait...",
			DARK_GREY,
			mFontSize );
	// Show it only after Search is pressed.
	maWidgetSetProperty(mProgressLabel,MAW_WIDGET_VISIBLE, "false");
	maWidgetAddChild(mMainLayout, mProgressLabel);

	// Create a progress bar for the Search action.
	mProgressBar = createProgressBar();

	// Set the range of the progress bar from 0..100
	setWidgetProperty(
		mProgressBar, MAW_PROGRESS_BAR_MAX, PROGRESS_BAR_MAX_VALUE);
	// Set the progress value to 0.
	setWidgetProperty(
		mProgressBar, MAW_PROGRESS_BAR_PROGRESS, 0);
	// Hide the widget at first, and display it when a Search is being performed.
	maWidgetSetProperty(
		mProgressBar, MAW_WIDGET_VISIBLE, "false");

	maWidgetAddChild(mMainLayout, mProgressBar);

	// Next, fill the remaining space with an edit box and
	// some check boxes for the categories.
	MAWidgetHandle hintLabel = createLabel(
			mScreenWidth,
			MESSAGE_EDITBOX_HINT.c_str(),
			BLUE,
			mFontSize);
	maWidgetSetProperty(
		hintLabel,MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT,MAW_ALIGNMENT_LEFT);
	maWidgetAddChild(mMainLayout, hintLabel);

	// Add only one edit box.
	mEditBox = createEditBox(mScreenWidth, MAW_CONSTANT_WRAP_CONTENT);
	maWidgetAddChild(mMainLayout, mEditBox);

	// Add a small spacer before the categories.
	maWidgetAddChild(mMainLayout, createSpacer(mScreenWidth, mPaddingSize));

	// Add the layout with checkable categories.
	maWidgetAddChild( mMainLayout, createCategoriesLayout());

	// Add a label for the slider.
	MAWidgetHandle sliderLabel = createLabel(
			mScreenWidth,
			" Please select the results limit. ",
			BLUE,mFontSize);
	maWidgetAddChild(mMainLayout, sliderLabel);

	// Create a slider control for selecting the desired number of results.
	mSlider = createSlider();
	setWidgetProperty(mSlider, MAW_SLIDER_MAX, SLIDER_MAX_VALUE);
	// Set the current slider value to 10.
	setWidgetProperty(mSlider, MAW_SLIDER_VALUE, 10);
	maWidgetAddChild(mMainLayout, mSlider);

	// Add two labels with minimum and maximum value of the slider.
	MAWidgetHandle valuesLayout = maWidgetCreate(MAW_HORIZONTAL_LAYOUT);
	MAWidgetHandle minValue = createLabel(
			mScreenWidth / 2,
			 " 0 ",
			 DARK_GREY,
			 mFontSize);
	maWidgetSetProperty(minValue, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT,
			MAW_ALIGNMENT_LEFT);
	maWidgetAddChild(valuesLayout, minValue);

	MAWidgetHandle maxValue = createLabel(
			mScreenWidth / 2,
			"", DARK_GREY,
			mFontSize);
	setWidgetProperty(maxValue, MAW_LABEL_TEXT, SLIDER_MAX_VALUE);
	maWidgetSetProperty(maxValue, MAW_LABEL_TEXT_HORIZONTAL_ALIGNMENT,
			MAW_ALIGNMENT_RIGHT);
	maWidgetAddChild(valuesLayout, maxValue);

	// Add this layout to the main one.
	maWidgetAddChild(mMainLayout, valuesLayout);
}
Beispiel #19
0
// -----------------------------------------------------------------------------
qtWindow::qtWindow()
{
    glWidget = new GLWidget;

    txInputInfo = new QLineEdit("0.0, 0.0, 0.0");
    btDkMove = new QPushButton("Joints");
    btIkMove = new QPushButton("Pose");
    rbDoMovement = new QRadioButton("Execute movement");
    txSolutionInfo = new QLineEdit("");
    txSolutionInfo->setReadOnly(true);
    txSolutionInfo->setStyleSheet( QString("background-color: beige") );
    txInfoMsg = new QLineEdit("OK");
    txInfoMsg->setReadOnly(true);
    txInfoMsg->setStyleSheet( QString("color: blue; background: beige") );

    QObject::connect(txInputInfo, SIGNAL(textChanged(const QString &)), glWidget, SLOT(updatePosInput(const QString &)));
    QObject::connect(btIkMove, SIGNAL(clicked()), glWidget, SLOT(moveByPose()));
    QObject::connect(btDkMove, SIGNAL(clicked()), glWidget, SLOT(moveByJoints()));
    QObject::connect(rbDoMovement, SIGNAL(toggled(bool)), glWidget, SLOT(activeMovement(bool)) );
    QObject::connect(glWidget, SIGNAL(writeSolution(const QString &)), txSolutionInfo, SLOT(setText(const QString &)));
    QObject::connect(glWidget, SIGNAL(showMessage(const QString &)), txInfoMsg, SLOT(setText(const QString &)));

    xSlider = createSlider();
    ySlider = createSlider();
    zSlider = createSlider();

    xSlider->setValue(15 * 16);
    ySlider->setValue(345 * 16);
    zSlider->setValue(0 * 16);

    QObject::connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
    QObject::connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
    QObject::connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
    QObject::connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
    QObject::connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
    QObject::connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));
   
    QVBoxLayout* mainLayout = new QVBoxLayout;
    QHBoxLayout* layout2 = new QHBoxLayout;
    QGridLayout* layout3 = new QGridLayout;

    mainLayout->addLayout(layout2);
    mainLayout->addWidget(txInfoMsg);

    layout2->addWidget(glWidget);
    layout2->addWidget(xSlider);
    layout2->addWidget(ySlider);
    layout2->addWidget(zSlider);
    layout2->addLayout(layout3);

    layout3->addWidget(txInputInfo);
    layout3->addWidget(btDkMove);
    layout3->addWidget(btIkMove);
    layout3->addWidget(rbDoMovement);
    layout3->addWidget(txSolutionInfo);

    setLayout(mainLayout);

    setWindowTitle(tr("Simulate RU link"));
    //click->start(1000);
}
Beispiel #20
0
void TuiManager::parseControl(Node* container,xml_node<char> *item)
{ 
	int tag = atof(item->first_attribute("tag")->value());
	int x = atof(item->first_attribute("x")->value());
	int y = atof(item->first_attribute("y")->value());
	int w = atoi(item->first_attribute("width")->value());
	int h = atoi(item->first_attribute("height")->value());
	int rotation = atof(item->first_attribute("rotation")->value());

	if(strcmp(item->first_attribute("type")->value(), kTuiContainerPanel) == 0){//panel
		CWidgetWindow* pPanel = createPanel(tag,x,y,w,h,rotation);
		container->addChild(pPanel);
		//recursive
		for( xml_node<char> *iitem = item->first_node( kTuiNodeControl );iitem != NULL; iitem = iitem->next_sibling()){
			parseControl(pPanel,iitem);
		}

	}else if (strcmp(item->first_attribute("type")->value(), kTuiControlCell) == 0){//cell
		//recursive
		for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){
			parseControl(container, iitem);
		}

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlImage) == 0){//image
		const char* file = item->first_attribute("image")->value();
		float scaleX = atof(item->first_attribute("scaleX")->value());
		float scaleY = atof(item->first_attribute("scaleY")->value());
		CImageView *pImg = createImage(tag, file, scaleX, scaleY, x, y, rotation);
		container->addChild(pImg);
	
	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlImage9) == 0){//image9
		const char* file = item->first_attribute("image")->value();
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		float up = atof(item->first_attribute("up")->value());
		float down = atof(item->first_attribute("down")->value());
		float left = atof(item->first_attribute("left")->value());
		float right = atof(item->first_attribute("right")->value());
		CImageViewScale9 *pImg = createImage9(tag,file,x,y,w,h,up,down,left,right,rotation);
		container->addChild(pImg);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlButton) == 0){//button
		const char* normal = item->first_attribute("normal")->value();
		const char* select = item->first_attribute("select")->value();
		const char* disable = item->first_attribute("disable")->value();
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		CButton *pBtn = createBtn(tag,normal,select,disable,x,y,w,h,rotation);
		container->addChild(pBtn);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlToggleView) == 0){//toggleView
		const char* normal = item->first_attribute("normal")->value();
		const char* select = item->first_attribute("select")->value();
		const char* disable = item->first_attribute("disable")->value();
		float exclusion = atof(item->first_attribute("exclusion")->value());
		CToggleView* toggle = createToggleView(tag,exclusion,normal,select,disable,x,y,rotation);
		container->addChild(toggle);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlSlider) == 0){//slider
		const char* bg = item->first_attribute("bg")->value();
		const char* progress = item->first_attribute("progress")->value();
		const char* thumb = item->first_attribute("thumb")->value();
		CSlider *pSlider = createSlider(tag,bg,progress,thumb,x,y,rotation);
		container->addChild(pSlider);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlProgress) == 0){//progress
		const char* bg = item->first_attribute("bg")->value();
		const char* progress = item->first_attribute("progress")->value();
		CProgressBar *pProgress = createProgress(tag,bg,progress,x,y,rotation);
		container->addChild(pProgress);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlLabel) == 0){//label
		float size = atof(item->first_attribute("textSize")->value());
		int alignment = atoi(item->first_attribute("alignment")->value());
		const char* text = item->first_attribute("text")->value();
		const char* font = item->first_attribute("textFont")->value();
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		
		int r = atoi(item->first_attribute("red")->value());
		int g = atoi(item->first_attribute("green")->value());
		int b = atoi(item->first_attribute("blue")->value());
		int r2 = atoi(item->first_attribute("strokeRed")->value());
		int g2 = atoi(item->first_attribute("strokeGreen")->value());
		int b2 = atoi(item->first_attribute("strokeBlue")->value());
		int strokeSize = atoi(item->first_attribute("strokeSize")->value());
		int shadowDistance = atoi(item->first_attribute("shadowDistance")->value());
		int shadowBlur = atoi(item->first_attribute("shadowBlur")->value());
		CLabel *pLabel = createLabel(tag, text, font, alignment, size, r, g, b, x, y, w, h,
									r2,g2,b2,strokeSize,shadowDistance,shadowBlur,rotation);
		container->addChild(pLabel);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlLabelAtlas) == 0){//labelAtlas
		const char* imgPath = item->first_attribute("image")->value();
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		CLabelAtlas *pLabAtlas = createLabelAtlas(tag,imgPath,x,y,w,h,rotation);
		container->addChild(pLabAtlas);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlArmature) == 0){//armature
		const char* xml = item->first_attribute("xml")->value();
		const char* png = item->first_attribute("png")->value();
		const char* plist = item->first_attribute("plist")->value();
		const char* name = item->first_attribute("name")->value();
		Armature *pArmature = createArmature(tag,name,png,plist,xml,x,y,rotation);
		container->addChild(pArmature);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlAnim) == 0){//animation
		const char* png = item->first_attribute("png")->value();
		const char* plist = item->first_attribute("plist")->value();
		const char* name = item->first_attribute("name")->value();
		Sprite *pSprite = createAnim(tag,name,png,plist,x,y,rotation);
		container->addChild(pSprite);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlControl) == 0){//controlView
		const char* baseboard = item->first_attribute("baseboard")->value();
		const char* joystick = item->first_attribute("joystick")->value();
		CControlView *pControl = createControl(tag,baseboard,joystick,x,y,rotation);
		container->addChild(pControl);

	}else if (strcmp(item->first_attribute("type")->value(), kTuiContainerScroll) == 0){//scrollView
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		int direction = atof(item->first_attribute("direction")->value());
		int innerWidth = atoi(item->first_attribute("innerWidth")->value());
		int innerHeight = atoi(item->first_attribute("innerHeight")->value());
		CScrollView *pView = createScrollView(tag, direction, innerWidth, innerHeight, x, y, w, h, rotation);
		container->addChild(pView);
		//recursive
		for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){
			parseControl(pView->getContainer(), iitem);
		}

	}else if (strcmp(item->first_attribute("type")->value(), kTuiContainerLayout) == 0){//layout
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		CLayout *pLayout = createLayout(tag, x, y, w, h, rotation);
		container->addChild(pLayout);
		//recursive
		for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){
			parseControl(pLayout, iitem);
		}
		Vector<Node*> vet = pLayout->getChildren();
		for (Node *pChild : vet){//Offset coordinates Because CLayout zero point in the lower left corner
			pChild->setPosition(pChild->getPosition() + Point(w / 2, h / 2));
		}

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlListView) == 0){//listView
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		const char* img = item->first_attribute("image")->value();
		float num = atof(item->first_attribute("num")->value());
		CListView* pList = createListView(tag,img,x,y,w,h,rotation);
		container->addChild(pList);

		for(int i=0; i<num;i++){//add item
			xml_node<char> *iitem = item->first_node( kTuiNodeControl );
			w = atof(iitem->first_attribute("width")->value());
			h = atof(iitem->first_attribute("height")->value());

			CLayout *pLayout = createLayout(i,0,0,w,h,rotation);
			for( xml_node<char> *iiitem = iitem->first_node( kTuiNodeControl );iiitem!=NULL; iiitem = iiitem->next_sibling()){
				parseControl(pLayout,iiitem);
			}
			Vector<Node*> vet = pLayout->getChildren();
			for(Node *pChild : vet){//Offset coordinates Because CLayout zero point in the lower left corner
				if(pChild->getTag() > 0)
					pChild->setPosition(pChild->getPosition()+Point(w/2,h/2));
			}
			pList->insertNodeAtLast(pLayout);
		}
		pList->reloadData();

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlPageView) == 0){//pageView
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		float num = atoi(item->first_attribute("num")->value());
		int dir = atoi(item->first_attribute("direction")->value());
		const char* img = item->first_attribute("image")->value();
		CPageView *pPageView = createPageView(tag, img, dir, num, x, y, w, h, rotation);
		container->addChild(pPageView);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlCheckBox) == 0){//checkBox
		const char* normal1 = item->first_attribute("normal1")->value();
		const char* normal2 = item->first_attribute("normal2")->value();
		const char* select1 = item->first_attribute("select1")->value();
		const char* select2 = item->first_attribute("select2")->value();
		const char* disable1 = item->first_attribute("disable1")->value();
		const char* disable2 = item->first_attribute("disable2")->value();
		CCheckBox *pCheckBox = createCheckBox(tag,normal1,normal2,select1,select2,disable1,disable2,x,y,rotation);
		container->addChild(pCheckBox);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlArmatureBtn) == 0){//ArmatureBtn
		const char* png = item->first_attribute("png")->value();
		const char* plist = item->first_attribute("plist")->value();
		const char* name = item->first_attribute("name")->value();
		const char* xml = item->first_attribute("xml")->value();
		ArmatureBtn *pArmBtn = createArmatureBtn(tag,name,png,plist,xml,x,y,rotation);
		container->addChild(pArmBtn);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlNumbericStepper) == 0){//NumbericStepper
		const char* lnormal = item->first_attribute("lnormal")->value();
		const char* rnormal = item->first_attribute("rnormal")->value();
		const char* lselect = item->first_attribute("lselect")->value();
		const char* rselect = item->first_attribute("rselect")->value();
		const char* ldisable = item->first_attribute("ldisable")->value();
		const char* rdisable = item->first_attribute("rdisable")->value();
		const char* stepBg = item->first_attribute("stepBg")->value();
		NumericStepper *pNumStep = createNumStep(tag,lnormal,lselect,ldisable,rnormal,rselect,rdisable,stepBg,x,y,rotation);
		container->addChild(pNumStep);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlPaticle) == 0){//Paticle
		const char* plist = item->first_attribute("plist")->value();
		ParticleSystem *pPartical = createParticle(tag,plist,x,y);
		container->addChild(pPartical);

	}else if (strcmp(item->first_attribute("type")->value(), kTuiControlTable) == 0){//TableView
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		float num = atoi(item->first_attribute("num")->value());
		int dir = atoi(item->first_attribute("direction")->value());
		int cellWidth = atoi(item->first_attribute("cellWidth")->value());
		int cellHeight = atoi(item->first_attribute("cellHeight")->value());
		const char* img = item->first_attribute("image")->value();
		CTableView *pView = createTableView(tag, img, dir, num, cellWidth, cellHeight, x, y, w, h, rotation);
		container->addChild(pView);

	}else if (strcmp(item->first_attribute("type")->value(), kTuiControlGridView) == 0){//GridView
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		int cellWidth = atoi(item->first_attribute("cellWidth")->value());
		int cellHeight = atoi(item->first_attribute("cellHeight")->value());
		int column = atoi(item->first_attribute("column")->value());
		int num = atoi(item->first_attribute("num")->value());
		const char* img = item->first_attribute("image")->value();
		CGridView *pView = createGridView(tag, img, column, num, cellWidth, cellHeight, x, y, w, h, rotation);
		container->addChild(pView);
	
	}else if (strcmp(item->first_attribute("type")->value(), kTuiControlGridPageView) == 0){//GridPageView
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		int cellWidth = atoi(item->first_attribute("cellWidth")->value());
		int cellHeight = atoi(item->first_attribute("cellHeight")->value());
		int column = atoi(item->first_attribute("column")->value());
		int row = atoi(item->first_attribute("row")->value());
		int num = atoi(item->first_attribute("num")->value());
		int dir = atoi(item->first_attribute("direction")->value());
		const char* img = item->first_attribute("image")->value();
		CGridPageView *pView = createGridPageView(tag, img, dir, column, row, num, cellWidth, cellHeight, x, y, w, h, rotation);
		container->addChild(pView);

	}else if(strcmp(item->first_attribute("type")->value(),kTuiControlEditBox) == 0){//EditBox
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		const char* img = item->first_attribute("image")->value();
		int inputMode = atoi(item->first_attribute("inputMode")->value());
		int inputFlag = atoi(item->first_attribute("inputFlag")->value());
		EditBox *pEdit = createEditBox(tag, img, inputMode, inputFlag, x, y, w, h, rotation);
		container->addChild(pEdit);

	}else if (strcmp(item->first_attribute("type")->value(), kTuiControlMovieView) == 0){//MovieView
		const char* png = item->first_attribute("png")->value();
		const char* plist = item->first_attribute("plist")->value();
		const char* json = item->first_attribute("json")->value();
		MovieView *pMovieView = createMovieView(tag, json, plist, png, x, y, rotation);
		container->addChild(pMovieView);

	}else if (strcmp(item->first_attribute("type")->value(), kTuiContainerCircleMenu) == 0){//CircleMenu
		float w = atof(item->first_attribute("width")->value());
		float h = atof(item->first_attribute("height")->value());
		CircleMenu *pMenu = createCircleMenu(tag, x, y, w, h, rotation);
		container->addChild(pMenu);
		//recursive
		for (xml_node<char> *iitem = item->first_node(kTuiNodeControl); iitem != NULL; iitem = iitem->next_sibling()){
			parseControl(pMenu, iitem);
		}
		pMenu->reloadData();
	}
}
Beispiel #21
0
int
main(int argc, char **argv)
{
	/* define the event handlers for the events */
	DACallbacks eventCallbacks = {
		destroy, /* destroy */
		buttonPress, /* buttonPress */
		buttonRelease, /* buttonRelease */
		mouseMove, /* motion (mouse) */
		mouseEnter, /* mouse enters window */
		mouseLeave, /* mouse leaves window */
		NULL    /* timeout */
	};

	/* define regions (x, y, width, height) that need event-handling */
	Region clipRegion = XCreateRegion();

	DARect btn = {0, 0, 16, 16},
	       square = {0, 25, 22, 22},
	       slider = {24, 0, 23, 48};

	/* define what to do if an event occurs in a rectangle */
	DAActionRect *buttonPressRects, *buttonReleaseRects,
	*mouseMoveRects, *mouseEnterRects, *mouseLeaveRects;

	buttonPressRects = malloc(3 * sizeof(DAActionRect));
	buttonPressRects[0] = setRectAction(btn, btnDown);
	buttonPressRects[1] = setRectAction(square, squareDown);
	buttonPressRects[2] = setRectAction(slider, sliderDown);

	buttonReleaseRects = malloc(2 * sizeof(DAActionRect));
	buttonReleaseRects[0] = setRectAction(btn, btnUp);
	buttonReleaseRects[1] = setRectAction(slider, sliderUp);

	mouseMoveRects = malloc(sizeof(DAActionRect));
	mouseMoveRects[0] = setRectAction(slider, sliderMove);

	mouseEnterRects = malloc(sizeof(DAActionRect));
	mouseEnterRects[0] = setRectAction(slider, sliderEnter);

	mouseLeaveRects = malloc(2 * sizeof(DAActionRect));
	mouseLeaveRects[0] = setRectAction(btn, btnLeave);
	mouseLeaveRects[1] = setRectAction(slider, sliderLeave);


	/* XXX: make action rectangles available outside main()
	 * ...libDockapp should be able to do this... (reminder)
	 */
	actionRects = malloc(6 * sizeof(DAActionRect *));
	actionRects[0] = buttonPressRects;
	actionRects[1] = buttonReleaseRects;
	actionRects[2] = mouseMoveRects;
	actionRects[3] = mouseEnterRects;
	actionRects[4] = mouseLeaveRects;
	actionRects[5] = NULL;

	/* provide standard command-line options */
	DAParseArguments(
		argc, argv, /* Where the options come from */
		NULL, 0, /* Our list with options - none as you can see */
		"This is the help text for the rectangle example of how to "
		"use libDockapp.\n",
		"Rectangle example version 1.0");

	/* Tell libdockapp what version we expect it to be, so that you can use
	 * older programs with newer versions of libdockapp with less risc for
	 * compatibility problems.
	 */
	DASetExpectedVersion(20030126);

	/* Initialize a dockapp */
	DAInitialize(
		"",             /* Use default display */
		"daRectangleExample",   /* WM_CLASS hint; don't use chars in [.?*: ] */
		48, 48,         /* geometry of dockapp internals */
		argc, argv      /* (needed internally) */
		);

	/* Create a pixmap to draw on, and to display */
	pixmap = DAMakePixmap(); /* size == dockapp geometry (48,48) */

	colors = setGCs(pixmap);

	XFillRectangle(DADisplay, pixmap, DAClearGC, 0, 0, 48, 48);
	XClearWindow(DADisplay, DAWindow);

	/* Make a "Region" from the shapes we have */
	XUnionRectWithRegion(&btn, clipRegion, clipRegion);
	XUnionRectWithRegion(&square, clipRegion, clipRegion);
	XUnionRectWithRegion(&slider, clipRegion, clipRegion);

	/* Make this region a window shape mask */
	XShapeCombineRegion(DADisplay, DAWindow, ShapeBounding,
			    0, 0, clipRegion, ShapeSet);

	/* We don't need the region anymore (it is copied by XShapeCombineRegion).
	 * XXX: That's not certain, it is not documented. XSetRegion does so,
	 * though, so it is a likely assumption that it does copy.
	 */
	XDestroyRegion(clipRegion);

	/* The cursor we want to use.
	 * Specify 'None' for the default,
	 * or one from X11/cursorfont.h
	 */
	pointer = XCreateFontCursor(DADisplay, XC_based_arrow_up);
	XDefineCursor(DADisplay, DAWindow, pointer);

	/* a square with an image that changes when clicked (A button). */
	createBtn(btn);

	/* a square that shows the number of the mouse-button pressed on click. */
	createSquare(square);

	/* a slider a using two dashed line GC's. */
	createSlider(slider);

	/* Tell libdockapp this is the pixmap that we want to show */
	DASetPixmap(pixmap);

	/* Process events every 100ms */
	DASetTimeout(100);

	/* set event callbacks */
	DASetCallbacks(&eventCallbacks);

	/* Display the pixmap we said it to show */
	DAShow();

	/* Process events and keep the dockapp running */
	DAEventLoop();

	return 0;
}
  void menuSetup(void)
  {
    mEnvironmentTexture = SGET("cubemap.dds");
		mStartup = true;

    AddToken("FractalCoordinates",MC_FRACTAL_COORDINATES);

    createButton("Default Mandelbrot", MC_DEFAULT_MANDELBROT, "DefaultMandelbrot");
    createButton("Filter Fractal", MC_FILTER_FRACTAL, "FilterFractal");
		createButton("Optimize Mesh", MC_OPTIMIZE_MESH, "OptimizeMesh");

    createCheckbox("Preview Only", MC_PREVIEW_ONLY, "PreviewOnly", false );
		createCheckbox("Use Rectangle Subdivision", MC_RECTANGLE_SUBDIVISION,"RectangleSubdivision",true);
		createCheckbox("Use Multi-Threading", MC_USE_THREADING,"UseThreading",false);
    createCheckbox("View3D", MC_VIEW3D,"View3d",false);
    createCheckbox("Wireframe Overlay", MC_WIREFRAME_OVERLAY,"WireframeOverlay",false);
    createCheckbox("Show Normals", MC_SHOW_NORMALS,"ShowNormals",false);

    createSlider("Color Scale", MC_SMOOTH_COLOR, "SmoothColor", 1, 32, 16, true );
    createSlider("Iteration Count", MC_ITERATION_COUNT, "IterationCount", 40, 100000, 1024, true );
		createSlider("Clock Cycles Per Frame Mhz", MC_CLOCK_CYCLES, "ClockCycles", 20, 1000, 100, true );

    createSlider("Clamp Low",       MC_CLAMP_LOW,   "ClampLow",  0.0f, 1, 0.0f, false );
    createSlider("Clamp High",      MC_CLAMP_HIGH,  "ClampHigh",  0.001f, 0.3f, 0.3f, false );
    createSlider("Clamp Scale",     MC_CLAMP_SCALE, "ClampScale", 0.1f, 8, 1.0f, false );
    createSlider("Rotation Speed",  MC_ROTATION_SPEED, "RotationSpeed", -10, 10, 0.0f, false );

    CPARSER.Parse("TuiComboBegin ColorPalette");
    CPARSER.Parse("TuiName \"Color Palette\"");

    {
      WildCard *wc = createWildCard("*.pal");
      FileFind ff(wc,0);
      StringVector list;
      ff.GetFiles(list);
      StringVector::iterator i;
      for (i=list.begin(); i!=list.end(); i++)
      {
        CPARSER.Parse("TuiChoice \"%s\"", (*i).c_str() );
      }
      releaseWildCard(wc);
    }

    CPARSER.Parse("TuiArg default.pal");
    CPARSER.Parse("TuiScript ColorPalette %%1");
    CPARSER.Parse("TuiEnd");

    AddToken("ColorPalette", MC_COLOR_PALETTE );

    CPARSER.Parse("TuiComboBegin FloatingPointResolution");
    CPARSER.Parse("TuiName \"Float Resolution\"");

    CPARSER.Parse("TuiChoices SMALL MEDIUM BIGFLOAT FIXED32");

    CPARSER.Parse("TuiArg SMALL");
    CPARSER.Parse("TuiScript FloatingPointResolution %%1");
    CPARSER.Parse("TuiEnd");

    AddToken("FloatingPointResolution", MC_FLOATING_POINT_RESOLUTION );

    CPARSER.Parse("TuiComboBegin EnvironmentTexture");
    CPARSER.Parse("TuiName \"Environment Texture\"");

    {
      WildCard *wc = createWildCard("cubemap*.dds");
      FileFind ff(wc,"..\\..\\media\\CodeSuppository");
      StringVector list;
      ff.GetFiles(list);
      StringVector::iterator i;
      for (i=list.begin(); i!=list.end(); i++)
      {
        CPARSER.Parse("TuiChoice \"%s\"", (*i).c_str() );
      }
      releaseWildCard(wc);
    }

    CPARSER.Parse("TuiArg %s", mEnvironmentTexture.Get());
    CPARSER.Parse("TuiScript EnvironmentTexture %%1");
    CPARSER.Parse("TuiEnd");

    AddToken("EnvironmentTexture", MC_ENVIRONMENT_TEXTURE );

    createButton("Memory Report", MC_MEMORY_REPORT, "MemoryReport");


    CPARSER.Parse("TuiPageBegin MainMenu");
    CPARSER.Parse("TuiElement DefaultMandelbrot");
    CPARSER.Parse("TuiElement PreviewOnly");
		CPARSER.Parse("TuiElement RectangleSubdivision");
		CPARSER.Parse("TuiElement FloatingPointResolution");
		CPARSER.Parse("TuiElement UseThreading");
    CPARSER.Parse("TuiElement View3d");
    CPARSER.Parse("TuiElement WireframeOverlay");
    CPARSER.Parse("TuiElement ShowNormals");
		CPARSER.Parse("TuiElement FilterFractal");
		CPARSER.Parse("TuiElement OptimizeMesh");
    CPARSER.Parse("TuiElement SmoothColor");
    CPARSER.Parse("TuiElement IterationCount");
		CPARSER.Parse("TuiElement ClockCycles");
		CPARSER.Parse("TuiElement ClampLow");
		CPARSER.Parse("TuiElement ClampHigh");
		CPARSER.Parse("TuiElement ClampScale");
    CPARSER.Parse("TuiElement RotationSpeed");
		CPARSER.Parse("TuiElement ColorPalette");
    CPARSER.Parse("TuiElement EnvironmentTexture");
    CPARSER.Parse("TuiElement FractalCoordinates");
    CPARSER.Parse("TuiElement MemoryReport");
    CPARSER.Parse("TuiPageEnd");

    CPARSER.Parse("TuiPage MainMenu");


		//
		AddToken("CreateDynamics", MC_CREATE_DYNAMICS );
		AddToken("PsScript", MC_PSSCRIPT);
		AddToken("PsLookAt", MC_PSLOOKAT);

    CPARSER.Parse("TuiLoad ThreadFrac.psc");
    CPARSER.Parse("TuiPageExecute MainMenu");



		mStartup = false;


  }
Beispiel #23
0
Widget::Widget(QWidget *parent, Qt::WindowFlags flags)
    : QWidget(parent, flags)
{
    //设置窗体最小的尺寸
    setMinimumSize(1000, 650);
    //设置窗体图标
    setWindowIcon(QPixmap(":/images/winIcon_100.png"));

    //设置窗体标题
    setWindowTitle(tr("Haku"));

    //设置鼠标跟踪
    //setMouseTracking(true);

    //设置窗体标题栏,自定义,此时可以缩放,但不能移动,所以可能需要重新实现鼠标移动事件
    flags = Qt::CustomizeWindowHint;
    flags |= Qt::FramelessWindowHint; //无边框,会无法移动以及缩放
    //flags |= Qt::WindowStaysOnTopHint;
    setWindowFlags(flags);
    //setAttribute(Qt::WA_TranslucentBackground,true);

    //设置透明
    //setWindowOpacity(0);

    //设置皮肤
    //this->setAutoFillBackground(true);
    //QPalette mainPalette;
    //mainPalette.setBrush(QPalette::Background, QBrush(skinPic));
    //this->setPalette(mainPalette);
    setSkin(skinPic);

    //设置窗体的字体
    font = QFont("ZYSong18030", 14);
    setFont(font);

    /***************************************************************************/
    //创建主布局及三个子布局,并设置布局
    mainLayout = new QGridLayout(this);
    mainLayout->setSpacing(0);
    mainLayout->setMargin(0);
    firstLayout = new QHBoxLayout;
    secondLayout = new QHBoxLayout;
    threeLayout = new QHBoxLayout;
    mainLayout->addLayout(firstLayout, 0, 0, 1, 1);
    mainLayout->addLayout(secondLayout, 1, 0, 5, 1);
    mainLayout->addLayout(threeLayout, 6, 0, 1, 1);


    /***************************************************************************/
    //创建第一个子布局
    userImage = new QPushButton;
    userImage->setFlat(true);
    userImagePix = new QPixmap(":/images/haku_icon_40.png");
    userImage->setIcon(*userImagePix);
    userImage->setIconSize((*userImagePix).size());
    userImage->setToolTip(tr("更换头像"));

    userName = new QPushButton;
    userName->setFlat(true);
    userName->setText(tr("Haku520"));
    userName->setToolTip(tr("更改用户名"));

    searchEdit = new QLineEdit;
    searchBtn = new QPushButton;
    searchBtn->setFlat(true);
    searchBtn->setIcon(QPixmap(":/images/searchIcon.png"));
    searchBtn->setToolTip(tr("搜索歌曲"));
    //输入完毕或点击搜索按钮则搜索歌曲
    connect(searchEdit, SIGNAL(editingFinished()), this, SLOT(searchMusic()));
    connect(searchBtn, SIGNAL(clicked()), this, SLOT(searchMusic()));

    skinBtn = new QPushButton;
    skinBtn->setFlat(true);
    skinBtn->setIcon(QPixmap(":/images/skinIcon.png"));
    skinBtn->setToolTip(tr("更换皮肤"));
    //连接更换皮肤的槽函数
    connect(skinBtn, SIGNAL(clicked()), this, SLOT(changeSkin()));

    preferenceBtn = new QPushButton;
    preferenceBtn->setFlat(true);
    preferenceBtn->setIcon(QPixmap(":/images/preferenceIcon.png"));
    preferenceBtn->setToolTip(tr("设置"));

    controlBtn = new QPushButton;
    controlBtn->setFlat(true);
    controlBtn->setIcon(QPixmap(":/images/controlIcon.png"));
    controlBtn->setToolTip(tr("遥控器"));

    hideBtn = new QPushButton;
    hideBtn->setFlat(true);
    hideBtn->setIcon(QPixmap(":/images/hideIcon.png"));
    hideBtn->setToolTip(tr("隐藏音乐库"));

    minimumBtn = new QPushButton;
    minimumBtn->setFlat(true);
    minimumBtn->setIcon(QPixmap(":/images/minimumIcon.png"));
    minimumBtn->setToolTip(tr("最小化窗口"));

    closeBtn = new QPushButton;
    closeBtn->setFlat(true);
    closeBtn->setIcon(QPixmap(":/images/closeIcon.png"));
    closeBtn->setToolTip(tr("关闭"));

    //将各个按钮添加到第一个子布局上
    firstLayout->setMargin(0);
    firstLayout->addWidget(userImage);
    firstLayout->addWidget(userName);
    firstLayout->addStretch();
    firstLayout->addWidget(searchEdit);
    firstLayout->addWidget(searchBtn);
    firstLayout->addStretch();
    firstLayout->addWidget(skinBtn);
    firstLayout->addWidget(preferenceBtn);
    firstLayout->addWidget(controlBtn);
    firstLayout->addWidget(hideBtn);
    firstLayout->addWidget(minimumBtn);
    firstLayout->addWidget(closeBtn);

    //添加信号槽,暂时只实现退出按钮,其余的之后得补上!
    connect(closeBtn, SIGNAL(clicked()), this, SLOT(quitEmit()));
    connect(minimumBtn, SIGNAL(clicked()), this, SLOT(minWidget()));


    /***********************************************************************/
    //创建第二个子布局
    secFrameLayout = new SecFrame;
    secondLayout->addWidget(secFrameLayout);

    //接收从第二个子布局发送过来的可以播放的信号,对传递过来的这首歌曲进行播放控制
    connect(secFrameLayout, SIGNAL(SendToTop(SingleMusic *)),
            this, SLOT(PreplayOrpauseMusic(SingleMusic*)));

    //接收从主界面传递过来的搜索音乐的信号,让downloadDisplay窗体直接进行实际的搜索
    connect(this, SIGNAL(searchMusicString(QString)),
            secFrameLayout->downloadDisplay,
            SLOT(search(QString)));
    //试听音乐时,能够及时反映出播放按钮及进度条的显示
    //connect(secFrameLayout, SIGNAL(changeBtnIcon(bool)), this, SLOT(currentIsPlaying(bool)));

    connect(secFrameLayout, SIGNAL(closePrevMusic()), this, SLOT(closePreMusic()));

    /***********************************************************************/
    //创建第三个子布局
    playerBtn = new QPushButton;
    playerBtn->setFlat(true);
    playerBtn->setIcon(QPixmap(":/images/playerIcon.png"));
    playerBtn->setIconSize(QPixmap(":/images/playerIcon.png").size());
    //关联上歌曲的播放控制事件
    playBool = true;
    connect(playerBtn, SIGNAL(clicked()), this, SLOT(player()));

    preMusicBtn = new QPushButton;
    preMusicBtn->setFlat(true);
    preMusicBtn->setIcon(QPixmap(":/images/preMusicIcon.png"));
    preMusicBtn->setIconSize(QPixmap(":/images/preMusicIcon.png").size());
    //下面是测试用,之后用其正统的功能(即播放上一首歌曲)替换掉
    connect(preMusicBtn, SIGNAL(clicked()), this, SLOT(prevMusic()));

    nextMusicBtn = new QPushButton;
    nextMusicBtn->setFlat(true);
    nextMusicBtn->setIcon(QPixmap(":/images/nextMusicIcon.png"));
    nextMusicBtn->setIconSize(QPixmap(":/images/nextMusicIcon.png").size());

    loveMusicBtn = new QPushButton;
    loveMusicBtn->setFlat(true);
    loveMusicBtn->setIcon(QPixmap(":/images/loveIcon.png"));
    loveMusicBtn->setIconSize(QPixmap(":/images/loveIcon.png").size());
    loveMusicBtn->setToolTip(tr("收藏"));

    downloadBtn = new QPushButton;
    downloadBtn->setFlat(true);
    downloadBtn->setIcon(QPixmap(":/images/downloadIcon.png"));
    downloadBtn->setIconSize(QPixmap(":/images/downloadIcon.png").size());
    downloadBtn->setToolTip(tr("下载"));

    similarBtn = new QPushButton;
    similarBtn->setFlat(true);
    similarBtn->setIcon(QPixmap(":/images/similarIcon.png"));
    similarBtn->setIconSize(QPixmap(":/images/similarIcon.png").size());
    similarBtn->setToolTip(tr("相似歌曲"));

    orderBtn = new QPushButton;
    orderBtn->setFlat(true);
    orderBtn->setIcon(QPixmap(":/images/orderIcon.png"));
    orderBtn->setIconSize(QPixmap(":/images/orderIcon.png").size());
    orderBtn->setToolTip(tr("播放顺序"));

    volumeBtn = new QPushButton;
    volumeBtn->setFlat(true);
    volumeBtn->setIcon(QPixmap(":/images/volumeIcon.png"));
    volumeBtn->setIconSize(QPixmap(":/images/volumeIcon.png").size());
    volumeBtn->setToolTip(tr("音量"));

    soundEffectsBtn = new QPushButton;
    soundEffectsBtn->setFlat(true);
    soundEffectsBtn->setIcon(QPixmap(":/images/soundEffectsIcon.png"));
    soundEffectsBtn->setIconSize(QPixmap(":/images/soundEffectsIcon.png").size());
    soundEffectsBtn->setToolTip(tr("音效"));

    lyricBtn = new QPushButton;
    lyricBtn->setFlat(true);
    lyricBtn->setIcon(QPixmap(":/images/lyricIcon.png"));
    lyricBtn->setIconSize(QPixmap(":/images/lyricIcon.png").size());
    lyricBtn->setToolTip(tr("歌词"));

    playQueueBtn = new QPushButton;
    playQueueBtn->setFlat(true);
    playQueueBtn->setIcon(QPixmap(":/images/playQueueIcon.png"));
    playQueueBtn->setIconSize(QPixmap(":/images/playQueueIcon.png").size());
    playQueueBtn->setToolTip(tr("播放队列"));

    /*********************************进度条的定义**********************************/


    /********************************以上是进度条的定义*****************************/

    //将相关元素添加到第三个子布局上
    threeLayout->addSpacing(60);
    threeLayout->setMargin(0);
    threeLayout->addWidget(preMusicBtn);
    threeLayout->addWidget(playerBtn);
    threeLayout->addWidget(nextMusicBtn);
    threeLayout->addSpacing(3);

    //添加进度条
    createSlider();
    threeLayout->addWidget(sliderFrame);

    threeLayout->addSpacing(3);
    threeLayout->addWidget(loveMusicBtn);
    threeLayout->addWidget(downloadBtn);
    threeLayout->addWidget(similarBtn);
    threeLayout->addWidget(orderBtn);
    threeLayout->addWidget(volumeBtn);
    threeLayout->addWidget(soundEffectsBtn);
    threeLayout->addWidget(lyricBtn);
    threeLayout->addWidget(playQueueBtn);


}
Beispiel #24
0
Window::Window(const QString & inAudioFileName)
{

  mainWidget = new QWidget();

  setCentralWidget(mainWidget);

  glWidget = new GLWidget(inAudioFileName);

  glWidget->setMinimumSize(500,500);
  glWidget->setMaximumSize(500,500);

  createActions();
  createMenus();

  // Create the x,y,z sliders
  xSlider = createRotationSlider();
  ySlider = createRotationSlider();
  zSlider = createRotationSlider();

  // The y-scale slider
  yScaleSlider = createSlider(0,1000,10,100,50);

  // A play/pause button
  playpause_button  = new QPushButton(tr("Play/Pause"));

  // A combo box for choosing the power spectrum calculation
  powerSpectrumModeCombo = new QComboBox;
  powerSpectrumModeCombo->addItem(tr("Power"));
  powerSpectrumModeCombo->addItem(tr("Magnitude"));
  powerSpectrumModeCombo->addItem(tr("Decibels"));
  powerSpectrumModeCombo->addItem(tr("Power Density"));

  powerSpectrumModeLabel = new QLabel(tr("&PowerSpectrum mode:"));
  powerSpectrumModeLabel->setBuddy(powerSpectrumModeCombo);

  //   // A combo box for choosing the fft bin size
  //   fftBinsModeCombo = new QComboBox;
  //   fftBinsModeCombo->addItem(tr("32"));
  //   fftBinsModeCombo->addItem(tr("64"));
  //   fftBinsModeCombo->addItem(tr("128"));
  //   fftBinsModeCombo->addItem(tr("256"));
  //   fftBinsModeCombo->addItem(tr("1024"));
  //   fftBinsModeCombo->addItem(tr("2048"));
  //   fftBinsModeCombo->addItem(tr("4096"));
  //   fftBinsModeCombo->addItem(tr("8192"));
  //   fftBinsModeCombo->addItem(tr("16384"));
  //   fftBinsModeCombo->addItem(tr("32768"));

  //   fftBinsModeLabel = new QLabel(tr("&Number of FFT Bins:"));
  //   fftBinsModeLabel->setBuddy(fftBinsModeCombo);

//     waterfallCheckBox = new QCheckBox(tr("&Waterfall"));
//     waterfallCheckBox->setChecked(true);

  // 	// Connect a click signal on the go button to a slot to start the rotation time
  connect(playpause_button, SIGNAL(clicked()), glWidget, SLOT(playPause()));

  // Connect up the x,y,z sliders with slots to set the rotation values
  connect(xSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setXRotation(int)));
  connect(glWidget, SIGNAL(xRotationChanged(int)), xSlider, SLOT(setValue(int)));
  connect(ySlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYRotation(int)));
  connect(glWidget, SIGNAL(yRotationChanged(int)), ySlider, SLOT(setValue(int)));
  connect(zSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setZRotation(int)));
  connect(glWidget, SIGNAL(zRotationChanged(int)), zSlider, SLOT(setValue(int)));

  // Scale sliders
  connect(yScaleSlider, SIGNAL(valueChanged(int)), glWidget, SLOT(setYScale(int)));

  connect(powerSpectrumModeCombo, SIGNAL(currentIndexChanged(int)), glWidget, SLOT(powerSpectrumModeChanged(int)));

//   connect(waterfallCheckBox, SIGNAL(toggled(bool)), glWidget, SLOT(setWaterfallVisible(bool)));

  // A main layout to hold everything
  QHBoxLayout *layout = new QHBoxLayout;

  // The OpenGL window and the sliders to move it interactively
  QVBoxLayout *gl_layout = new QVBoxLayout;
  gl_layout->addWidget(glWidget);

  QHBoxLayout *x_slider_layout = new QHBoxLayout;
  QLabel *x_slider_label = new QLabel(("X"));
  x_slider_layout->addWidget(x_slider_label);
  x_slider_layout->addWidget(xSlider);
  gl_layout->addLayout(x_slider_layout);

  QHBoxLayout *y_slider_layout = new QHBoxLayout;
  QLabel *y_slider_label = new QLabel(("Y"));
  y_slider_layout->addWidget(y_slider_label);
  y_slider_layout->addWidget(ySlider);
  gl_layout->addLayout(y_slider_layout);

  QHBoxLayout *z_slider_layout = new QHBoxLayout;
  QLabel *z_slider_label = new QLabel(("Z"));
  z_slider_layout->addWidget(z_slider_label);
  z_slider_layout->addWidget(zSlider);
  gl_layout->addLayout(z_slider_layout);

  layout->addLayout(gl_layout);

  // All the controls on the right side of the window
  QVBoxLayout *controls_layout = new QVBoxLayout;
  layout->addLayout(controls_layout);

  // The scaling sliders
  QVBoxLayout *scale_layout = new QVBoxLayout;
  QLabel *scale_label = new QLabel(("Scale"));
  scale_layout->addWidget(scale_label);
  scale_layout->addWidget(yScaleSlider);
  controls_layout->addLayout(scale_layout);

  // Controls for the animation
  QVBoxLayout *buttons_layout = new QVBoxLayout;
  buttons_layout->addWidget(powerSpectrumModeLabel);
  buttons_layout->addWidget(powerSpectrumModeCombo);
  buttons_layout->addWidget(playpause_button);
  controls_layout->addLayout(buttons_layout);

  // Set the layout for this widget to the layout we just created
  mainWidget->setLayout(layout);

  // Set some nice defaults for all the sliders
  xSlider->setValue(0 * 16);
  ySlider->setValue(0 * 16);
  zSlider->setValue(0 * 16);

  yScaleSlider->setValue(350);

  setWindowTitle(tr("MarSndPeek"));
}
Beispiel #25
0
		Control* createSliderV(const Loader& e) { return createSlider(e,Slider::VERTICAL); }
Beispiel #26
0
		Control* createSliderH(const Loader& e) { return createSlider(e,Slider::HORIZONTAL); }
void ViewerState::createSliders() {
	Vector2 rotLabelOffset = Vector2(-15, 12);
	Vector2 transLabelOffset = Vector2(-6, 6);

	// Rotation
	GUIElement* rotContainer = new GUIElement("rotContainer", Vector2(235, -310));
	rotContainer->attachChild(new Label("rotTitle", "Rotation", 12, Vector2(-15, 30)));

	Slider* rotX = createSlider("rotateX", Vector2(0, 0), 0, HORIZONTAL, rotContainer);
	rotX->setColour(ColourRGBA::RED);
	rotX->attachChild(new Label("rotXLabel", "X:", 10, rotLabelOffset));

	Slider* rotY = createSlider("rotateY", Vector2(0, -30), 0, HORIZONTAL, rotContainer);
	rotY->setColour(ColourRGBA::GREEN);
	rotY->attachChild(new Label("rotYLabel", "Y:", 10, rotLabelOffset));

	Slider* rotZ = createSlider("rotateZ", Vector2(0, -60), 0, HORIZONTAL, rotContainer);
	rotZ->setColour(ColourRGBA::BLUE);
	rotZ->attachChild(new Label("rotZLabel", "Z:", 10, rotLabelOffset));

	// Translate

	GUIElement* transContainer = new GUIElement("transContainer", Vector2(235, -155));
	transContainer->attachChild(new Label("transTitle", "Translation", 12, Vector2(-15, 30)));

	p_transX = createSlider("translateX", Vector2(0, 0), 50, HORIZONTAL, transContainer);
	p_transX->setColour(ColourRGBA::RED);
	p_transX->attachChild(new Label("transXLabel", "X:", 10, rotLabelOffset));

	p_transY = createSlider("translateY", Vector2(0, -30), 50, HORIZONTAL, transContainer);
	p_transY->setColour(ColourRGBA::GREEN);
	p_transY->attachChild(new Label("transYLabel", "Y:", 10, rotLabelOffset));

	p_transZ = createSlider("translateZ", Vector2(0, -60), 50, HORIZONTAL, transContainer);
	p_transZ->setColour(ColourRGBA::BLUE);
	p_transZ->attachChild(new Label("transZLabel", "Z:", 10, rotLabelOffset));

	// Scale

	GUIElement* scaleContainer = new GUIElement("scaleContainer", Vector2(235, 30));
	scaleContainer->attachChild(new Label("scaleTitle", "Scale", 12, Vector2(-15, 30)));

	p_scaleAll = createSlider("scaleAll", Vector2(), 50, HORIZONTAL, scaleContainer);
	p_scaleAll->attachChild(new Label("scaleAllLabel", "A:", 10, rotLabelOffset));

	p_scaleX = createSlider("scaleX", Vector2(0, -30), 50, HORIZONTAL, scaleContainer);
	p_scaleX->setColour(ColourRGBA::RED);
	p_scaleX->attachChild(new Label("scaleXLabel", "X:", 10, rotLabelOffset));

	p_scaleY = createSlider("scaleY", Vector2(0, -60), 50, HORIZONTAL, scaleContainer);
	p_scaleY->setColour(ColourRGBA::GREEN);
	p_scaleY->attachChild(new Label("scaleYLabel", "Y:", 10, rotLabelOffset));

	p_scaleZ = createSlider("scaleZ", Vector2(0, -90), 50, HORIZONTAL, scaleContainer);
	p_scaleZ->setColour(ColourRGBA::BLUE);
	p_scaleZ->attachChild(new Label("scaleZLabel", "Z:", 10, rotLabelOffset));

	// Slap 'em in

	attachChild(scaleContainer);
	attachChild(rotContainer);
	attachChild(transContainer);
}
Beispiel #28
0
Slider::Slider(int x, int y, int w, int h, float &v): left(x), top(y), width(w),
    height(h), value(v), background(NULL), highlight(false), dragging(false)
{
    createSlider(height);
}
Beispiel #29
0
FrameView::FrameView (Connection * conn, FrameViewConfig const & cfg, QString const & fname, QStringList const & path)
	: DockedWidgetBase(conn->getMainWindow(), path)
	, m_bars(0)
	, m_config(cfg)
	, m_config_ui(m_config, this)
{
	setContextMenuPolicy(Qt::CustomContextMenu);
	connect(this, SIGNAL(customContextMenuRequested(QPoint const &)), this, SLOT(onShowContextMenu(QPoint const &)));

	m_plot = new QwtPlot();
	m_bars = new BarPlot();
	m_bars->attach(m_plot);

	m_plot->plotLayout()->setAlignCanvasToScales(true);
	m_plot->plotLayout()->setCanvasMargin(0);
	m_plot->setContentsMargins(QMargins(0, 0, 0, 0));
	m_plot->setMinimumSize(64,64);

	m_plot->setAutoReplot(true);
	//qDebug("%s this=0x%08x", __FUNCTION__, this);

	QwtPlotMagnifier * lookglass = new QwtPlotMagnifier(m_plot->canvas());
	m_plot->canvas()->setFocusPolicy(Qt::WheelFocus);
	lookglass->setAxisEnabled(QwtPlot::yLeft, false);

	XZoomer * zoomer = new XZoomer(m_plot->canvas());
	zoomer->setRubberBandPen( QColor( Qt::black ) );
	zoomer->setTrackerPen( QColor( Qt::black ) );
	zoomer->setMousePattern( QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier );
	zoomer->setMousePattern( QwtEventPattern::MouseSelect3, Qt::RightButton, Qt::ShiftModifier);

	QwtPlotPicker * picker = new QwtPlotPicker(QwtPlot::xBottom, QwtPlot::yLeft,
										QwtPlotPicker::CrossRubberBand, QwtPicker::AlwaysOn,
										m_plot->canvas());
	//picker->setStateMachine(new QwtPickerDragPointMachine());
	picker->setStateMachine(new QwtPickerClickPointMachine());
	picker->setRubberBandPen(QColor(Qt::green));
	picker->setRubberBand(QwtPicker::CrossRubberBand);
	picker->setTrackerPen(QColor(Qt::white));

	QwtPlotPanner * panner = new QwtPlotPanner(m_plot->canvas());
	panner->setAxisEnabled(QwtPlot::yLeft, false);
	panner->setMouseButton(Qt::MidButton);

    m_plot->setAxisMaxMinor(QwtPlot::xBottom, 3);
    m_plot->setAxisScaleDraw(QwtPlot::xBottom, new FrameScaleDraw(Qt::Horizontal, m_bars->m_strvalues));

	m_plot->setAxisAutoScale(QwtPlot::yLeft, true);
	m_bars->setLayoutPolicy(QwtPlotAbstractBarChart::FixedSampleSize);
	m_bars->setLayoutHint(5);
	m_bars->setSpacing(1);

	QwtSlider * slider = createSlider(1);
    connect(slider, SIGNAL(valueChanged(double)), SLOT(setNum(double)));
    QVBoxLayout * layout = new QVBoxLayout( this );
    layout->addWidget(m_plot);
    //layout->addWidget(slider);
	m_bars->setLegendMode(QwtPlotBarChart::LegendBarTitles);

    connect(picker, SIGNAL(selected(QRectF const &) ), this, SLOT(selected(QRectF const &)));
    connect(picker, SIGNAL(selected(QPointF const &) ), this, SLOT(selected(QPointF const &)));
    connect(picker, SIGNAL(appended(QPointF const &) ), this, SLOT(appended(QPointF const &)));
    connect(picker, SIGNAL(selected(QVector<QPointF> const &) ), this, SLOT(selected(QVector<QPointF> const &)));

    connect(&getSyncWidgets(), SIGNAL( requestSynchronization(E_SyncMode mode, int, unsigned long long, void *) ),
						 this, SLOT( performSynchronization(E_SyncMode mode, int, unsigned long long, void *) ));
    connect(this, SIGNAL( requestSynchronization(E_SyncMode mode, int, unsigned long long, void *) ),
						 &getSyncWidgets(), SLOT( performSynchronization(E_SyncMode mode, int, unsigned long long, void *) ));
}