コード例 #1
0
ファイル: interface.cpp プロジェクト: reolyze/wallgen
void interface::updateTerms(int i)
{
    termindex = i-1;

    refreshTerms();
    refreshLabels();
}
コード例 #2
0
/* volumeSlider changed value event slot */
void SoundWidget::userUpdateVolume( int i_sliderVolume )
{
    /* Only if volume is set by user action on slider */
    setMuted( false );
    playlist_VolumeSet( THEPL, i_sliderVolume / 100.f );
    refreshLabels();
}
コード例 #3
0
/* libvlc mute/unmute event slot */
void SoundWidget::updateMuteStatus( bool mute )
{
    b_is_muted = mute;

    SoundSlider *soundSlider = qobject_cast<SoundSlider *>(volumeSlider);
    if( soundSlider )
        soundSlider->setMuted( mute );
    refreshLabels();
}
コード例 #4
0
ファイル: choiceview.cpp プロジェクト: clee/runcible
void ChoiceView::setChoices(const QList<Choice> &choices) {
    _choices = choices;
    if (_offset >= _choices.size()) {
        // Integer division floors here.
        _offset = (_choices.size() / 10) * 10;
    }
    emit morePages((_choices.size() + 9) / 10);
    refreshLabels();
}
コード例 #5
0
/* volumeSlider changed value event slot */
void SoundWidget::userUpdateVolume( int i_sliderVolume )
{
    /* Only if volume is set by user action on slider */
    setMuted( false );
    playlist_t *p_playlist = pl_Get( p_intf );
    int i_res = i_sliderVolume * QT_VOLUME_MAX / VOLUME_MAX;
    aout_VolumeSet( p_playlist, i_res );
    refreshLabels();
}
コード例 #6
0
/* libvlc mute/unmute event slot */
void SoundWidget::updateMuteStatus()
{
    playlist_t *p_playlist = pl_Get( p_intf );
    b_is_muted = aout_IsMuted( VLC_OBJECT(p_playlist) );

    SoundSlider *soundSlider = qobject_cast<SoundSlider *>(volumeSlider);
    if( soundSlider )
        soundSlider->setMuted( b_is_muted );
    refreshLabels();
}
コード例 #7
0
/* libvlc changed value event slot */
void SoundWidget::libUpdateVolume( float volume )
{
    long i_volume = lroundf(volume * 100.f);
    if( i_volume != volumeSlider->value()  )
    {
        b_ignore_valuechanged = true;
        volumeSlider->setValue( i_volume );
        b_ignore_valuechanged = false;
    }
    refreshLabels();
}
コード例 #8
0
InfoWidget::InfoWidget(QWidget *parent, PeerData *peer) : BlockWidget(parent, peer, lang(lng_profile_info_section)) {
	auto observeEvents = UpdateFlag::AboutChanged
		| UpdateFlag::UsernameChanged
		| UpdateFlag::UserPhoneChanged
		| UpdateFlag::UserCanShareContact;
	subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
		notifyPeerUpdated(update);
	}));

	refreshLabels();
}
コード例 #9
0
/* libvlc changed value event slot */
void SoundWidget::libUpdateVolume()
{
    /* Audio part */
    audio_volume_t i_volume;
    playlist_t *p_playlist = pl_Get( p_intf );

    i_volume = aout_VolumeGet( p_playlist );
    i_volume = ((i_volume + 1) * VOLUME_MAX ) / QT_VOLUME_MAX;

    if ( i_volume - volumeSlider->value() != 0 )
    {
        b_ignore_valuechanged = true;
        volumeSlider->setValue( i_volume );
        b_ignore_valuechanged = false;
    }
    refreshLabels();
}
コード例 #10
0
int SoundWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: userUpdateVolume((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: libUpdateVolume(); break;
        case 2: updateMuteStatus(); break;
        case 3: refreshLabels(); break;
        case 4: showVolumeMenu((*reinterpret_cast< QPoint(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
コード例 #11
0
ファイル: interface.cpp プロジェクト: reolyze/wallgen
interface::interface(QWidget *parent) :
    QWidget(parent)
{

    // FUNCTIONAL VARIABLES
    termindex = 0;
    saveloadPath = QDir::currentPath();

    // FUNCTIONAL OBJECTS
    f = new hex3Function();
    c = new ColorWheel();


    // ORGANIZATIONAL ELEMENTS
    editconst = new QGroupBox(tr("Function Constants"), this);          //create elements
    interfaceLayout = new QVBoxLayout(this);
    topbarLayout = new QHBoxLayout();
    propsBox = new QGroupBox(tr("Image Properties"), this);
    displayWidget = new QWidget(this);
    genBoxWidget = new QWidget(this);

    topbarLayout->addWidget(genBoxWidget);
    topbarLayout->addWidget(displayWidget);
    topbarLayout->addWidget(propsBox);
    interfaceLayout->addLayout(topbarLayout);                       //lay out vertically
    interfaceLayout->addWidget(editconst);
    setLayout(interfaceLayout);

    // INPUT VALIDATORS (NUMERICAL)
    doubleValidate = new QDoubleValidator(-9999999.0, 9999999.0, 5, this);
    intValidate = new QIntValidator(-9999999, 9999999, this);
    posdoubleValidate = new QDoubleValidator(1.0, 9999999.0, 5, this);
    posintValidate = new QIntValidator(1, 9999999, this);
    numtermsValidate = new QIntValidator(1, 99, this);
    dimValidate = new QIntValidator(1, 2000, this);

    // EDITCONST SUBELEMENTS
    currtermL = new QLabel(editconst);                              //create labels
    currtermL->setText(tr("Term"));
    nL = new QLabel(editconst);
    mL = new QLabel(editconst);
    aL = new QLabel(editconst);
    rL = new QLabel(editconst);
    scaleaL = new QLabel(tr("sa"), editconst);
    scalerL = new QLabel(tr("sr"), editconst);
    refreshLabels();
    nE = new QLineEdit(editconst);                              //create input boxes
    mE = new QLineEdit(editconst);
    aE = new QLineEdit(editconst);
    rE = new QLineEdit(editconst);
    scaleaE = new QLineEdit(editconst);
    scalerE = new QLineEdit(editconst);
    currtermE = new QSpinBox(editconst);
    espacer1 = new QSpacerItem(10, 15);
    espacer2 = new QSpacerItem(10, 15);
    espacer3 = new QSpacerItem(10, 15);
    espacer4 = new QSpacerItem(10, 15);
    espacer5 = new QSpacerItem(130, 15);
    espacer6 = new QSpacerItem(2, 0);
    espacer7 = new QSpacerItem(15, 15);
    espacer8 = new QSpacerItem(8, 15);
    loadButton = new QPushButton(tr("Load..."), editconst);
    saveButton = new QPushButton(tr("Save"), editconst);
    currtermE->setMaximum(4);
    currtermE->setMinimum(1);
    nE->setFixedWidth(75);
    mE->setFixedWidth(75);
    rE->setFixedWidth(75);
    aE->setFixedWidth(75);
    scaleaE->setFixedWidth(75);
    scalerE->setFixedWidth(75);
    nL->setFixedWidth(18);
    mL->setFixedWidth(20);
    rL->setFixedWidth(18);
    aL->setFixedWidth(18);
    scaleaL->setFixedWidth(18);
    scalerL->setFixedWidth(18);
    nE->setValidator(intValidate);
    mE->setValidator(intValidate);
    rE->setValidator(doubleValidate);
    aE->setValidator(doubleValidate);
    scaleaE->setValidator(doubleValidate);
    scalerE->setValidator(doubleValidate);


    editconstLayoutStack = new QVBoxLayout(editconst);  //initialize layout
    editconstLayout = new QHBoxLayout();
    editconstLayoutLower = new QHBoxLayout();
    editconstLayoutLower->setAlignment(Qt::AlignRight);
    editconstLayout->setAlignment(Qt::AlignRight);

    editconstLayout->addWidget(currtermL);              //fill layouts
    editconstLayout->addWidget(currtermE);
    editconstLayout->addItem(espacer1);
    editconstLayout->addWidget(nL);
    editconstLayout->addWidget(nE);
    editconstLayout->addItem(espacer2);
    editconstLayout->addWidget(mL);
    editconstLayout->addWidget(mE);
    editconstLayout->addItem(espacer3);
    editconstLayout->addWidget(rL);
    editconstLayout->addWidget(rE);
    editconstLayout->addItem(espacer4);
    editconstLayout->addWidget(aL);
    editconstLayout->addWidget(aE);
    editconstLayoutLower->addItem(espacer8);
    editconstLayoutLower->addWidget(loadButton);
    editconstLayoutLower->addItem(espacer7);
    editconstLayoutLower->addWidget(saveButton);
    editconstLayoutLower->addItem(espacer5);
    editconstLayoutLower->addWidget(scalerL);
    editconstLayoutLower->addWidget(scalerE);
    editconstLayoutLower->addItem(espacer6);
    editconstLayoutLower->addWidget(scaleaL);
    editconstLayoutLower->addWidget(scaleaE);
    editconstLayoutStack->addLayout(editconstLayout);
    editconstLayoutStack->addLayout(editconstLayoutLower);
    editconst->setLayout(editconstLayoutStack);

    // GENBOX SUBELEMENTS
    genBox = new QGroupBox(tr("Image Generation"), genBoxWidget);
    functionSel = new QComboBox(genBox);        //initialize elements
    colorwheelSel = new QComboBox(genBox);
    functionL = new QLabel(genBox);
    colorwheelL = new QLabel(genBox);
    numtermsL = new QLabel(tr("<i>No. Terms</i>"), genBox);
    numtermsE = new QLineEdit("4", genBox);
    gspacer1 = new QSpacerItem(0,20);
    gspacer2 = new QSpacerItem(0,10);
    gspacer3 = new QSpacerItem(0,10);
    gspacer4 = new QSpacerItem(0,50);

    genBoxOverallLayout = new QVBoxLayout(genBoxWidget);
    functionLayout = new QVBoxLayout();
    colorwheelLayout = new QVBoxLayout();
    numtermsLayout = new QHBoxLayout();

    functionSel->addItem("Hex3");
    functionSel->addItem("Hex6");
    functionSel->addItem("Square");
    functionSel->addItem("Rhombic");
    functionSel->addItem("RhombicPaired");
    functionSel->addItem("Rectangular");
    functionSel->addItem("RectangularPaired");
    functionSel->addItem("General");
    functionSel->addItem("GeneralPaired");
    colorwheelSel->addItem("IcosColor");
    colorwheelSel->addItem("IcosColorC");
    colorwheelSel->addItem("StCol");
    colorwheelSel->addItem("StColC");
    colorwheelSel->addItem("StCol35");
    colorwheelSel->addItem("ZoneCol");
    colorwheelSel->addItem("SectCol");
    colorwheelSel->addItem("Sect6Col");
    colorwheelSel->addItem("WinCol");
    functionL->setText(tr("Function"));
    colorwheelL->setText(tr("Color Wheel"));
    numtermsE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    numtermsL->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    colorwheelSel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    colorwheelL->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    functionSel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    functionL->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);



    numtermsE->setFixedWidth(30);
    numtermsE->setValidator(numtermsValidate);

    genBoxLayout = new QVBoxLayout(genBox);     //set up layout
    functionLayout->addWidget(functionL);
    functionLayout->addWidget(functionSel);
    numtermsLayout->addWidget(numtermsL);
    numtermsLayout->addWidget(numtermsE);
    functionLayout->addLayout(numtermsLayout);
    genBoxLayout->addLayout(functionLayout);
    genBoxLayout->addItem(gspacer1);
    colorwheelLayout->addItem(gspacer3);
    colorwheelLayout->addWidget(colorwheelL);
    colorwheelLayout->addWidget(colorwheelSel);
    genBoxLayout->addLayout(colorwheelLayout);
    genBoxLayout->addItem(gspacer2);

    genBoxOverallLayout->addWidget(genBox);
    genBoxOverallLayout->addItem(gspacer4);

    // PROPSBOX SUBELEMENTS
    outheightL = new QLabel(tr("Output Height"), propsBox);          //initialize elements
    outwidthL = new QLabel(tr("Output Width"), propsBox);
    XCornerL = new QLabel(tr("XCorner"), propsBox);
    YCornerL = new QLabel(tr("YCorner"), propsBox);
    worldwidthL = new QLabel(tr("World Width"), propsBox);
    worldheightL = new QLabel(tr("World Height"), propsBox);
    outheightE = new QLineEdit(propsBox);
    outwidthE = new QLineEdit(propsBox);
    XCornerE = new QLineEdit(propsBox);
    YCornerE = new QLineEdit(propsBox);
    worldwidthE = new QLineEdit(propsBox);
    worldheightE = new QLineEdit(propsBox);
    saveImagePush = new QPushButton(tr("Save Image"), propsBox);
    pspacer1 = new QSpacerItem(0, 12);
    pspacer2 = new QSpacerItem(0, 14);
    pspacer3 = new QSpacerItem(15, 30);
    pspacer4 = new QSpacerItem(20, 60);
    pspacer5 = new QSpacerItem(20, 15);

//    outheightE->setFixedWidth(100);
//    outwidthE->setFixedWidth(100);
//    XCornerE->setFixedWidth(100);
//    YCornerE->setFixedWidth(100);
//    worldwidthE->setFixedWidth(100);
//    worldheightE->setFixedWidth(100);

//    outheightE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    outwidthE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    XCornerE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    YCornerE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    worldwidthE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
//    worldheightE->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

    saveImagePush->setFixedHeight(25);
    propsBoxOverallLayout = new QVBoxLayout(propsBox);
    propsBoxLayout = new QHBoxLayout();
    propseditStack = new QVBoxLayout();
    propslabelStack = new QVBoxLayout();
    savePushLayout = new QHBoxLayout();

    outheightE->setValidator(dimValidate);
    outwidthE->setValidator(dimValidate);
    XCornerE->setValidator(doubleValidate);
    YCornerE->setValidator(doubleValidate);
    worldwidthE->setValidator(doubleValidate);
    worldheightE->setValidator(doubleValidate);

    outheightE->setFixedWidth(100);
    outwidthE->setFixedWidth(100);
    XCornerE->setFixedWidth(100);
    YCornerE->setFixedWidth(100);
    worldwidthE->setFixedWidth(100);
    worldheightE->setFixedWidth(100);

    saveImagePush->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
    saveImagePush->setFixedWidth(150);

    propslabelStack->addWidget(XCornerL);
    propslabelStack->addWidget(YCornerL);
    propslabelStack->addWidget(worldwidthL);
    propslabelStack->addWidget(worldheightL);
    propslabelStack->addItem(pspacer1);
    propslabelStack->addWidget(outwidthL);
    propslabelStack->addWidget(outheightL);

    propslabelStack->setAlignment(XCornerL, Qt::AlignLeft);
    propslabelStack->setAlignment(YCornerL, Qt::AlignLeft);
    propslabelStack->setAlignment(worldwidthL, Qt::AlignLeft);
    propslabelStack->setAlignment(worldheightL, Qt::AlignLeft);
    propslabelStack->setAlignment(outwidthL, Qt::AlignLeft);
    propslabelStack->setAlignment(outheightL, Qt::AlignLeft);

    propseditStack->addWidget(XCornerE);
    propseditStack->addWidget(YCornerE);
    propseditStack->addWidget(worldwidthE);
    propseditStack->addWidget(worldheightE);
    propseditStack->addItem(pspacer2);
    propseditStack->addWidget(outwidthE);
    propseditStack->addWidget(outheightE);

    //propsBoxLayout->addItem(pspacer3);
    propsBoxLayout->addLayout(propslabelStack);
    propsBoxLayout->addLayout(propseditStack);
    propsBoxLayout->addItem(pspacer4);

    //savePushLayout->addWidget(saveImagePush);
    //savePushLayout->addItem(pspacer5);

    propsBoxOverallLayout->addLayout(propsBoxLayout);
    //propsBoxOverallLayout->addItem(pspacer3);
    propsBoxOverallLayout->addWidget(saveImagePush);
    propsBoxOverallLayout->setAlignment(saveImagePush, Qt::AlignRight);

    // DISP SUBELEMENTS
    disp = new Display(200, displayWidget);
    updatePreview = new QPushButton(tr("Update Preview"), this);
    dispLayout = new QVBoxLayout(displayWidget);
    dispLayout->addWidget(disp);
    dispLayout->addWidget(updatePreview);

    // CONNECT SIGNALS & SLOTS
    connect(updatePreview, SIGNAL(clicked()), this, SLOT(updatePreviewDisplay()));
    connect(colorwheelSel, SIGNAL(currentIndexChanged(int)), c, SLOT(setCurrent(int)));
    connect(functionSel, SIGNAL(currentIndexChanged(int)), this, SLOT(changeFunction(int)));
    connect(numtermsE, SIGNAL(textChanged(QString)), this, SLOT(changeMaxTerms(QString)));
    connect(currtermE, SIGNAL(valueChanged(int)), this, SLOT(updateTerms(int)));

    connect(outwidthE, SIGNAL(textChanged(QString)), this, SLOT(changeOWidth(QString)));
    connect(outheightE, SIGNAL(textChanged(QString)), this, SLOT(changeOHeight(QString)));
    connect(worldwidthE, SIGNAL(textChanged(QString)), this, SLOT(changeWorldWidth(QString)));
    connect(worldheightE, SIGNAL(textChanged(QString)), this, SLOT(changeWorldHeight(QString)));
    connect(XCornerE, SIGNAL(textChanged(QString)), this, SLOT(changeXCorner(QString)));
    connect(YCornerE, SIGNAL(textChanged(QString)), this, SLOT(changeYCorner(QString)));

    connect(nE, SIGNAL(textChanged(QString)), this, SLOT(changeN(QString)));
    connect(mE, SIGNAL(textChanged(QString)), this, SLOT(changeM(QString)));
    connect(rE, SIGNAL(textChanged(QString)), this, SLOT(changeR(QString)));
    connect(aE, SIGNAL(textChanged(QString)), this, SLOT(changeA(QString)));
    connect(scalerE, SIGNAL(textChanged(QString)), this, SLOT(changeScaleR(QString)));
    connect(scaleaE, SIGNAL(textChanged(QString)), this, SLOT(changeScaleA(QString)));

    connect(saveImagePush, SIGNAL(clicked()), this, SLOT(saveImageStart()));
    connect(loadButton, SIGNAL(clicked()), this, SLOT(loadFunction()));
    connect(saveButton, SIGNAL(clicked()), this, SLOT(saveFunction()));

    // SET DEFAULTS
    refreshTerms();
    scalerE->setText(QString::number(f->scaleR()));
    scaleaE->setText(QString::number(f->scaleA()));

    outwidthE->setText(QString::number(settings::OWidth));
    outheightE->setText(QString::number(settings::OHeight));
    worldwidthE->setText(QString::number(settings::Width));
    worldheightE->setText(QString::number(settings::Height));
    XCornerE->setText(QString::number(settings::XCorner));
    YCornerE->setText(QString::number(settings::YCorner));

    functionSel->setCurrentIndex(0);    //set up current function
    colorwheelSel->setCurrentIndex(7);


    // FINALIZE WINDOW
    setFixedSize(sizeHint());
    setWindowTitle(tr("Wallpaper Generation"));
}
コード例 #12
0
ファイル: choiceview.cpp プロジェクト: clee/runcible
void ChoiceView::pageUp() {
    if (_offset >= 10) {
        _offset -= 10;
        refreshLabels();
    }
}
コード例 #13
0
ファイル: choiceview.cpp プロジェクト: clee/runcible
void ChoiceView::pageDown() {
    if (_offset < _choices.size() - 10) {
        _offset += 10;
        refreshLabels();
    }
}