Example #1
0
void JBlockerMainWindow::slt_loadingStart()
{
    this->statusBar()->showMessage(tr("LOADING MESSAGES ..."));
    // QMessageBox::information(this, QString(), QString("PROGRAM NEED TO LOAD MESSAGES"), QMessageBox::Ok);
    /* Create dialog */
    QDialog dialog;
    dialog.setWindowTitle(tr("Account Selection"));
    QHBoxLayout* layout = new QHBoxLayout();
    /* Label for dialog */
    QLabel* dialogLabel = new QLabel(tr("Select An Account:"));
    layout->addWidget(dialogLabel, 0, Qt::AlignHCenter);
    /* Combo box for selecting account */
    QComboBox* accountComboBox = new QComboBox();
    accountComboBox->setFixedWidth(280);
    /* Get account name list from message core */
    accountComboBox->addItems(p_messageCore->getAccountNameList());
    layout->addWidget(accountComboBox, 0, Qt::AlignHCenter);
    /* Button for dialog */
    QPushButton* dialogButton = new QPushButton(tr("Confirm"));
    layout->addWidget(dialogButton, 0, Qt::AlignHCenter);
    dialog.setLayout(layout);
    QObject::connect(dialogButton, SIGNAL(clicked()), &dialog, SLOT(accept()));
    dialog.exec();
    if(dialog.result())
    {
        /* Set selected account id */
        p_messageCore->setSelectedAccountId(accountComboBox->currentIndex());
    }

    this->statusBar()->addPermanentWidget(p_progressBar, 0);
    p_progressBar->setValue(0);
    p_progressBar->show();
    /* Core runs */
    p_messageCore->run();
}
Example #2
0
QWidget *BackgroundAction::createWidget(QWidget *parent)
{
    QComboBox *comboBox = new QComboBox(parent);
    comboBox->setFixedWidth(42);

    for (int i = 0; i < colors().count(); ++i) {
        comboBox->addItem(tr(""));
        comboBox->setItemIcon(i, iconForColor((colors().at(i))));
    }

    comboBox->setCurrentIndex(0);
    connect(comboBox, SIGNAL(currentIndexChanged(int)), SLOT(emitBackgroundChanged(int)));

    comboBox->setProperty("hideborder", true);
    return comboBox;
}
Example #3
0
KeyBinder::KeyBinder(QWidget * parent, const QString & helpText, const QString & defaultText, const QString & resetButtonText) : QWidget(parent)
{
    this->defaultText = defaultText;
    enableSignal = false;

    // Two-column tab layout
    QHBoxLayout * pageKeysLayout = new QHBoxLayout(this);
    pageKeysLayout->setSpacing(0);
    pageKeysLayout->setContentsMargins(0, 0, 0, 0);

    // Table for category list
    QVBoxLayout * catListContainer = new QVBoxLayout();
    catListContainer->setContentsMargins(10, 10, 10, 10);
    catList = new QListWidget();
    catList->setFixedWidth(180);
    catList->setStyleSheet("QListWidget::item { font-size: 14px; } QListWidget:hover { border-color: #F6CB1C; } QListWidget::item:selected { background: #150A61; color: yellow; }");
    catList->setFocusPolicy(Qt::NoFocus);
    connect(catList, SIGNAL(currentRowChanged(int)), this, SLOT(changeBindingsPage(int)));
    catListContainer->addWidget(catList);
    pageKeysLayout->addLayout(catListContainer);

    // Reset all binds button
    if (!resetButtonText.isEmpty())
    {
        QPushButton * btnResetAll = new QPushButton(resetButtonText);
        catListContainer->addWidget(btnResetAll);
        btnResetAll->setFixedHeight(40);
        catListContainer->setStretch(1, 0);
        catListContainer->setSpacing(10);
        connect(btnResetAll, SIGNAL(clicked()), this, SIGNAL(resetAllBinds()));
    }

    // Container for pages of key bindings
    QWidget * bindingsPagesContainer = new QWidget();
    QVBoxLayout * rightLayout = new QVBoxLayout(bindingsPagesContainer);

    // Scroll area for key bindings
    QScrollArea * scrollArea = new QScrollArea();
    scrollArea->setContentsMargins(0, 0, 0, 0);
    scrollArea->setWidget(bindingsPagesContainer);
    scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
    scrollArea->setWidgetResizable(true);
    scrollArea->setFrameShape(QFrame::NoFrame);
    scrollArea->setStyleSheet("background: #130F2A;");

    // Add key binding pages to bindings tab
    pageKeysLayout->addWidget(scrollArea);
    pageKeysLayout->setStretch(1, 1);

    // Custom help text
    QLabel * helpLabel = new QLabel();
    helpLabel->setText(helpText);
    helpLabel->setStyleSheet("color: #130F2A; background: #F6CB1C; border: solid 4px #F6CB1C; border-radius: 10px; padding: auto 20px;");
    helpLabel->setFixedHeight(24);
    rightLayout->addWidget(helpLabel, 0, Qt::AlignCenter);

    // Category list and bind table row heights
    const int rowHeight = 20;
    QSize catSize, headerSize;
    catSize.setHeight(36);
    headerSize.setHeight(24);

    // Category list header
    QListWidgetItem * catListHeader = new QListWidgetItem(tr("Category"));
    catListHeader->setSizeHint(headerSize);
    catListHeader->setFlags(Qt::NoItemFlags);
    catListHeader->setForeground(QBrush(QColor("#130F2A")));
    catListHeader->setBackground(QBrush(QColor("#F6CB1C")));
    catListHeader->setTextAlignment(Qt::AlignCenter);
    catList->addItem(catListHeader);

    // Populate
    bindingsPages = new QHBoxLayout();
    bindingsPages->setContentsMargins(0, 0, 0, 0);
    rightLayout->addLayout(bindingsPages);
    QWidget * curPage = NULL;
    QVBoxLayout * curLayout = NULL;
    QTableWidget * curTable = NULL;
    bool bFirstPage = true;
    selectedBindTable = NULL;
    bindComboBoxCellMappings = new QHash<QObject *, QTableWidgetItem *>();
    bindCellComboBoxMappings = new QHash<QTableWidgetItem *, QComboBox *>();
    for (int i = 0; i < BINDS_NUMBER; i++)
    {
        if (cbinds[i].category != NULL)
        {
            // Add stretch at end of previous layout
            if (curLayout != NULL) curLayout->insertStretch(-1, 1);

            // Category list item
            QListWidgetItem * catItem = new QListWidgetItem(HWApplication::translate("binds (categories)", cbinds[i].category));
            catItem->setSizeHint(catSize);
            catList->addItem(catItem);

            // Create new page
            curPage = new QWidget();
            curLayout = new QVBoxLayout(curPage);
            curLayout->setSpacing(2);
            bindingsPages->addWidget(curPage);
            if (!bFirstPage) curPage->setVisible(false);
        }

        // Description
        if (cbinds[i].description != NULL)
        {
            QLabel * desc = new QLabel(HWApplication::translate("binds (descriptions)", cbinds[i].description));
            curLayout->addWidget(desc, 0);
            QFrame * divider = new QFrame();
            divider->setFrameShape(QFrame::HLine);
            divider->setFrameShadow(QFrame::Plain);
            curLayout->addWidget(divider, 0);
        }

        // New table
        if (cbinds[i].category != NULL || cbinds[i].description != NULL)
        {
            curTable = new QTableWidget(0, 2);
            curTable->verticalHeader()->setVisible(false);
            curTable->horizontalHeader()->setVisible(false);
            curTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
            curTable->verticalHeader()->setDefaultSectionSize(rowHeight);
            curTable->setShowGrid(false);
            curTable->setStyleSheet("QTableWidget { border: none; } ");
            curTable->setSelectionBehavior(QAbstractItemView::SelectRows);
            curTable->setSelectionMode(QAbstractItemView::SingleSelection);
            curTable->setFocusPolicy(Qt::NoFocus);
            connect(curTable, SIGNAL(itemSelectionChanged()), this, SLOT(bindSelectionChanged()));
            connect(curTable, SIGNAL(itemClicked(QTableWidgetItem *)), this, SLOT(bindCellClicked(QTableWidgetItem *)));
            curLayout->addWidget(curTable, 0);
        }

        // Hidden combo box
        QComboBox * comboBox = CBBind[i] = new QComboBox(curTable);
        comboBox->setModel((QAbstractItemModel*)DataManager::instance().bindsModel());
        comboBox->setVisible(false);
        comboBox->setFixedWidth(200);

        // Table row
        int row = curTable->rowCount();
        QTableWidgetItem * nameCell = new QTableWidgetItem(HWApplication::translate("binds", cbinds[i].name));
        nameCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        curTable->insertRow(row);
        curTable->setItem(row, 0, nameCell);
        QTableWidgetItem * bindCell = new QTableWidgetItem(comboBox->currentText());
        bindCell->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        curTable->setItem(row, 1, bindCell);
        curTable->resizeColumnsToContents();
        curTable->setFixedHeight(curTable->verticalHeader()->length() + 10);

        // Updates the text in the table cell
        connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(bindChanged(const QString &)));

        // Map combo box and that row's cells to each other
        bindComboBoxCellMappings->insert(comboBox, bindCell);
        bindCellComboBoxMappings->insert(nameCell, comboBox);
        bindCellComboBoxMappings->insert(bindCell, comboBox);
    }
