Ejemplo n.º 1
0
int QStackedWidgetProto::insertWidget(int index, QWidget *widget)
{
  QStackedWidget *item = qscriptvalue_cast<QStackedWidget*>(thisObject());
  if (item)
    return item->insertWidget(index, widget);
  return 0;
}
Ejemplo n.º 2
0
static void recreate_instruments_widget_from_state(vector_t *state){
  QStackedWidget* tabs = instruments_widget->tabs;

  while(tabs->count()>0)
    tabs->removeWidget(tabs->currentWidget());

  //vector_t *names = (vector_t*)state->elements[0];
  vector_t *pages = (vector_t*)state->elements[0];

  for(int i=pages->num_elements-1; i>=0; i--){
    QWidget *page = (QWidget*)pages->elements[i];
    tabs->insertWidget(0,page);//,(const char*)names->elements[i]);
  }

  tabs->setCurrentWidget((QWidget*)state->elements[1]);
}
/*
 *  Exposure bracketing page.
 *
 *  Purpose:
 *  1. selecting best shot, and
 *  2. increase dynamic range (HDR).
 *
 *  For both of these purposes, it is best to maintain a fixed aperture,
 *  focal distance, focal length, ISO setting, subject distance, and white
 *  balance. That means Manual mode or Av mode, and no auto ISO, no auto
 *  white balance, no auto focus (or turn off auto focus once focus has
 *  been achieved when setting up the shot) and use a tripod if available
 *  (turn off image stabilization).
 *
 *  For purpose 2, want to take the frames as quickly as the exposure can
 *  be adjusted between images (to minimize movement of the subject).
 *  For static subjects, the exposure is usually adjusted by altering the
 *  shutter speed. For dynamic subjects, the exposure can be adjusted by
 *  altering the ISO (not yet implemented, but if shooting RAW this can
 *  be done in post-processing).
 */
