Exemplo n.º 1
0
ramPresetTab::ramPresetTab()
:ofxUITab("Presets", false)
,preset_cam_index(1)
,use_node_cam(false)
,cam_position(false)
,cam_look_at(false)
{
	// should probably be a list of named presets instead of a grid
    addLabelButton("Line", false);
    addLabelButton("Hasty Chase", false);
    addLabelButton("HC + Stamp", false);
    addLabelButton("HC + Stamp + Natto", false);
    addLabelButton("HC + Future", false);
	addLabelButton("Line + Future", false);
// ignore win32
#ifndef TARGET_WIN32
	addLabelButton("Particles + Future", false);
	addLabelButton("Particles", false);
#else
	addLabelButton("Future", false); // only for windows
#endif
	addSpacer();
	
	vector<string> cameraPresetNames;
	cameraPresetNames.push_back("Low");
	cameraPresetNames.push_back("High");
	cameraPresetNames.push_back("Overhead");
	preset_cam_radio = addRadio("Camera position", cameraPresetNames);
	preset_cam_radio->getToggles()[preset_cam_index]->setValue(true);
	addSpacer();
	
    // nodecam
    addLabel("NodeCam", OFX_UI_FONT_LARGE);
    addLabel("1. Click a node on actor", OFX_UI_FONT_SMALL);
    addLabel("which you want to set as", OFX_UI_FONT_SMALL);
    addLabel("camera pos or lookAt.", OFX_UI_FONT_SMALL);
    
    addLabel("2. Click a button below.", OFX_UI_FONT_SMALL);
    addLabel("a joint with red circle", OFX_UI_FONT_SMALL);
    addLabel("will be set as pos or lookAt.", OFX_UI_FONT_SMALL);
    addButton("Set Camera Position", &cam_position, 15, 15);
    addButton("Set Camera LookAt", &cam_look_at, 15, 15);
    
    addLabel("3. Enable NodeCam.", OFX_UI_FONT_SMALL);
    addToggle("Enable Node Cam", &use_node_cam, 30, 30);
    
	autoSizeToFitWidgets();
	
	ofAddListener(ofEvents().update, this, &ramPresetTab::update);
	ofAddListener(ofEvents().draw, this, &ramPresetTab::draw);
	ofAddListener(newGUIEvent, this, &ramPresetTab::guiEvent);
}
void PMUICanvasRibbonRenderer::init(int posX, int posY, bool autosize, int width, int height)
{
    PMUICanvasBaseRenderer::init(posX, posY, autosize, width, height);

    gradientImage.load("./gradients/gradient4x_512x160.png");
    numGradients = 4;

    setGlobalSliderHeight(10);
    setGlobalButtonDimension(14);

    { // Brush (basic)
        addSpacer();
        addLabel(STR_BRUSH_BASIC);
        addIntSlider(STR_BRUSH_BASIC_NUMPAINTERS, 1, 100, &numPainters);
        addIntSlider(STR_BRUSH_BASIC_WIDTH, 1, 10, &strokeWidth);
        addSlider(STR_BRUSH_BASIC_SPEED, 1.01f, 100, &speed);
        addToggle(STR_BRUSH_BASIC_ENABLEBOUNCE, &enableBounce);
    }

    { // Brush (advanced)
        addSpacer();
        addLabel(STR_BRUSH_ADVANCED);
        addSlider(STR_BRUSH_ADVANCED_DIVISIONS, 0.001, 4.5, &divisions);
//        addSlider(STR_BRUSH_ADVANCED_EASE, -1.0, 10.0, &ease);
//        addSlider("Ease Randomness",0.0,1.0,&easeRandomness);
//        addIntSlider(STR_BRUSH_ADVANCED_MAXVERT,3, 4000, &pathMaxVertices);
        addSlider("Next Position Delta",0.0,1.0,&nextPositionDelta);
    }

    { // Color mode
        addSpacer();
        addLabel(STR_BRUSH_COLORMODE);

        vector<string> colorModesNames;
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MFIXEDCOLOR);
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MGRSPEED);
        colorModesNames.push_back(STR_BRUSH_COLORMODE_MGREDGES);
        addRadio(STR_BRUSH_COLORMODE_RADIO, colorModesNames, OFX_UI_ORIENTATION_VERTICAL);

        addImageSampler(STR_BRUSH_COLORMODE_GRIMAGE, &gradientImage);
        addIntSlider(STR_BRUSH_COLORMODE_GRID, 1, 4, &gradientId);
        addIntSlider(STR_BRUSH_COLORMODE_GRSPEED, 1, 500, &gradientSpeed);
        addIntSlider(STR_BRUSH_COLORMODE_R, 0, 255, &colorR);
        addIntSlider(STR_BRUSH_COLORMODE_G, 0, 255, &colorG);
        addIntSlider(STR_BRUSH_COLORMODE_B, 0, 255, &colorB);
    }

    if (autosize) autoSizeToFitWidgets();

    loadPreset(selectedPreset);
}
ramPresetTab::ramPresetTab()
:ofxUITab("Presets", false)
,cameraPreset(1)
{
	// should probably be a list of named presets instead of a grid
	matrix = addToggleMatrix("Presets", 4, 4);
	matrix->setAllowMultiple(false);
	addSpacer();
	
	vector<string> cameraPresetNames;
	cameraPresetNames.push_back("Low");
	cameraPresetNames.push_back("High");
	cameraPresetNames.push_back("Overhead");
	cameraPresetRadio = addRadio("Camera position", cameraPresetNames);
	cameraPresetRadio->getToggles()[cameraPreset]->setValue(true);
	
	autoSizeToFitWidgets();
	
	ofAddListener(ofEvents().update, this, &ramPresetTab::setupCamera);
	ofAddListener(newGUIEvent, this, &ramPresetTab::guiEvent);
}
Exemplo n.º 4
0
void Ui::ToolBar::init() {
    GtkStyle::applyTheme(this);
    ensurePolished();
    QLabel lbl(this);
    lbl.ensurePolished();
    QColor col=Utils::clampColor(lbl.palette().windowText().color());

    playIcon=Core::MonoIcon::icon(Core::MonoIcon::ex_mediaplay, col);
    pauseIcon=Core::MonoIcon::icon(Core::MonoIcon::ex_mediapause, col);
    prevAction=ActionCollection::get()->createAction("previous", tr("Previous Track"), Core::MonoIcon::icon(Core::MonoIcon::ex_mediaprevious, col));
    playPauseAction=ActionCollection::get()->createAction("play", tr("Play/Pause"), playIcon);
    nextAction=ActionCollection::get()->createAction("next", tr("Next Track"), Core::MonoIcon::icon(Core::MonoIcon::ex_medianext, col));
    showLyricsAction=ActionCollection::get()->createAction("lyrics", tr("Show Lyrics"), Core::MonoIcon::icon(Core::MonoIcon::commento, col));
    showLyricsAction->setCheckable(true);

    playPauseAction->setShortcut(Qt::ControlModifier+Qt::Key_P);
    prevAction->setShortcut(Qt::ControlModifier+Qt::Key_Left);
    nextAction->setShortcut(Qt::ControlModifier+Qt::Key_Right);

    nowPlaying=new NowPlayingWidget(this);
    volumeSlider=new VolumeSlider(this);
    volumeSlider->setColor(col);

    addSpacer();
    QWidget *controls=new QWidget(this);
    QHBoxLayout *controlsLayout=new QHBoxLayout(controls);
    QList<Action *> controlActs=QList<Action *>() << prevAction << playPauseAction << nextAction;
    int otherIconSize=Utils::scaleForDpi(28);
    int playPauseIconSize=Utils::scaleForDpi(32);
    int pad=Utils::scaleForDpi(8);
    foreach (Action *act, controlActs) {
        int iconSize=act==playPauseAction ? playPauseIconSize : otherIconSize;
        ToolButton *btn=new ToolButton(controls);
        btn->setDefaultAction(act);
        btn->setFixedSize(QSize(iconSize+pad, iconSize+pad));
        btn->setIconSize(QSize(iconSize, iconSize));
        btn->setAutoRaise(true);
        btn->setToolButtonStyle(Qt::ToolButtonIconOnly);
        controlsLayout->addWidget(btn);
    }
Exemplo n.º 5
0
KgProtocols::KgProtocols(bool first, QWidget* parent) :
        KonfiguratorPage(first, parent)
{
    QGridLayout *KgProtocolsLayout = new QGridLayout(this);
    KgProtocolsLayout->setSpacing(6);

    //  -------------------------- LINK VIEW ----------------------------------

    QGroupBox *linkGrp = createFrame(i18n("Links"), this);
    QGridLayout *linkGrid = createGridLayout(linkGrp);

    QStringList labels;
    labels << i18n("Defined Links");

    linkList = new KrTreeWidget(linkGrp);
    linkList->setHeaderLabels(labels);
    linkList->setRootIsDecorated(true);

    linkGrid->addWidget(linkList, 0, 0);
    KgProtocolsLayout->addWidget(linkGrp, 0, 0, 2, 1);

    //  -------------------------- BUTTONS ----------------------------------

    QWidget *vbox1Widget = new QWidget(this);
    QVBoxLayout *vbox1 = new QVBoxLayout(vbox1Widget);

    addSpacer(vbox1);
    btnAddProtocol = new QPushButton(vbox1Widget);
    btnAddProtocol->setIcon(krLoader->loadIcon("arrow-left", KIconLoader::Small));
    btnAddProtocol->setWhatsThis(i18n("Add protocol to the link list."));
    vbox1->addWidget(btnAddProtocol);

    btnRemoveProtocol = new QPushButton(vbox1Widget);
    btnRemoveProtocol->setIcon(krLoader->loadIcon("arrow-right", KIconLoader::Small));
    btnRemoveProtocol->setWhatsThis(i18n("Remove protocol from the link list."));
    vbox1->addWidget(btnRemoveProtocol);
    addSpacer(vbox1);

    KgProtocolsLayout->addWidget(vbox1Widget, 0 , 1);

    QWidget *vbox2Widget = new QWidget(this);
    QVBoxLayout *vbox2 = new QVBoxLayout(vbox2Widget);

    addSpacer(vbox2);
    btnAddMime = new QPushButton(vbox2Widget);
    btnAddMime->setIcon(krLoader->loadIcon("arrow-left", KIconLoader::Small));
    btnAddMime->setWhatsThis(i18n("Add MIME to the selected protocol on the link list."));
    vbox2->addWidget(btnAddMime);

    btnRemoveMime = new QPushButton(vbox2Widget);
    btnRemoveMime->setIcon(krLoader->loadIcon("arrow-right", KIconLoader::Small));
    btnRemoveMime->setWhatsThis(i18n("Remove MIME from the link list."));
    vbox2->addWidget(btnRemoveMime);
    addSpacer(vbox2);

    KgProtocolsLayout->addWidget(vbox2Widget, 1 , 1);

    //  -------------------------- PROTOCOLS LISTBOX ----------------------------------

    QGroupBox *protocolGrp = createFrame(i18n("Protocols"), this);
    QGridLayout *protocolGrid = createGridLayout(protocolGrp);

    protocolList = new KrListWidget(protocolGrp);
    loadProtocols();
    protocolGrid->addWidget(protocolList, 0, 0);

    KgProtocolsLayout->addWidget(protocolGrp, 0 , 2);

    //  -------------------------- MIMES LISTBOX ----------------------------------

    QGroupBox *mimeGrp = createFrame(i18n("MIMEs"), this);
    QGridLayout *mimeGrid = createGridLayout(mimeGrp);

    mimeList = new KrListWidget(mimeGrp);
    loadMimes();
    mimeGrid->addWidget(mimeList, 0, 0);

    KgProtocolsLayout->addWidget(mimeGrp, 1 , 2);

    //  -------------------------- CONNECT TABLE ----------------------------------

    connect(protocolList,      SIGNAL(itemSelectionChanged()), this, SLOT(slotDisableButtons()));
    connect(linkList,          SIGNAL(itemSelectionChanged()), this, SLOT(slotDisableButtons()));
    connect(mimeList,          SIGNAL(itemSelectionChanged()), this, SLOT(slotDisableButtons()));
    connect(linkList,          SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(slotDisableButtons()));
    connect(btnAddProtocol,    SIGNAL(clicked())         , this, SLOT(slotAddProtocol()));
    connect(btnRemoveProtocol, SIGNAL(clicked())         , this, SLOT(slotRemoveProtocol()));
    connect(btnAddMime,        SIGNAL(clicked())         , this, SLOT(slotAddMime()));
    connect(btnRemoveMime,     SIGNAL(clicked())         , this, SLOT(slotRemoveMime()));

    loadInitialValues();
    slotDisableButtons();
}
Exemplo n.º 6
0
void
MenuColumn::loadItems()
{
    // Open column's config file
    KDesktopFile cfg( "xkmenu/" + m_name + "/spec.desktop", true ,"data" );

    // Set column specific colors if defined in the file
    setBackgroundColor( cfg.readColorEntry( "BackgroundColor" ) );
    setHighlightColor( cfg.readColorEntry( "HighlightColor" ) );

    // Read directories in the column directory. These are components.
    QStringList compDirs = KGlobal::dirs()->findDirs( "data", "xkmenu/" + m_name  );
    QStringList::ConstIterator it;
    for( it = compDirs.begin(); it != compDirs.end(); ++it )
    {
        QDir d( *it );
        QStringList comps = d.entryList( "*", QDir::Dirs);
        // Now iterate through components
        for( QStringList::ConstIterator comp = comps.begin(); comp != comps.end(); ++comp )
        {
            if( *comp == "." || *comp == ".." ) continue;

            // Read components config file.
            KDesktopFile compCfg( *it + "/" + *comp + "/spec.desktop" );
            QString type = compCfg.readType();

            if( type.lower() == "static" )
            {
                addComponent( new GenericComponent( *it + "/" + *comp,
                                                    this,
                                                    backgroundColor(),
                                                    highlightColor()  )
                            );
            }
            else if( type.lower() == "built-in" || type.lower() == "builtin" )
            {
                QString factory = compCfg.readEntry( "Factory" );
                if( factory.lower() == "all programs" )
                {
                    addComponent( new AllProgramsComponent( this, backgroundColor(), highlightColor() ) );
                }
                else if( factory.lower() == "recent programs" )
                {
                    addComponent( new RecentApplicationsComponent( this, backgroundColor(), highlightColor() ) );
                }
                else if( factory.lower() == "menu extensions" )
                {
                    addComponent( new MenuExtensionsComponent( this, backgroundColor(), highlightColor() ) );
                }
                else if( factory.lower() == "separator" )
                {
                    //! FIXME: make separator read it's own config file
                    addComponent( new SeparatorComponent( this, backgroundColor(),
                                                          compCfg.readColorEntry( "HighlightColor" ) ) );
                }
            }
            else if( type.lower() == "plugin" || type.lower() == "plug-in" )
            {
                //! TODO: implement dynamic loading... later
            }
        }
        addSpacer();
    }
}