Example #4
0
void SCgWindow::createToolBar()
{
    mToolBar = new QToolBar(this);

    mToolBar->setIconSize(QSize(32, 32));

    QActionGroup* group = new QActionGroup(mToolBar);

    // Select mode
    QAction *action = new QAction(findIcon("tool-select.png"), tr("Selection mode"), mToolBar);
    action->setCheckable(true);
    action->setChecked(true);
    action->setShortcut(QKeySequence(tr("1", "Selection mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Select] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectMode()));

    //Pair creation mode
    action = new QAction(findIcon("tool-pair.png"), tr("Pair creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("2", "Pair creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Pair] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onPairMode()));

    //Bus creation mode
    action = new QAction(findIcon("tool-bus.png"), tr("Bus creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("3", "Bus creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Bus] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onBusMode()));

    //Contour creation mode
    action = new QAction(findIcon("tool-contour.png"), tr("Contour creation mode"), mToolBar);
    action->setCheckable(true);
    action->setShortcut(QKeySequence(tr("4", "Contour creation mode")));
    group->addAction(action);
    mToolBar->addAction(action);
    mMode2Action[SCgScene::Mode_Contour] = action;
    connect(action, SIGNAL(triggered()), this, SLOT(onContourMode()));
    //
    mToolBar->addSeparator();
    //

    // align group button
    QToolButton *alignButton = new QToolButton(mToolBar);
    alignButton->setIcon(findIcon("tool-align.png"));
    alignButton->setPopupMode(QToolButton::InstantPopup);
    mToolBar->addWidget(alignButton);

    //Grid alignment
    action = new QAction(findIcon("tool-align-grid.png"), tr("Grid alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("5", "Grid alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onGridAlignment()));

    // tuple alignment
    action = new QAction(findIcon("tool-align-tuple.png"), tr("Tuple alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("6", "Tuple alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onTupleAlignment()));

    //Vertical alignment
    action = new QAction(findIcon("tool-align-vert.png"), tr("Vertical alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("7", "Vertical alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onVerticalAlignment()));

    //Horizontal alignment
    action = new QAction(findIcon("tool-align-horz.png"), tr("Horizontal alignment"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("8", "Horizontal alignment")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onHorizontalAlignment()));

    // Energy-based layout
    action = new QAction(findIcon("tool-align-energy.png"), tr("Energy-based layout"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("9", "Energy-based layout")));
    alignButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onEnergyBasedLayout()));


    // selection group button
    QToolButton *selectButton = new QToolButton(mToolBar);
    selectButton->setIcon(findIcon("tool-select-group.png"));
    selectButton->setPopupMode(QToolButton::InstantPopup);
    mToolBar->addWidget(selectButton);

    // input/output selection
    action = new QAction(findIcon("tool-select-inout.png"), tr("Select input/output"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectInputOutput()));

    // sbgraph selection
    action = new QAction(findIcon("tool-select-subgraph.png"), tr("Select subgraph"), mToolBar);
    action->setCheckable(false);
    selectButton->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onSelectSubgraph()));

    mToolBar->addSeparator();

    action = new QAction(findIcon("tool-export-image.png"), tr("Export image"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("0", "Export image")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onExportImage()));

    action = new QAction(findIcon("tool-print.png"), tr("Print"), mToolBar);
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("0", "Print")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onPrint()));

    //
    mToolBar->addSeparator();
    //Scale combobox
    QComboBox* b = new QComboBox(mToolBar);
    b->setFixedWidth(55);
    b->setEditable(true);
    b->setInsertPolicy(QComboBox::NoInsert);
    b->addItems(SCgWindow::mScales);
    b->setCurrentIndex(mScales.indexOf("100"));
    mZoomFactorLine = b->lineEdit();
    mZoomFactorLine->setInputMask("D90%");
    mToolBar->addWidget(b);
    connect(mZoomFactorLine, SIGNAL(textChanged(const QString&)), mView, SLOT(setScale(const QString&)));
    connect(mView, SIGNAL(scaleChanged(qreal)), this, SLOT(onViewScaleChanged(qreal)));
    //
    //Zoom in
    //action = new QAction(findIcon("tool-zoom-in.png"), tr("Zoom in"), mToolBar);
    action = new QAction("+",mToolBar);
    action->setToolTip(tr("Zoom in"));
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("+", "Zoom in")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomIn()));

    //slider scale
    mZoomSlider = new QSlider();
    mZoomSlider->setFixedWidth(40);
    mZoomSlider->setSizeIncrement(25,180/25);
    mZoomSlider->setFixedHeight(180);
    mZoomSlider->setToolTip(tr("Scale"));
    mZoomSlider->setMinimum(mZoomSliderMinValue);
    mZoomSlider->setValue(100);
    mZoomSlider->setMaximum(mZoomSliderMaxValue);
    mToolBar->addWidget(mZoomSlider);
    connect(mZoomSlider,SIGNAL(valueChanged(int)),this,SLOT(onmZoomSliderMove(int)));


    //Zoom out
  //  action = new QAction(findIcon("tool-zoom-out.png"), tr("Zoom out"), mToolBar);
    action = new QAction("-", mToolBar);
    action->setToolTip(tr("Zoom out"));
    action->setCheckable(false);
    action->setShortcut(QKeySequence(tr("-", "Zoom out")));
    mToolBar->addAction(action);
    connect(action, SIGNAL(triggered()), this, SLOT(onZoomOut()));

    mToolBar->setWindowTitle(tr("SCg Tools"));
    mToolBar->setObjectName("SCgMainToolBar");

    //! @bug toolbar state is not saved
    mToolBar->setMovable(false);
}
QBoxLayout *
View::focusPanelLayout()
{
    /*
     *  Focus mode when not in live view.
     */
    QLabel *focusModeLabel = new QLabel( tr("Focus mode:") );
    focusMode = new FocusMode();
    focusMode->setStatusTip( tr("Focus mode when not in live view") );
    QObject::connect(
	focusMode, SIGNAL(propertyChanged(int,int)),
	this, SIGNAL(propertyChanged(int,int)));

    /*
     *  Focus mode when in live view.
     */
    QLabel *focusModeLiveLabel = new QLabel( tr("Live view:") );
    focusModeLive = new QComboBox();
    focusModeLive->setMaxCount( Map::MAX_FocusMode );
    focusModeLive->setStatusTip( tr("Focus mode when in live view") );
    focusModeLive->setFixedWidth( 80 );
    setEvfAFList( camera );
    QObject::connect(
	focusModeLive, SIGNAL(activated(int)),
	this, SLOT(toEvfAFValue(int)) );

    /*
     *  Auto focus button.
     */
    QLabel *focusLabel = new QLabel( tr("Focus:  ") );
    QToolButton *focusButton = new QToolButton();
    focusButton->setAutoRaise( true );
    focusButton->setIcon( QIcon(":/Resources/Misc/button.png") );
    focusButton->setIconSize( QSize(22, 22) );
    focusButton->setStatusTip( tr("Auto focus") );
    QObject::connect(
	focusButton, SIGNAL(pressed()),
	this, SLOT(autoFocusInitiated()) );
    QObject::connect(
	focusButton, SIGNAL(released()),
	this, SLOT(autoFocusDiscontinued()) );

    /*
     *  Focus map to show on live view.
     */
    QLabel *focusMapLabel = new QLabel( tr("Focus map:") );
    QComboBox *focusMapComboBox = new QComboBox();
    focusMapComboBox->setStatusTip( tr("Capture series of images for constructing focus map") );
    focusMapComboBox->addItem( tr("Disabled") );
    focusMapComboBox->addItem( tr("Enabled") );
    focusMapComboBox->setFixedWidth( 80 );
    focusMapComboBox->setCurrentIndex( 0 );
    camera->setFocusMapSetting( 0 );
    QObject::connect(
	focusMapComboBox, SIGNAL(activated(int)),
	this, SLOT(setFocusMap(int)) );

    /*
     *  Depth of field (DOF) preview.
     */
    QLabel *dofPreviewLabel = new QLabel( tr("DOF preview:") );
    QComboBox *dofPreviewComboBox = new QComboBox();
    dofPreviewComboBox->addItem( tr("Disabled") );
    dofPreviewComboBox->addItem( tr("Enabled") );
    dofPreviewComboBox->setFixedWidth( 80 );
    dofPreviewComboBox->setCurrentIndex( 0 );
    QObject::connect(
	dofPreviewComboBox, SIGNAL(activated(int)),
	this, SLOT(setDOFPreview(int)) );

    /*
     *  Focus adjustment buttons.
     */
    const bool flat = false;
    const int width = 22;
    const int height = 16;
    const int buttonHeight = 23;
    const int latency = 333;
    QLabel *focusAdjustmentLabel = new QLabel();
    focusAdjustmentLabel->setText( tr("Focus adjustment:") );

    /*
     *  Near focus: <<<
     */
    QPushButton *focusNear3Button = new QPushButton();
    focusNear3Button->setStatusTip( tr("Near focus: large movement") );
    focusNear3Button->setIcon( QIcon(":/Resources/Focus/arrow-left3.png") );
    focusNear3Button->setIconSize( QSize(width, height) );
    focusNear3Button->setFixedHeight( buttonHeight );
    focusNear3Button->setFlat( flat );
    focusNear3Button->setAutoRepeat( true );
    focusNear3Button->setAutoRepeatDelay( latency );
    focusNear3Button->setAutoRepeatInterval( latency );

    /*
     *  Near focus: <<
     */
    QPushButton *focusNear2Button = new QPushButton();
    focusNear2Button->setStatusTip( tr("Near focus: medium movement") );
    focusNear2Button->setIcon( QIcon(":/Resources/Focus/arrow-left2.png") );
    focusNear2Button->setIconSize( QSize(width, height) );
    focusNear2Button->setFixedHeight( buttonHeight );
    focusNear2Button->setFlat( flat );
    focusNear2Button->setAutoRepeat( true );
    focusNear2Button->setAutoRepeatDelay( latency );
    focusNear2Button->setAutoRepeatInterval( latency );

    /*
     *  Near focus: <
     */
    QPushButton *focusNear1Button = new QPushButton();
    focusNear1Button->setStatusTip( tr("Near focus: small movement") );
    focusNear1Button->setIcon( QIcon(":/Resources/Focus/arrow-left1.png") );
    focusNear1Button->setIconSize( QSize(width, height) );
    focusNear1Button->setFixedHeight( buttonHeight );
    focusNear1Button->setFlat( flat );
    focusNear1Button->setAutoRepeat( true );
    focusNear1Button->setAutoRepeatDelay( latency );
    focusNear1Button->setAutoRepeatInterval( latency );

    /*
     *  Far focus: >
     */
    QPushButton *focusFar1Button = new QPushButton();
    focusFar1Button->setStatusTip( tr("Far focus: small movement") );
    focusFar1Button->setIcon( QIcon(":/Resources/Focus/arrow-right1.png") );
    focusFar1Button->setIconSize( QSize(width, height) );
    focusFar1Button->setFlat( flat );
    focusFar1Button->setAutoRepeat( true );
    focusFar1Button->setAutoRepeatDelay( latency );
    focusFar1Button->setAutoRepeatInterval( latency );

    /*
     *  Far focus: >>
     */
    QPushButton *focusFar2Button = new QPushButton();
    focusFar2Button->setStatusTip( tr("Far focus: medium movement") );
    focusFar2Button->setIcon( QIcon(":/Resources/Focus/arrow-right2.png") );
    focusFar2Button->setIconSize( QSize(width, height) );
    focusFar2Button->setFlat( flat );
    focusFar2Button->setAutoRepeat( true );
    focusFar2Button->setAutoRepeatDelay( latency );
    focusFar2Button->setAutoRepeatInterval( latency );

    /*
     *  Far focus: >>>
     */
    QPushButton *focusFar3Button = new QPushButton();
    focusFar3Button->setStatusTip( tr("Far focus: large movement") );
    focusFar3Button->setIcon( QIcon(":/Resources/Focus/arrow-right3.png") );
    focusFar3Button->setIconSize( QSize(width, height) );
    focusFar3Button->setFlat( flat );
    focusFar3Button->setAutoRepeat( true );
    focusFar3Button->setAutoRepeatDelay( latency );
    focusFar3Button->setAutoRepeatInterval( latency );

    QButtonGroup *focusChosen = new QButtonGroup();
    focusChosen->addButton( focusNear3Button, kEdsEvfDriveLens_Near3 );
    focusChosen->addButton( focusNear2Button, kEdsEvfDriveLens_Near2 );
    focusChosen->addButton( focusNear1Button, kEdsEvfDriveLens_Near1 );
    focusChosen->addButton( focusFar1Button, kEdsEvfDriveLens_Far1 );
    focusChosen->addButton( focusFar2Button, kEdsEvfDriveLens_Far2 );
    focusChosen->addButton( focusFar3Button, kEdsEvfDriveLens_Far3 );
    focusChosen->setExclusive( false );
    QObject::connect(
	focusChosen, SIGNAL(buttonClicked(int)),
	this, SIGNAL(focusAdjustment(int)) );

    /*
     *  Final layout.
     */
    QVBoxLayout *focusButtonLayout = new QVBoxLayout();
    focusButtonLayout->addStretch( 1 );
    focusButtonLayout->addWidget( focusLabel );
    focusButtonLayout->addWidget( focusButton );
    focusButtonLayout->addStretch( 1 );

    QGridLayout *settingsLayout = new QGridLayout();
    settingsLayout->addWidget( focusModeLabel,	   0, 0 );
    settingsLayout->addWidget( focusMode,	   1, 0 );
    settingsLayout->addWidget( focusModeLiveLabel, 0, 2 );
    settingsLayout->addWidget( focusModeLive,      1, 2 );
    settingsLayout->addWidget( focusMapLabel,	   2, 0 );
    settingsLayout->addWidget( focusMapComboBox,   3, 0 );
    settingsLayout->addWidget( dofPreviewLabel,	   2, 2 );
    settingsLayout->addWidget( dofPreviewComboBox,    3, 2 );
    settingsLayout->addLayout( focusButtonLayout,  0, 4, 4, 1 );
    settingsLayout->setColumnStretch( 1, 1 );
    settingsLayout->setColumnStretch( 3, 1 );

    QHBoxLayout *focusAdjustmentLayout = new QHBoxLayout();
    focusAdjustmentLayout->addWidget( focusNear3Button );
    focusAdjustmentLayout->addWidget( focusNear2Button );
    focusAdjustmentLayout->addWidget( focusNear1Button );
    focusAdjustmentLayout->addWidget( focusFar1Button );
    focusAdjustmentLayout->addWidget( focusFar2Button );
    focusAdjustmentLayout->addWidget( focusFar3Button );

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addLayout( settingsLayout );
    layout->addWidget( focusAdjustmentLabel );
    layout->addLayout( focusAdjustmentLayout );
    layout->setContentsMargins( 0, 5, 0, 5 );

    return( layout );
}
MatchWindow::MatchWindow () :
	closed (false)
{
	centralWidget = new QWidget (this);
	this->setCentralWidget(centralWidget);

	mainLayout = new QVBoxLayout (centralWidget);
	centralWidget->setLayout (mainLayout);

	imagesContainer = new QWidget (centralWidget);
	imagesContainer->setLayout (new QHBoxLayout());
	mainLayout->addWidget (imagesContainer);

	glcanvas = new RenderWidget (MatchWindow::defaultImageWidth, MatchWindow::defaultImageHeight, centralWidget);

	imageDisplay = new ImageDisplay (
		QSize(MatchWindow::defaultImageWidth, MatchWindow::defaultImageHeight),
		glcanvas,
		centralWidget);
	imagesContainer->layout()->addWidget (imageDisplay);

	vmap = new VectorMap ();
	vmap->loadAll (VECTOR_MAP_PATH);

	// glcanvas must be added in widget hierarchy
	imagesContainer->layout()->addWidget (glcanvas);
	insertObjects (glcanvas, vmap);

	/* Poor man's toolbar */
	QWidget *btnBar = new QWidget (centralWidget);
	btnBar->setLayout(new QHBoxLayout());
	centralWidget->layout()->addWidget(btnBar);

	QPushButton *captureBtn = new QPushButton ("Capture", centralWidget);
	captureBtn->setFixedWidth(120);
	btnBar->layout()->addWidget(captureBtn);
	QObject::connect (captureBtn, SIGNAL(clicked()), this, SLOT(captureClicked()));

	QPushButton *searchBtn = new QPushButton ("Search", centralWidget);
	searchBtn->setFixedWidth(120);
	btnBar->layout()->addWidget(searchBtn);
	QObject::connect (searchBtn, SIGNAL(clicked()), this, SLOT(searchButtonClicked()));

	QPushButton *resetBtn = new QPushButton ("Reset", centralWidget);
	resetBtn->setFixedWidth(120);
	btnBar->layout()->addWidget(resetBtn);
	QObject::connect (resetBtn, SIGNAL(clicked()), this, SLOT(resetButtonClicked()));

	QComboBox *imageTypeSelector = new QComboBox (centralWidget);
	imageTypeSelector->setFixedWidth(210);
	imageTypeSelector->insertItem(ImageDisplay::ImageTypeRgb, "RGB");
	imageTypeSelector->insertItem(ImageDisplay::ImageTypeGray, "Grayscale");
	imageTypeSelector->insertItem(ImageDisplay::ImageTypeGrayProcessed, "Processed Grayscale");
	QObject::connect (imageTypeSelector, SIGNAL(currentIndexChanged(int)), imageDisplay, SLOT(changeImageType(int)));
	btnBar->layout()->addWidget(imageTypeSelector);

	QCheckBox *toggleMap = new QCheckBox ("Show Map", centralWidget);
	QObject::connect (toggleMap, SIGNAL(toggled(bool)), imageDisplay, SLOT(toggleMapProjection(bool)));
	toggleMap->setChecked(true);
	btnBar->layout()->addWidget (toggleMap);

	QWidget *poseBox = new QWidget (centralWidget);
	poseBox->setLayout(new QHBoxLayout());
	mainLayout->addWidget(poseBox);

	QWidget *posContainer = new QWidget (centralWidget);
	posContainer->setLayout(new QVBoxLayout());
	posContainer->layout()->addWidget(new QLabel("Position"));
	posContainer->layout()->addWidget(wposx = new LabelWithTextBox("X"));
	posContainer->layout()->addWidget(wposy = new LabelWithTextBox("Y"));
	posContainer->layout()->addWidget(wposz = new LabelWithTextBox("Z"));
	QObject::connect (wposx, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wposy, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wposz, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));

	QWidget *oriContainer = new QWidget (centralWidget);
	oriContainer->setLayout (new QVBoxLayout());
	oriContainer->layout()->addWidget(new QLabel("Orientation"));
	oriContainer->layout()->addWidget(wroll = new LabelWithTextBox("Bank"));
	oriContainer->layout()->addWidget(wpitch = new LabelWithTextBox("Elevation"));
	oriContainer->layout()->addWidget(wyaw = new LabelWithTextBox("Heading"));
	QObject::connect (wroll, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wpitch, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));
	QObject::connect (wyaw, SIGNAL(doPoseChange(QString,int)),
		this, SLOT(PoseChangeManual(QString,int)));

	poseBox->layout()->addWidget(posContainer);
	poseBox->layout()->addWidget(oriContainer);

	cameraFix = new PointSolver (vmap, glcanvas, MatchWindow::defaultImageWidth, MatchWindow::defaultImageHeight);

	return;
}