QWidget *
MultiShot::getExposureBracketingPage()
{
    /*
     *  Settings.
     */
    const int MAX_Frames = 7; // range is 1 .. 2*MAX + 1

    QLabel *eFramesLabel = new QLabel( tr("Images:" ) );
    eFramesLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter );

    QStackedWidget *eFramesDisplay = new QStackedWidget();
    eFramesDisplay->setFont( QFont("Calibri", 12) );
    QLabel *eFramePage[MAX_Frames+1];
    for( int i = 0; i <= MAX_Frames; i++ ) {
	eFramePage[i] = new QLabel( eFramesDisplay );
	eFramePage[i]->setText( QString::number((2*i)+1) );
	eFramePage[i]->setAlignment( Qt::AlignLeft );
	eFramesDisplay->insertWidget( i, eFramePage[i] );
    }
    eFramesDisplay->setCurrentIndex( 0 );

    eFrames = new QSlider();
    eFrames->setCursor( QCursor(Qt::SizeHorCursor) );
    eFrames->setValue( 0 );
    eFrames->setMinimum( 0 );
    eFrames->setMaximum( MAX_Frames );
    eFrames->setPageStep( 1 );
    eFrames->setOrientation( Qt::Horizontal );
    eFrames->setTickPosition( QSlider::TicksBelow );
    eFrames->setTickInterval( 1 );
    QObject::connect(
	eFrames, SIGNAL(valueChanged(int)),
	eFramesDisplay, SLOT(setCurrentIndex(int)));

    QLabel *eIncrementLabel = new QLabel( tr("Increment:" ) );
    eIncrementLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter );

    QStackedWidget *eIncrementDisplay = new QStackedWidget();
    eIncrementDisplay->setFont( QFont("Calibri", 12) );
    for( int i = 0; i < 10; i++ ) {
	eIncrementPage[i] = new QLabel( eIncrementDisplay );
	eIncrementPage[i]->setAlignment( Qt::AlignLeft );
	eIncrementDisplay->insertWidget( i, eIncrementPage[i] );
    }
    eIncrementDisplay->setCurrentIndex( 0 );

    eIncrement = new QSlider();
    eIncrement->setCursor( QCursor(Qt::SizeHorCursor) );
    eIncrement->setValue( 0 );
    eIncrement->setMinimum( 0 );
    eIncrement->setPageStep( 1 );
    eIncrement->setOrientation( Qt::Horizontal );
    eIncrement->setTickPosition( QSlider::TicksBelow );
    eIncrement->setTickInterval( 1 );

    setIncrementPages();

    QObject::connect(
	eIncrement, SIGNAL(valueChanged(int)),
	eIncrementDisplay, SLOT(setCurrentIndex(int)));

    //QPushButton *autoButton = new QPushButton( tr("Auto") );

    eCompensation = new ExposureComp( camera, 5 );
    QObject::connect(
	eCompensation, SIGNAL(propertyChanged(int,int)),
	this, SIGNAL(propertyChanged(int,int)));
    QObject::connect(
	eFrames, SIGNAL(valueChanged(int)),
	eCompensation, SLOT(updateExposures(int)));
    QObject::connect(
	eIncrement, SIGNAL(valueChanged(int)),
	eCompensation, SLOT(updateIncrement(int)));

    /*
     *  Final layout.
     */
    QGridLayout *settingsLayout = new QGridLayout();
    settingsLayout->addWidget( eFramesLabel,	  0, 0 );
    settingsLayout->addWidget( eFrames,		  0, 1 );
    settingsLayout->addWidget( eFramesDisplay,	  0, 2 );
    settingsLayout->addWidget( eIncrementLabel,   1, 0 );
    settingsLayout->addWidget( eIncrement,	  1, 1 );
    settingsLayout->addWidget( eIncrementDisplay, 1, 2 );
    //settingsLayout->addWidget( autoButton,	  2, 1 );
    settingsLayout->setColumnStretch( 3, 1 );
    settingsLayout->setColumnMinimumWidth( 0, 100 );

    QGroupBox *settingsGroupBox = new QGroupBox( tr("Settings") );
    settingsGroupBox->setLayout( settingsLayout );

    QHBoxLayout *bracketingLayout = new QHBoxLayout();
    bracketingLayout->addSpacing( 35 );
    bracketingLayout->addWidget( eCompensation, 0, Qt::AlignLeft );

    QGroupBox *bracketingGroupBox =
	new QGroupBox( tr("Exposure compensation and bracketing") );
    bracketingGroupBox->setLayout( bracketingLayout );

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget( settingsGroupBox );
    layout->addWidget( bracketingGroupBox );
    layout->addStretch( 1 );

    QWidget *widget = new QWidget( this );
    widget->setLayout( layout );

    return( widget );
}
Ejemplo n.º 4
0
void interface::CreateWidgets(){
    QString name, type, title, wight, image, id, act;

    xmlItem childItem;
    xmlItem md          = xml.find(xml_root,md_metadata);
    xmlItem ifTabs      = xml.find(xml_root,md_tabs);
    xmlItem itActions   = xml.find(xml_root,md_actions);

    currentTab = 0;
    int idTab = 0;
    int idVal = 0;
    while (!ifTabs.isNull()){
        name = xml.attr(ifTabs,mda_name);
        type = xml.attr(ifTabs,mda_type);
        title = xml.attr(ifTabs,mda_title);

        QGridLayout *l = new QGridLayout(this);
        QTabWidget *root = new QTabWidget;

        l->addWidget(root);
        connect(root,SIGNAL(currentChanged(int)),this,SLOT(on_clicked_tab(int)));
        //—оздаем вкладки разделов
        childItem = xml.find(ifTabs,md_tab);

        while (!childItem.isNull()){
            name = xml.attr(childItem,mda_name);
            type = xml.attr(childItem,mda_type);
            title = xml.attr(childItem,mda_title);
            image = xml.attr(childItem,mda_image);
            QWidget *Tab = UIload.createWidget(type,root,name);
            Tab->setObjectName(name);
            QIcon ic(":/"+image);
            root->setIconSize(QSize(50,50));
            root->addTab(Tab,ic,title);

            QHBoxLayout *vb = new QHBoxLayout(Tab);

            QStackedWidget *stWidget = new QStackedWidget();
            listWindow.insert(idTab,stWidget);
            idTab++;
            //idVal = 0;

            // —оздаем левое меню
            xmlItem childrenItem = xml.find(childItem,md_left_menu,0);
            while (!childrenItem.isNull() && childrenItem.nodeName() == md_left_menu){
                name = xml.attr(childrenItem,mda_name);
                type = xml.attr(childrenItem,mda_type);
                title = xml.attr(childrenItem,mda_title);
                wight = xml.attr(childrenItem,mda_width);

                iisTaskPanel *tskPanel = new iisTaskPanel(Tab);
                if (!wight.isEmpty())
                    tskPanel->setMinimumWidth(wight.toInt());

                vb->addWidget(tskPanel,0);
                vb->setAlignment(tskPanel,Qt::AlignLeft);
                // √руппы меню
                tskPanel->layout()->setAlignment(Qt::AlignTop);
                xmlItem xmlGr = xml.find(childrenItem,md_group);
                while (!xmlGr.isNull()){
                    name = xml.attr(xmlGr,mda_name);
                    type = xml.attr(xmlGr,mda_type);
                    title = xml.attr(xmlGr,mda_title);


                    //QGroupBox *Gr = new QGroupBox(name,prev);
                    iisTaskBox *Gr = new iisTaskBox(title);
                    tskPanel->addWidget(Gr);
                    Gr->setObjectName(name);

                    //Ёлементы меню
                    xmlItem xmlValue = xml.find(xmlGr,md_value);
                    while (!xmlValue.isNull()){
                        name    = xml.attr(xmlValue,mda_name);
                        id      = xml.attr(xmlValue,mda_id);
                        title   = xml.attr(xmlValue,mda_title);
                        act     = xml.sText(xmlValue,md_comaction);

                        iisIconLabel *val = new iisIconLabel(title);
                        val->setObjectName(name);
                        connect(val,SIGNAL(clicked()),this,SLOT(on_clicked_item()));
                        Gr->addIconLabel(val);
                        list.insert(val,idVal);

                        xmlItem iact = xml.findId(itActions,"",act);
                        xmlItem iObj, iFrm;
                        if (!iact.isNull()){
                            QString idObj = xml.sText(iact,md_objectid);
                            xmlItem tmp =  xml.firstChild(md);
                            while (!tmp.isNull()){
                                iObj = xml.findId(tmp,"",idObj);
                                tmp = xml.nextSibling(tmp);
                                if (!iObj.isNull()) break;
                            }
                        }
                        if (!iObj.isNull()){
                            QString idFrm = xml.sText(iact,md_formid);
                            iObj = xml.find(iObj,md_forms);
                            iFrm = xml.findId(iObj,"",idFrm);
                            // —оздаем форму
                            QWidget *form =eng->OpenForm(iFrm);
                            if (form){
                                stWidget->insertWidget(idVal,form);
                                idVal++;
                            }
                        }

                        xmlValue = xml.nextSibling(xmlValue);
                    }

                    xmlGr = xml.nextSibling(xmlGr);
                }
                childrenItem = xml.nextSibling(childrenItem);
            }


            // ѕрава¤ панель
            childrenItem = xml.find(childItem,md_panel);
            while (!childrenItem.isNull()){
                name = xml.attr(childrenItem,mda_name);
                type = xml.attr(childrenItem,mda_type);
                title = xml.attr(childrenItem,mda_title);
                wight = xml.attr(childrenItem,mda_width);
                if (!wight.isEmpty())
                    stWidget->setMinimumWidth(wight.toInt());
                stWidget->setObjectName(name);
                stWidget->setFrameStyle(1);
                stWidget->setFrameShadow(QFrame::Raised);
                vb->addWidget(stWidget,2);

                childrenItem = xml.nextSibling(childrenItem);
            }
            childItem = xml.nextSibling(childItem);
        }
        ifTabs = xml.nextSibling(ifTabs);
    }

}