Example #1
0
void CAllImgProcGUI::initGUI()
{
   m_topTab = new QTabWidget(this);
   m_topTab->addTab(initGUI_processing(), "Processing");
   m_topTab->addTab(initGUI_transforms(), "Detection");

   m_add = new QToolButton(this);
   m_add->setIcon(QIcon(":/images/plus.png"));
   m_add->setToolTip("Add");
   connect(m_add, SIGNAL(clicked()), this, SLOT(addClicked()));

   m_remove = new QToolButton(this);
   m_remove->setIcon(QIcon(":/images/minus.png"));
   m_remove->setToolTip("Remove");
   connect(m_remove, SIGNAL(clicked()), this, SLOT(removeClicked()));

   m_show = new QToolButton(this);
   m_show->setIcon(QIcon(":/images/show.png"));
   m_show->setToolTip("Show");
   connect(m_show, SIGNAL(clicked()), this, SLOT(showClicked()));

   m_exitEdit = new QPushButton(this);
   m_exitEdit->setText("Exit Editmode");
   connect(m_exitEdit, SIGNAL(clicked()), this, SLOT(exitEditClicked()));
   m_exitEdit->setVisible(false);

   m_updateSource = new QCheckBox(this);
   m_updateSource->setText("Live Update");
   m_updateSource->setChecked(false);
   m_updateSource->setVisible(false);

   m_hide = new QToolButton(this);
   m_hide->setIcon(QIcon(":/images/hide.png"));
   m_hide->setToolTip("Hide");
   connect(m_hide, SIGNAL(clicked()), this, SLOT(hideClicked()));

   QHBoxLayout *buttonlay = new QHBoxLayout;
   buttonlay->addWidget(m_add);
   buttonlay->addWidget(m_remove);
   buttonlay->addWidget(m_show);
   buttonlay->addWidget(m_hide);
   buttonlay->addStretch();
   buttonlay->addWidget(m_exitEdit);
   buttonlay->addWidget(m_updateSource);

   QVBoxLayout *left = new QVBoxLayout;
   left->addWidget(m_topTab);
   left->addLayout(buttonlay);

   m_table = new QTableWidget(this);
   connect(m_table, SIGNAL(cellPressed(int, int)), 
      this, SLOT(cellClicked(int, int)));
   m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
   m_table->setSelectionMode(QAbstractItemView::SingleSelection);
   QVBoxLayout *right = new QVBoxLayout;
   right->addWidget(m_table);

   QVBoxLayout *lay = new QVBoxLayout;
   lay->addLayout(left);
   lay->addLayout(right);

   m_previewLabel = new QLabel(this);

   m_ok = new QToolButton(this);
   m_ok->setIcon(QIcon(":/images/OK.png"));
   m_ok->setIconSize(QSize(32, 32));

   connect(m_ok, SIGNAL(clicked()),
      this, SLOT(okClicked()));

   m_cancel = new QToolButton(this);
   m_cancel->setIcon(QIcon(":/images/NOT_OK.png"));
   m_cancel->setIconSize(QSize(32, 32));

   connect(m_cancel, SIGNAL(clicked()),
      this, SLOT(cancelClicked()));

   QHBoxLayout *exitlay = new QHBoxLayout;
   exitlay->addStretch();
   exitlay->addWidget(m_ok);
   exitlay->addWidget(m_cancel);

   QVBoxLayout *rightLay = new QVBoxLayout;
   rightLay->addWidget(m_previewLabel);
   rightLay->addLayout(exitlay);

   QHBoxLayout *totlay = new QHBoxLayout;
   totlay->addLayout(lay);
   totlay->addLayout(rightLay);
   this->setLayout(totlay);
}
void
DialogMainMenu::SetUI()
{
    FacebookDialog::SetUI();

    m_pLabel = new QLabel( tr( "Main Menu " ) );

    QBoxLayout *pMainLayout = GetMainLayout();

    QHBoxLayout *pMainMenuLayout = new QHBoxLayout;
    QVBoxLayout *pUserInfoLayout = new QVBoxLayout;
    QGridLayout *pMainMenuIconsLayout =new QGridLayout;

    m_pSignalMapper = new QSignalMapper(this);
    m_pPhotoImage = new QLabel();
    QPixmap *pPhoto = new QPixmap(USER_PHOTO_WIDTH,USER_PHOTO_HEIGHT);
    m_pPhotoImage->setPixmap(*pPhoto);
    m_pUserInfo = new QLabel(tr("Golyshkin Alexander"));
    m_pUserStatus =new QLabel(tr("I'm very Happy!!!"));


    int xpos=0, ypos=0;

    for(int i=0; i<MAIN_MENU_OPTIONS_NUMBER; i++)
    {
        m_pMMOptions[i]=new QPushButton();
        switch (i)
        {
        case Profile:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/profile.png") );
            break;
        case Friends:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/friends.png") );
            break;
        case News:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/news.png") );
            break;
        case Messages:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/messages.png") );
            break;
        case Groups:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/groups.png") );
            break;
        case Events:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/events.png") );
            break;
        case Photos:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/photos.png") );
            break;
        case About:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/information.png") );
            break;
        case AboutQT:
            m_pMMOptions[i]->setIcon( QIcon(":images/mainmenu/aboutQT.png") );
            break;
        default:
            break;
        }
        connect(m_pMMOptions[i], SIGNAL(clicked()), m_pSignalMapper, SLOT(map()));
        m_pSignalMapper->setMapping(m_pMMOptions[i],i );

        m_pMMOptions[i]->setFlat(true);
        m_pMMOptions[i]->setContentsMargins ( QMargins( 0, 0, 0, 0 ) );
        m_pMMOptions[i]->setIconSize( QSize( 100, 100 ) );
        pMainMenuIconsLayout->addWidget(m_pMMOptions[i], xpos,ypos );
        ypos++;
        if(ypos>MAX_GRID_ROW-1)
        {
            ypos=0;
            xpos++;
        }
    }

    connect(m_pSignalMapper, SIGNAL(mapped(int)),this, SLOT(OnOptionsClick(int)));

    pUserInfoLayout->addWidget( m_pPhotoImage);
    pUserInfoLayout->addWidget( m_pUserInfo );
    pUserInfoLayout->addWidget( m_pUserStatus );
    pUserInfoLayout->addStretch( 1 );



    pMainMenuLayout->addLayout( pUserInfoLayout );
    pMainMenuLayout->addLayout(pMainMenuIconsLayout);

    pMainLayout->addLayout(pMainMenuLayout);
}
Example #3
0
LTMWindow::LTMWindow(Context *context) :
            GcChartWindow(context), context(context), dirty(true), stackDirty(true), compareDirty(true)
{
    useToToday = useCustom = false;
    plotted = DateRange(QDate(01,01,01), QDate(01,01,01));
    lastRefresh = QTime::currentTime().addSecs(-10);

    // the plot
    QVBoxLayout *mainLayout = new QVBoxLayout;

    QPalette palette;
    palette.setBrush(QPalette::Background, QBrush(GColor(CTRENDPLOTBACKGROUND)));

    // single plot
    plotWidget = new QWidget(this);
    plotWidget->setPalette(palette);
    QVBoxLayout *plotLayout = new QVBoxLayout(plotWidget);
    plotLayout->setSpacing(0);
    plotLayout->setContentsMargins(0,0,0,0);
    
    ltmPlot = new LTMPlot(this, context, true);
    spanSlider = new QxtSpanSlider(Qt::Horizontal, this);
    spanSlider->setFocusPolicy(Qt::NoFocus);
    spanSlider->setHandleMovementMode(QxtSpanSlider::NoOverlapping);
    spanSlider->setLowerValue(0);
    spanSlider->setUpperValue(15);

    QFont smallFont;
    smallFont.setPointSize(6);

    scrollLeft = new QPushButton("<", this);
    scrollLeft->setFont(smallFont);
    scrollLeft->setAutoRepeat(true);
    scrollLeft->setFixedHeight(16);
    scrollLeft->setFixedWidth(16);
    scrollLeft->setContentsMargins(0,0,0,0);

    scrollRight = new QPushButton(">", this);
    scrollRight->setFont(smallFont);
    scrollRight->setAutoRepeat(true);
    scrollRight->setFixedHeight(16);
    scrollRight->setFixedWidth(16);
    scrollRight->setContentsMargins(0,0,0,0);

    QHBoxLayout *span = new QHBoxLayout;
    span->addWidget(scrollLeft);
    span->addWidget(spanSlider);
    span->addWidget(scrollRight);
    plotLayout->addWidget(ltmPlot);
    plotLayout->addLayout(span);

#ifdef Q_OS_MAC
    // BUG in QMacStyle and painting of spanSlider
    // so we use a plain style to avoid it, but only
    // on a MAC, since win and linux are fine
#if QT_VERSION > 0x5000
    QStyle *style = QStyleFactory::create("fusion");
#else
    QStyle *style = QStyleFactory::create("Cleanlooks");
#endif
    spanSlider->setStyle(style);
    scrollLeft->setStyle(style);
    scrollRight->setStyle(style);
#endif

    // the stack of plots
    plotsWidget = new QWidget(this);
    plotsWidget->setPalette(palette);
    plotsLayout = new QVBoxLayout(plotsWidget);
    plotsLayout->setSpacing(0);
    plotsLayout->setContentsMargins(0,0,0,0);

    plotArea = new QScrollArea(this);
#ifdef Q_OS_WIN
    QStyle *cde = QStyleFactory::create(OS_STYLE);
    plotArea->setStyle(cde);
#endif
    plotArea->setAutoFillBackground(false);
    plotArea->setWidgetResizable(true);
    plotArea->setWidget(plotsWidget);
    plotArea->setFrameStyle(QFrame::NoFrame);
    plotArea->setContentsMargins(0,0,0,0);
    plotArea->setPalette(palette);

    // the data table
    QFont defaultFont; // mainwindow sets up the defaults.. we need to apply
#ifdef NOWEBKIT
    dataSummary = new QWebEngineView(this);
    dataSummary->settings()->setFontSize(QWebEngineSettings::DefaultFontSize, defaultFont.pointSize()+1);
    dataSummary->settings()->setFontFamily(QWebEngineSettings::StandardFont, defaultFont.family());
#else
    dataSummary = new QWebView(this);
    dataSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1);
    dataSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family());
#endif
    dataSummary->setContentsMargins(0,0,0,0);
    dataSummary->page()->view()->setContentsMargins(0,0,0,0);
    dataSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    dataSummary->setAcceptDrops(false);

    // compare plot page
    compareplotsWidget = new QWidget(this);
    compareplotsWidget->setPalette(palette);
    compareplotsLayout = new QVBoxLayout(compareplotsWidget);
    compareplotsLayout->setSpacing(0);
    compareplotsLayout->setContentsMargins(0,0,0,0);

    compareplotArea = new QScrollArea(this);
#ifdef Q_OS_WIN
    cde = QStyleFactory::create(OS_STYLE);
    compareplotArea->setStyle(cde);
#endif
    compareplotArea->setAutoFillBackground(false);
    compareplotArea->setWidgetResizable(true);
    compareplotArea->setWidget(compareplotsWidget);
    compareplotArea->setFrameStyle(QFrame::NoFrame);
    compareplotArea->setContentsMargins(0,0,0,0);
    compareplotArea->setPalette(palette);

    // the stack
    stackWidget = new QStackedWidget(this);
    stackWidget->addWidget(plotWidget);
    stackWidget->addWidget(dataSummary);
    stackWidget->addWidget(plotArea);
    stackWidget->addWidget(compareplotArea);
    stackWidget->setCurrentIndex(0);
    mainLayout->addWidget(stackWidget);
    setChartLayout(mainLayout);

    HelpWhatsThis *helpStack = new HelpWhatsThis(stackWidget);
    stackWidget->setWhatsThis(helpStack->getWhatsThisText(HelpWhatsThis::ChartTrends_MetricTrends));

    // reveal controls
    QHBoxLayout *revealLayout = new QHBoxLayout;
    revealLayout->setContentsMargins(0,0,0,0);
    revealLayout->addStretch();
    revealLayout->addWidget(new QLabel(tr("Group by"),this));

    rGroupBy = new QxtStringSpinBox(this);
    QStringList strings;
    strings << tr("Days")
            << tr("Weeks")
            << tr("Months")
            << tr("Years")
            << tr("Time Of Day")
            << tr("All");
    rGroupBy->setStrings(strings);
    rGroupBy->setValue(0);

    revealLayout->addWidget(rGroupBy);
    rData = new QCheckBox(tr("Data Table"), this);
    rStack = new QCheckBox(tr("Stacked"), this);
    QVBoxLayout *checks = new QVBoxLayout;
    checks->setSpacing(2);
    checks->setContentsMargins(0,0,0,0);
    checks->addWidget(rData);
    checks->addWidget(rStack);
    revealLayout->addLayout(checks);
    revealLayout->addStretch();
    setRevealLayout(revealLayout);

    // add additional menu items before setting
    // controls since the menu is SET from setControls
    QAction *exportData = new QAction(tr("Export Chart Data..."), this);
    addAction(exportData);

    // the controls
    QWidget *c = new QWidget;
    c->setContentsMargins(0,0,0,0);
    HelpWhatsThis *helpConfig = new HelpWhatsThis(c);
    c->setWhatsThis(helpConfig->getWhatsThisText(HelpWhatsThis::ChartTrends_MetricTrends));
    QVBoxLayout *cl = new QVBoxLayout(c);
    cl->setContentsMargins(0,0,0,0);
    cl->setSpacing(0);
    setControls(c);

    // the popup
    popup = new GcPane();
    ltmPopup = new LTMPopup(context);
    QVBoxLayout *popupLayout = new QVBoxLayout();
    popupLayout->addWidget(ltmPopup);
    popup->setLayout(popupLayout);

    ltmTool = new LTMTool(context, &settings);

    // initialise
    settings.ltmTool = ltmTool;
    settings.groupBy = LTM_DAY;
    settings.legend = ltmTool->showLegend->isChecked();
    settings.events = ltmTool->showEvents->isChecked();
    settings.shadeZones = ltmTool->shadeZones->isChecked();
    settings.showData = ltmTool->showData->isChecked();
    settings.stack = ltmTool->showStack->isChecked();
    settings.stackWidth = ltmTool->stackSlider->value();
    rData->setChecked(ltmTool->showData->isChecked());
    rStack->setChecked(ltmTool->showStack->isChecked());
    cl->addWidget(ltmTool);

    connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
    connect(this, SIGNAL(styleChanged(int)), this, SLOT(styleChanged(int)));
    connect(ltmTool, SIGNAL(filterChanged()), this, SLOT(filterChanged()));
    connect(context, SIGNAL(homeFilterChanged()), this, SLOT(filterChanged()));
    connect(ltmTool->groupBy, SIGNAL(currentIndexChanged(int)), this, SLOT(groupBySelected(int)));
    connect(rGroupBy, SIGNAL(valueChanged(int)), this, SLOT(rGroupBySelected(int)));
    connect(ltmTool->applyButton, SIGNAL(clicked(bool)), this, SLOT(applyClicked(void)));
    connect(ltmTool->shadeZones, SIGNAL(stateChanged(int)), this, SLOT(shadeZonesClicked(int)));
    connect(ltmTool->showData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int)));
    connect(rData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int)));
    connect(ltmTool->showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int)));
    connect(rStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int)));
    connect(ltmTool->stackSlider, SIGNAL(valueChanged(int)), this, SLOT(zoomSliderChanged()));
    connect(ltmTool->showLegend, SIGNAL(stateChanged(int)), this, SLOT(showLegendClicked(int)));
    connect(ltmTool->showEvents, SIGNAL(stateChanged(int)), this, SLOT(showEventsClicked(int)));
    connect(ltmTool, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange)));
    connect(ltmTool, SIGNAL(useThruToday()), this, SLOT(useThruToday()));
    connect(ltmTool, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
    connect(ltmTool, SIGNAL(curvesChanged()), this, SLOT(refresh()));
    connect(context, SIGNAL(filterChanged()), this, SLOT(filterChanged()));
    connect(context, SIGNAL(refreshUpdate(QDate)), this, SLOT(refreshUpdate(QDate)));
    connect(context, SIGNAL(refreshEnd()), this, SLOT(refresh()));

    // comparing things
    connect(context, SIGNAL(compareDateRangesStateChanged(bool)), this, SLOT(compareChanged()));
    connect(context, SIGNAL(compareDateRangesChanged()), this, SLOT(compareChanged()));

    connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(rideSaved(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(configChanged(qint32)), this, SLOT(configChanged(qint32)));
    connect(context, SIGNAL(presetSelected(int)), this, SLOT(presetSelected(int)));

    // custom menu item
    connect(exportData, SIGNAL(triggered()), this, SLOT(exportData()));

    // normal view
    connect(spanSlider, SIGNAL(lowerPositionChanged(int)), this, SLOT(spanSliderChanged()));
    connect(spanSlider, SIGNAL(upperPositionChanged(int)), this, SLOT(spanSliderChanged()));
    connect(scrollLeft, SIGNAL(clicked()), this, SLOT(moveLeft()));
    connect(scrollRight, SIGNAL(clicked()), this, SLOT(moveRight()));

    configChanged(CONFIG_APPEARANCE);
}
Example #4
0
void RTIMULibDemoGL::layoutWindow()
{
    QHBoxLayout *mainLayout = new QHBoxLayout();
    mainLayout->setContentsMargins(3, 3, 3, 3);
    mainLayout->setSpacing(3);

    QVBoxLayout *vLayout = new QVBoxLayout();
    vLayout->addSpacing(10);

    QHBoxLayout *imuLayout = new QHBoxLayout();
    vLayout->addLayout(imuLayout);
    imuLayout->addWidget(new QLabel("IMU type: "));
    m_imuType = new QLabel();
    imuLayout->addWidget(m_imuType);
    imuLayout->setStretch(1, 1);

    vLayout->addSpacing(10);

    QHBoxLayout *biasLayout = new QHBoxLayout();
    vLayout->addLayout(biasLayout);
    biasLayout->addWidget(new QLabel("Gyro bias status: "));
    m_biasStatus = new QLabel();
    biasLayout->addWidget(m_biasStatus);
    biasLayout->setStretch(1, 1);

    vLayout->addSpacing(10);

    vLayout->addWidget(new QLabel("Fusion state (quaternion): "));

    QHBoxLayout *dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    m_fusionQPoseScalar = getFixedPanel("1");
    m_fusionQPoseX = getFixedPanel("0");
    m_fusionQPoseY = getFixedPanel("0");
    m_fusionQPoseZ = getFixedPanel("0");
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_fusionQPoseScalar);
    dataLayout->addWidget(m_fusionQPoseX);
    dataLayout->addWidget(m_fusionQPoseY);
    dataLayout->addWidget(m_fusionQPoseZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Pose - roll, pitch, yaw (degrees): "));

    m_fusionPoseX = getFixedPanel("0");
    m_fusionPoseY = getFixedPanel("0");
    m_fusionPoseZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_fusionPoseX);
    dataLayout->addWidget(m_fusionPoseY);
    dataLayout->addWidget(m_fusionPoseZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Gyros (radians/s): "));

    m_gyroX = getFixedPanel("0");
    m_gyroY = getFixedPanel("0");
    m_gyroZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_gyroX);
    dataLayout->addWidget(m_gyroY);
    dataLayout->addWidget(m_gyroZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Accelerometers (g): "));

    m_accelX = getFixedPanel("0");
    m_accelY = getFixedPanel("0");
    m_accelZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addWidget(m_accelX);
    dataLayout->addWidget(m_accelY);
    dataLayout->addWidget(m_accelZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Accelerometer magnitude (g): "));

    m_accelMagnitude = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_accelMagnitude);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Accelerometer residuals (g): "));

    m_accelResidualX = getFixedPanel("0");
    m_accelResidualY = getFixedPanel("0");
    m_accelResidualZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addWidget(m_accelResidualX);
    dataLayout->addWidget(m_accelResidualY);
    dataLayout->addWidget(m_accelResidualZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Magnetometers (uT): "));

    m_compassX = getFixedPanel("0");
    m_compassY = getFixedPanel("0");
    m_compassZ = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->setAlignment(Qt::AlignLeft);
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_compassX);
    dataLayout->addWidget(m_compassY);
    dataLayout->addWidget(m_compassZ);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Compass magnitude (uT): "));

    m_compassMagnitude = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_compassMagnitude);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Pressure (hPa), height above sea level (m): "));

    m_pressure = getFixedPanel("0");
    m_height = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_pressure);
    dataLayout->addWidget(m_height);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Temperature (C): "));

    m_temperature = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_temperature);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);
    vLayout->addWidget(new QLabel("Humidity (RH): "));

    m_humidity = getFixedPanel("0");
    dataLayout = new QHBoxLayout();
    dataLayout->addSpacing(30);
    dataLayout->addWidget(m_humidity);
    dataLayout->setAlignment(Qt::AlignLeft);
    vLayout->addLayout(dataLayout);

    vLayout->addSpacing(10);

    QHBoxLayout *fusionBox = new QHBoxLayout();
    QLabel *fusionTypeLabel = new QLabel("Fusion algorithm: ");
    fusionBox->addWidget(fusionTypeLabel);
    fusionTypeLabel->setMaximumWidth(150);
    m_fusionType = new QLabel();
    fusionBox->addWidget(m_fusionType);
    vLayout->addLayout(fusionBox);

    vLayout->addSpacing(10);

    vLayout->addWidget(new QLabel("Fusion controls: "));

    m_enableGyro = new QCheckBox("Enable gyros");
    m_enableGyro->setChecked(true);
    vLayout->addWidget(m_enableGyro);

    m_enableAccel = new QCheckBox("Enable accels");
    m_enableAccel->setChecked(true);
    vLayout->addWidget(m_enableAccel);

    m_enableCompass = new QCheckBox("Enable compass");
    m_enableCompass->setChecked(true);
    vLayout->addWidget(m_enableCompass);

    m_enableDebug = new QCheckBox("Enable debug messages");
    m_enableDebug->setChecked(false);
    vLayout->addWidget(m_enableDebug);

    vLayout->addStretch(1);

    mainLayout->addLayout(vLayout);

    vLayout = new QVBoxLayout();
    vLayout->setContentsMargins(3, 3, 3, 3);
    vLayout->setSpacing(3);

    QHBoxLayout *displayLayout = new QHBoxLayout();
    QLabel *displayLabel = new QLabel("Display type:  ");
    displayLayout->addWidget(displayLabel);
    displayLayout->setAlignment(displayLabel, Qt::AlignRight);

    m_displaySelect = new QComboBox();
    m_displaySelect->addItem("Fusion pose", DISPLAY_FUSION);
    m_displaySelect->addItem("Measured pose", DISPLAY_MEASURED);
    m_displaySelect->addItem("Accels only", DISPLAY_ACCELONLY);
    m_displaySelect->addItem("Compass only", DISPLAY_COMPASSONLY);

    displayLayout->addWidget(m_displaySelect);
    vLayout->addLayout(displayLayout);

    m_view = new IMUView(this);
    vLayout->addWidget(m_view);

    mainLayout->addLayout(vLayout, 1);
    centralWidget()->setLayout(mainLayout);
    setMinimumWidth(1000);
    setMinimumHeight(700);
}
Example #5
0
CWizLoginDialog::CWizLoginDialog(const QString& strDefaultUserId, const QString& strLocale, QWidget *parent)
    : QDialog(parent)
{
    QLabel* labelInput = new QLabel(tr("Account Login"), this);

    m_comboUsers = new QComboBox(this);
    m_comboUsers->setEditable(true);
    connect(m_comboUsers, SIGNAL(currentIndexChanged(const QString&)),
            SLOT(on_comboUsers_indexChanged(const QString&)));
    connect(m_comboUsers, SIGNAL(editTextChanged(const QString&)),
            SLOT(on_comboUsers_editTextChanged(const QString&)));

    m_editPassword = new QLineEdit(this);
    m_editPassword->setEchoMode(QLineEdit::Password);
    m_editPassword->setPlaceholderText(tr("Password"));
    m_checkSavePassword = new QCheckBox(tr("Save password"));

    m_checkAutoLogin = new QCheckBox(tr("Auto login"));
    connect(m_checkAutoLogin, SIGNAL(stateChanged(int)),
            SLOT(on_checkAutoLogin_stateChanged(int)));

    QHBoxLayout* layoutState = new QHBoxLayout();
    layoutState->setContentsMargins(0, 0, 0, 0);
    layoutState->addWidget(m_checkSavePassword);
    layoutState->addSpacing(10);
    layoutState->addWidget(m_checkAutoLogin);
    layoutState->setAlignment(Qt::AlignRight);

    QVBoxLayout* layoutInput = new QVBoxLayout();
    layoutInput->setContentsMargins(10, 10, 10, 0);
    layoutInput->setSpacing(10);
    layoutInput->addWidget(labelInput);
    layoutInput->addWidget(m_comboUsers);
    layoutInput->addWidget(m_editPassword);
    layoutInput->addSpacing(5);
    layoutInput->addLayout(layoutState);

    QLabel* m_avatar = new QLabel(this);
    //m_avatar = new CWizAvatarWidget(this);
    m_avatar->setFixedSize(120, 120);
    m_avatar->setPixmap(QPixmap(":/avatar_login.png"));
    //resetAvatar(strDefaultUserId);

    QHBoxLayout* layoutUser = new QHBoxLayout();
    layoutUser->addSpacing(20);
    layoutUser->addWidget(m_avatar);
    layoutUser->addLayout(layoutInput);

    QWidget* line1 = new QWidget(this);
    line1->setFixedWidth(1);
    line1->setStyleSheet("border-left-width:1;border-left-style:solid;border-left-color:#d9dcdd");

    QWidget* line2 = new QWidget(this);
    line2->setFixedWidth(1);
    line2->setStyleSheet("border-left-width:1;border-left-style:solid;border-left-color:#d9dcdd");

    QLabel* m_labelRegister = new QLabel(this);
    m_labelRegister->setText(tr("<a href=\"javascript:void(0)\" style=\"color:#363636; text-decoration:none;\">New user</a>"));
    connect(m_labelRegister, SIGNAL(linkActivated(const QString&)),
            SLOT(on_labelRegister_linkActivated(const QString&)));

    QLabel* m_labelForgot = new QLabel(this);
    m_labelForgot->setText(tr("<a href=\"javascript:void(0)\" style=\"color:#363636; text-decoration:none;\">Forget password</a>"));
    connect(m_labelForgot, SIGNAL(linkActivated(const QString&)),
            SLOT(on_labelForgot_linkActivated(const QString&)));

    //QLabel* m_labelNetwork = new QLabel(this);
    //m_labelNetwork->setText(tr("<a href=\"javascript:void(0)\" style=\"color:#363636; text-decoration:none;\">Network</a>"));
    //connect(m_labelNetwork, SIGNAL(linkActivated(const QString&)),
    //        SLOT(on_labelNetwork_linkActivated(const QString&)));

    m_btnLogin = new QPushButton(tr("Login"), this);
    connect(m_btnLogin, SIGNAL(clicked()), SLOT(accept()));

    QHBoxLayout* layoutCommon = new QHBoxLayout();
    layoutCommon->setContentsMargins(10, 0, 10, 0);
    layoutCommon->setSpacing(5);
    layoutCommon->addWidget(m_labelRegister);
    layoutCommon->addWidget(line1);
    layoutCommon->addWidget(m_labelForgot);
    //layoutCommon->addWidget(line2);
    //layoutCommon->addWidget(m_labelNetwork);
    layoutCommon->addStretch();
    layoutCommon->addWidget(m_btnLogin);

    QWidget* line3 = new QWidget(this);
    line3->setFixedHeight(1);
    line3->setStyleSheet("border-top-width:1;border-top-style:solid;border-top-color:#d9dcdd");

    QVBoxLayout* mainLayout = new QVBoxLayout();
    mainLayout->setContentsMargins(5, 5, 5, 5);
    mainLayout->setSpacing(8);
    setLayout(mainLayout);
    mainLayout->addLayout(layoutUser);
    mainLayout->addWidget(line3);
    mainLayout->addLayout(layoutCommon);

    setWindowFlags(Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
    setFixedSize(sizeHint());

    setUsers(strDefaultUserId);
}
BtInstallPathDialog::BtInstallPathDialog() {
    namespace DU = util::directory;

    setWindowTitle(tr("Bookshelf Folders"));

    QVBoxLayout *mainLayout;
    QHBoxLayout *viewLayout;

    mainLayout = new QVBoxLayout(this);
    viewLayout = new QHBoxLayout();

    QString l1 = tr("Works can be installed in one or more folders. After setting up folders here you can choose one of them in Install page.");
    /// \bug The following string has an extra space character:
    QString l2 = tr("BibleTime and the SWORD library find the works from  all of these folders. If a folder is removed here it still exists in the system with all the works in it.");

    QLabel* mainLabel = util::tool::explanationLabel(this,
                        tr("Configure bookshelf folders"), l1 + QString("<small><br/><br/>") + l2 + QString("</small>"));
    mainLayout->addWidget(mainLabel);

    QString swordConfPath = BtInstallBackend::swordConfigFilename();
    /// \todo After releasing 2.4, change the following line to: QLabel *confPathLabel = new QLabel(tr("Configuration file for the folders is: <b>%1</b>").arg(swordConfPath), this);
    QLabel* confPathLabel = new QLabel(tr("Configuration file for the folders is: ").append("<b>%1</b>").arg(swordConfPath), this);
    confPathLabel->setWordWrap(true);
    mainLayout->addWidget(confPathLabel);


    m_swordPathListBox = new QTreeWidget(this);
    m_swordPathListBox->setHeaderHidden(true);

    QString rwfolderitem(tr("Folders where new works can be installed"));
    m_writableItem = new QTreeWidgetItem(m_swordPathListBox, QStringList(rwfolderitem));;
    m_writableItem->setFlags(Qt::ItemIsEnabled);
    m_readableItem = new QTreeWidgetItem(m_swordPathListBox, QStringList(tr("Read-only folders")));;
    m_readableItem->setFlags(Qt::ItemIsEnabled);
    m_nonexistingItem = new QTreeWidgetItem(m_swordPathListBox, QStringList(tr("Nonexistent folders")));;
    m_nonexistingItem->setFlags(Qt::ItemIsEnabled);

    QStringList targets = BtInstallBackend::targetList();

    Q_FOREACH(QString const & pathname, targets)
        addPathToList(pathname);
    updateTopLevelItems();

    viewLayout->addWidget(m_swordPathListBox);

    QVBoxLayout* buttonLayout = new QVBoxLayout();

    m_addButton = new QPushButton(tr("&Add..."), this);
    m_addButton->setToolTip(tr("Add new folder"));
    m_addButton->setIcon(CResMgr::bookshelfmgr::paths::icon_add());
    connect(m_addButton, SIGNAL(clicked()), this, SLOT(slotAddClicked()));
    buttonLayout->addWidget(m_addButton);

    m_editButton = new QPushButton(tr("&Edit..."), this);
    m_editButton->setToolTip(tr("Edit the selected folder"));
    m_editButton->setIcon(CResMgr::bookshelfmgr::paths::icon_edit());
    connect(m_editButton, SIGNAL(clicked()), this, SLOT(slotEditClicked()));
    buttonLayout->addWidget(m_editButton);

    m_removeButton = new QPushButton(tr("&Remove"), this);
    m_removeButton->setToolTip(tr("Remove the selected folder"));
    m_removeButton->setIcon(CResMgr::bookshelfmgr::paths::icon_remove());
    connect(m_removeButton, SIGNAL(clicked()), this, SLOT(slotRemoveClicked()));
    buttonLayout->addWidget(m_removeButton);

    QSpacerItem* spacerItem = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding);
    buttonLayout->addItem(spacerItem);

    viewLayout->addLayout(buttonLayout);
    mainLayout->addLayout(viewLayout);

    QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
    buttonBox->setOrientation(Qt::Horizontal);
    buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::NoButton | QDialogButtonBox::Ok);
    message::prepareDialogBox(buttonBox);
    mainLayout->addWidget(buttonBox);
    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    //clumsy way to set width. Could someone please fix Qt to have an easy way to set widget sizes?
    int textWidth = fontMetrics().width(rwfolderitem.append("MMMMMMMMMM"));
    int buttonWidth = m_addButton->width();
    resize(textWidth + buttonWidth, size().height());
}
Example #7
0
void ReportDialog::createControls()
{
    logMessage("ReportDialog::createControls()");

    chkDescription = new QCheckBox(tr("Description"));
    chkProblemInformation = new QCheckBox(tr("Problem information"));
    chkStartupScript = new QCheckBox(tr("Startup script"));
    chkPhysicalProperties = new QCheckBox(tr("Physical properties"));
    chkGeometry = new QCheckBox(tr("Geometry"));
    connect(chkGeometry, SIGNAL(clicked()), this, SLOT(resetControls()));
    chkMeshAndSolution = new QCheckBox(tr("Mesh and solution"));
    connect(chkMeshAndSolution, SIGNAL(clicked()), this, SLOT(resetControls()));
    chkScript = new QCheckBox(tr("Script"));

    chkFigureGeometry = new QCheckBox(tr("Geometry"));
    chkFigureMesh = new QCheckBox(tr("Mesh"));
    chkFigureOrder = new QCheckBox(tr("Order"));
    chkFigureScalarView = new QCheckBox(tr("Scalar view"));
    chkFigureContourView = new QCheckBox(tr("Contour view"));
    chkFigureVectorView = new QCheckBox(tr("Vector view"));
    chkShowGrid = new QCheckBox(tr("Show grid"));
    chkShowRulers = new QCheckBox(tr("Show rulers"));

    txtTemplate = new QLineEdit();
    connect(txtTemplate, SIGNAL(textChanged(QString)), this, SLOT(checkPaths()));
    txtStyleSheet = new QLineEdit();
    connect(txtStyleSheet, SIGNAL(textChanged(QString)), this, SLOT(checkPaths()));

    txtFigureWidth = new ValueLineEdit();
    txtFigureWidth->setValue(Value("600"));
    txtFigureWidth->setMinimum(200);
    txtFigureHeight = new ValueLineEdit();
    txtFigureHeight->setValue(Value("400"));
    txtFigureHeight->setMinimum(200);

    btnDefault = new QPushButton(tr("Default"));
    connect(btnDefault, SIGNAL(clicked()), this, SLOT(defaultValues()));

    btnShowReport = new QPushButton(tr("Show report"));
    connect(btnShowReport, SIGNAL(clicked()), this, SLOT(doShowReport()));

    btnClose = new QPushButton(tr("Close"));
    btnClose->setDefault(true);
    connect(btnClose, SIGNAL(clicked()), this, SLOT(doClose()));

    QVBoxLayout *layoutSections = new QVBoxLayout();
    layoutSections->addWidget(chkDescription);
    layoutSections->addWidget(chkProblemInformation);
    layoutSections->addWidget(chkStartupScript);
    layoutSections->addWidget(chkPhysicalProperties);
    layoutSections->addWidget(chkGeometry);
    layoutSections->addWidget(chkMeshAndSolution);
    layoutSections->addWidget(chkScript);

    QVBoxLayout *layoutFigures = new QVBoxLayout();
    layoutFigures->addWidget(chkFigureGeometry);
    layoutFigures->addWidget(chkFigureMesh);
    layoutFigures->addWidget(chkFigureOrder);
    layoutFigures->addWidget(chkFigureScalarView);
    layoutFigures->addWidget(chkFigureContourView);
    layoutFigures->addWidget(chkFigureVectorView);
    layoutFigures->addWidget(new QLabel());
    layoutFigures->addWidget(chkShowGrid);
    layoutFigures->addWidget(chkShowRulers);

    QGridLayout *layoutSection = new QGridLayout();
    layoutSection->addLayout(layoutSections, 0, 0);

    QGridLayout *layoutTemplate = new QGridLayout();
    layoutTemplate->addWidget(new QLabel(tr("Template")), 0, 0);
    layoutTemplate->addWidget(txtTemplate, 0, 1);
    layoutTemplate->addWidget(new QLabel(tr("Style sheet")), 1, 0);
    layoutTemplate->addWidget(txtStyleSheet, 1, 1);

    QGridLayout *layoutFigureSize = new QGridLayout();
    layoutFigureSize->addWidget(new QLabel(tr("Width")), 0, 0);
    layoutFigureSize->addWidget(txtFigureWidth, 0, 1);
    layoutFigureSize->addWidget(new QLabel(tr("Height")), 1, 0);
    layoutFigureSize->addWidget(txtFigureHeight, 1, 1);
    layoutFigureSize->setRowStretch(2, 1);

    QHBoxLayout *layoutFigure = new QHBoxLayout();
    layoutFigure->addLayout(layoutFigures);
    layoutFigure->addLayout(layoutFigureSize);
    layoutFigure->addStretch();

    QHBoxLayout *layoutButtons = new QHBoxLayout();
    layoutButtons->addStretch();
    layoutButtons->addWidget(btnShowReport);
    layoutButtons->addWidget(btnDefault);
    layoutButtons->addWidget(btnClose);

    QGroupBox *grpBasicProperties = new QGroupBox(tr("Sections"));
    grpBasicProperties->setLayout(layoutSection);

    QGroupBox *grpFigure = new QGroupBox(tr("Figures properties"));
    grpFigure->setLayout(layoutFigure);

    QGroupBox *grpAdditionalProperties = new QGroupBox(tr("Additional properties"));
    grpAdditionalProperties->setLayout(layoutTemplate);

    QGridLayout *layout = new QGridLayout();
    layout->addWidget(grpBasicProperties, 0, 0);
    layout->addWidget(grpFigure, 0, 1);
    // layout->addWidget(grpAdditionalProperties, 1, 0, 1, 2);
    layout->addLayout(layoutButtons, 2, 0, 2, 2);

    setLayout(layout);
}
Example #8
0
GameBoard::GameBoard(QWidget* parent)
:QWidget(parent)
{
  
  spacemap = new SpaceMap(this);
  spacemap->setGeometry(0, 0, 550, 550);
  
  planet_info = new Planet_Info(this);
  planet_info->setGeometry(0, 0, 80, 80);

  controlInfo = new QLabel("SDSDSDSDS");
  controlInfo->setGeometry(0, 0, 530, 10);

  endTurn = new QPushButton("End Turn");
  endTurn->setFixedSize(75, 25);
  //  endTurn->setGeometry(0, 0, 75, 25);
  
  shipNumber = new QLineEdit();
  shipNumber->setFixedSize(75, 25);
  shipNumber->setVisible(false);

  displayInfo = new QTextEdit();
  displayInfo->setFixedSize(630, 150);
  //  displayInfo->setGeometry(0, 0, 550, 50);
  
  // QPalette mainPal;
  //mainPal.setColor(QPalette::Window, Qt::black);
  //mainPal.setColor(QPalette::Text, Qt::white);
  //mainPal.setColor(QPalette::WindowText, Qt::white);
  //mainPal.setColor(backgroundRole(), Qt::black);
  QColor col(Qt::green);
  QPalette mainPal;
  mainPal.setColorGroup( QPalette::Active, Qt::white, Qt::black, col.light(), col.dark(), col, col.dark(75), col.dark(75), col.dark(), Qt::black );
  mainPal.setColorGroup( QPalette::Inactive, Qt::white, Qt::black, col.light(), col.dark(), col, col.dark(75), col.dark(75), col.dark(), Qt::black );
  mainPal.setColorGroup( QPalette::Disabled, Qt::white, Qt::black, col.light(), col.dark(), col, col.dark(75), col.dark(75), col.dark(), Qt::black );

  QColor colo(Qt::black);
  QPalette pal;
  pal.setColorGroup(QPalette::Active, Qt::white, Qt::black, col.light(), col.dark(), col, col.dark(75), colo.light(), colo.light(), Qt::darkGreen );

  this->setAutoFillBackground(true);
  spacemap->setAutoFillBackground(true);
  
  
  this->setPalette(mainPal);
  planet_info->setPalette(mainPal);
  spacemap->setPalette(pal);
  controlInfo->setPalette(mainPal);
  endTurn->setPalette(mainPal);
  displayInfo->setPalette(pal);
  shipNumber->setPalette(mainPal);
  

  this->setMouseTracking(true);
  
  QHBoxLayout* qhbLayout = new QHBoxLayout();
  qhbLayout->addWidget(controlInfo);
  qhbLayout->addWidget(shipNumber);
  qhbLayout->addWidget(endTurn);

  QVBoxLayout* qvbLayout = new QVBoxLayout();
  qvbLayout->addLayout(qhbLayout);
  qvbLayout->addWidget(spacemap);
  qvbLayout->addWidget(displayInfo);
  
  QHBoxLayout* qhbLayoutGeneral = new QHBoxLayout();
  qhbLayoutGeneral->addLayout(qvbLayout);
  qhbLayoutGeneral->addWidget(planet_info);
  
  //this->setFocusPolicy(Qt::StrongFocus);
  //shipNumber->setFocusPolicy(Qt::StrongFocus);
  this->setLayout(qhbLayoutGeneral);
  
  connect(spacemap, SIGNAL(overPlanet(Planet*)), this, SLOT(onDisplayPlanet(Planet*)));
  connect(endTurn, SIGNAL(pressed()), this, SLOT(onTurnButton()));
  connect(shipNumber, SIGNAL(returnPressed()), this, SLOT(onShipNumberSelect()));
}
Example #9
0
//-----------------------------------------------------------------------------
StyleDialog::StyleDialog(QWidget *parent) : QDialog(parent)
{
	grBuf = 0;
	setWindowTitle(tr("UDAV - Insert style/scheme"));
	QWidget *p;
	QHBoxLayout *h;
	QVBoxLayout *v, *u, *vv;
	QGridLayout *g;
	QLabel *l;
	QPushButton *b;
	tab = new QTabWidget(this);

	// line style
	p = new QWidget(this);	v = new QVBoxLayout(p);
	g = new QGridLayout;	g->setAlignment(Qt::AlignTop);	v->addLayout(g);
//	g->setColStretch(0, 1);	g->setColStretch(1, 1);	g->setColStretch(2, 1);
	l = new QLabel(tr("Arrow at start"), p);	g->addWidget(l, 0, 0);
	l = new QLabel(tr("Dashing"), p);		g->addWidget(l, 0, 1);
	l = new QLabel(tr("Arrow at end"), p);	g->addWidget(l, 0, 2);
	a1 = new QComboBox(p);	g->addWidget(a1, 1, 0);	fillArrows(a1);
	dash = new QComboBox(p);	g->addWidget(dash, 1, 1);	fillDashes(dash);
	a2 = new QComboBox(p);	g->addWidget(a2, 1, 2);	fillBArrows(a2);
	l = new QLabel(tr("Color"), p);	g->addWidget(l, 2, 0, Qt::AlignRight);
	cline=new QComboBox(p);	g->addWidget(cline, 2, 1);	fillColors(cline);

	nline = new QSlider(p);		g->addWidget(nline, 2, 2);
	nline->setRange(1, 9);		nline->setValue(5);
	nline->setTickPosition(QSlider::TicksBothSides);
	nline->setTickInterval(1);	nline->setPageStep(2);
	nline->setOrientation(Qt::Horizontal);
	
	l = new QLabel(tr("Marks"), p);	g->addWidget(l, 3, 0, Qt::AlignRight);
	mark = new QComboBox(p);	g->addWidget(mark, 3, 1);	fillMarkers(mark);
	l = new QLabel(tr("Line width"), p);	g->addWidget(l, 4, 0, Qt::AlignRight);
	width = new QSpinBox(p);	g->addWidget(width, 4, 1);
	width->setRange(1,9);	width->setValue(1);
	
	v->addStretch(1);
	l = new QLabel(tr("Manual dashing"), p);	v->addWidget(l);
	h = new QHBoxLayout;	v->addLayout(h);	h->setSpacing(1);
	for(int i=0;i<16;i++)
	{
		dash_bit[i] = new QToolButton(this);
		dash_bit[i]->setCheckable(true);
		h->addWidget(dash_bit[i]);
		connect(dash_bit[i],SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	}
	connect(a1,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(a2,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(dash,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(mark,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(cline,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(nline,SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	connect(width,SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	tab->addTab(p, tr("Line style"));

	// color scheme
	p = new QWidget(this);
	v = new QVBoxLayout(p);	v->setAlignment(Qt::AlignTop);
	g = new QGridLayout();	v->addLayout(g);
//	g->setColStretch(0, 1);			g->setColStretch(1, 1);
	l = new QLabel(tr("Color order"), p);	g->addWidget(l, 0, 0);
	l = new QLabel(tr("Saturation"),p);		g->addWidget(l, 0, 1);
	for(int i=0;i<7;i++)
	{
		cc[i] = new QComboBox(p);	g->addWidget(cc[i], i+1, 0);
		fillColors(cc[i]);
		nn[i] = new QSlider(p);		g->addWidget(nn[i], i+1, 1);
		nn[i]->setRange(1, 9);		nn[i]->setValue(5);
		nn[i]->setTickPosition(QSlider::TicksBothSides);
		nn[i]->setTickInterval(1);	nn[i]->setPageStep(2);
		nn[i]->setOrientation(Qt::Horizontal);
		connect(cc[i],SIGNAL(activated(int)), this, SLOT(updatePic()));
		connect(nn[i],SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	}
	swire = new QCheckBox(tr("Wire or mesh plot"),p);	v->addWidget(swire);
	g = new QGridLayout();	v->addLayout(g);
	l = new QLabel(tr("Axial direction"), p);	g->addWidget(l, 0, 0, Qt::AlignRight);
	l = new QLabel(tr("Text on contours"), p);	g->addWidget(l, 1, 0, Qt::AlignRight);
	l = new QLabel(tr("Mask for bitmap coloring"), p);	g->addWidget(l, 2, 0, Qt::AlignRight);
	l = new QLabel(tr("Mask rotation angle"), p);	g->addWidget(l, 3, 0, Qt::AlignRight);
	l = new QLabel(tr("Mask size"), p);	g->addWidget(l, 4, 0, Qt::AlignRight);
	axial = new QComboBox(p);	g->addWidget(axial, 0, 1);
	axial->addItem(tr("none"));	axial->addItem("x");
	axial->addItem("y");	axial->addItem("z");
	ctext = new QComboBox(p);	g->addWidget(ctext, 1, 1);
	ctext->addItem(tr("none"));	ctext->addItem(tr("under"));	ctext->addItem(tr("above"));
	mask = new QComboBox(p);	g->addWidget(mask, 2, 1);	fillMasks(mask);
	angle = new QComboBox(p);	g->addWidget(angle, 3, 1);
	angle->addItem(tr("none"));	
	angle->addItem(QString::fromWCharArray(L"+45\xb0"));
	angle->addItem(QString::fromWCharArray(L"-45\xb0"));	
	angle->addItem(QString::fromWCharArray(L"90\xb0"));	// \xb0 <-> °
	msize = new QSlider(p);		g->addWidget(msize, 4, 1);
	msize->setRange(1, 9);		msize->setValue(1);
	msize->setTickPosition(QSlider::TicksBothSides);
	msize->setTickInterval(1);	msize->setPageStep(2);
	msize->setOrientation(Qt::Horizontal);

	connect(axial,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(ctext,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(swire,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(mask,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(angle,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(msize,SIGNAL(valueChanged(int)), this, SLOT(updatePic()));
	tab->addTab(p, tr("Color scheme"));

	// font style
	p = new QWidget(this);
	v = new QVBoxLayout(p);	v->setAlignment(Qt::AlignTop);
	h = new QHBoxLayout();	v->addLayout(h);
	u = new QVBoxLayout();	h->addLayout(u);
	bold = new QCheckBox(tr("Bold style"), p);	u->addWidget(bold);
	ital = new QCheckBox(tr("Italic style"), p);u->addWidget(ital);
	wire = new QCheckBox(tr("Wire style"), p);	u->addWidget(wire);
	uline = new QCheckBox(tr("Underline"), p);	u->addWidget(uline);
	oline = new QCheckBox(tr("Overline"), p);	u->addWidget(oline);
	font_sch = new QCheckBox(tr("Use color scheme"), p);	u->addWidget(font_sch);
	u = new QVBoxLayout();	h->addLayout(u);
	l = new QLabel(tr("Text color"), p);		u->addWidget(l);
	cfont = new QComboBox(p);	fillColors(cfont);	u->addWidget(cfont);
	u->addSpacing(6);
	align = new QGroupBox(tr("Text align"), p);	u->addWidget(align);
	vv = new QVBoxLayout(align);		//vv->addSpacing(11);
	rbL = new QRadioButton(tr("left"), align);	vv->addWidget(rbL);
	rbC = new QRadioButton(tr("at center"), align);
	vv->addWidget(rbC);	rbC->setChecked(true);
	rbR = new QRadioButton(tr("right"), align);	vv->addWidget(rbR);
	connect(bold,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(ital,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(wire,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(uline,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(oline,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(font_sch,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(cfont,SIGNAL(activated(int)), this, SLOT(updatePic()));
	connect(rbL,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(rbC,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	connect(rbR,SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	tab->addTab(p, tr("Font style"));
	connect(tab,SIGNAL(currentChanged(int)), this, SLOT(updatePic()));

	// hex-mask
	p = new QWidget(this);
	g = new QGridLayout(p);	g->setAlignment(Qt::AlignTop);
	for(int i=0;i<64;i++)
	{
		mask_bit[i] = new QToolButton(this);
		mask_bit[i]->setCheckable(true);
		g->addWidget(mask_bit[i],7-i/8,i%8);
		connect(mask_bit[i],SIGNAL(toggled(bool)), this, SLOT(updatePic()));
	}
	tab->addTab(p, tr("Manual mask"));

	// dialog itself
	v = new QVBoxLayout(this);	v->addWidget(tab);
	h = new QHBoxLayout();		v->addLayout(h);
	l = new QLabel(tr("Resulting string"), this);	h->addWidget(l);	h->addStretch(1);
	pic = new QLabel(this);	pic->setMinimumSize(QSize(128,30));	h->addWidget(pic);
	res = new QLineEdit(this);	res->setReadOnly(true);	v->addWidget(res);

	h = new QHBoxLayout();	v->addLayout(h);	h->addStretch(1);
	b = new QPushButton(tr("Cancel"), this);	h->addWidget(b);
	connect(b, SIGNAL(clicked()),this, SLOT(reject()));
	b = new QPushButton(tr("OK"), this);		h->addWidget(b);
	connect(b, SIGNAL(clicked()),this, SLOT(accept()));
	b->setDefault(true);
}
Example #10
0
Prefs::Prefs (QWidget * parent, OPTIONS *op, MISC *mi):
  QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose)
{
  options = op;
  misc = mi;

  mod_options = *op;
  mod_misc = *mi;

  setModal (TRUE);

  dataChanged = NVFalse;


  setWindowTitle (tr ("mosaicView Preferences"));


  QVBoxLayout *vbox = new QVBoxLayout (this);
  vbox->setMargin (5);
  vbox->setSpacing (5);

  QGroupBox *fbox = new QGroupBox (tr ("Position Format"), this);
  fbox->setWhatsThis (bGrpText);

  QRadioButton *hdms = new QRadioButton (tr ("Hemisphere Degrees Minutes Seconds.decimal"));
  QRadioButton *hdm_ = new QRadioButton (tr ("Hemisphere Degrees Minutes.decimal"));
  QRadioButton *hd__ = new QRadioButton (tr ("Hemisphere Degrees.decimal"));
  QRadioButton *sdms = new QRadioButton (tr ("+/-Degrees Minutes Seconds.decimal"));
  QRadioButton *sdm_ = new QRadioButton (tr ("+/-Degrees Minutes.decimal"));
  QRadioButton *sd__ = new QRadioButton (tr ("+/-Degrees.decimal"));

  bGrp = new QButtonGroup (this);
  bGrp->setExclusive (TRUE);
  connect (bGrp, SIGNAL (buttonClicked (int)), this, SLOT (slotPositionClicked (int)));

  bGrp->addButton (hdms, 0);
  bGrp->addButton (hdm_, 1);
  bGrp->addButton (hd__, 2);
  bGrp->addButton (sdms, 3);
  bGrp->addButton (sdm_, 4);
  bGrp->addButton (sd__, 5);

  QHBoxLayout *fboxSplit = new QHBoxLayout;
  QVBoxLayout *fboxLeft = new QVBoxLayout;
  QVBoxLayout *fboxRight = new QVBoxLayout;
  fboxSplit->addLayout (fboxLeft);
  fboxSplit->addLayout (fboxRight);
  fboxLeft->addWidget (hdms);
  fboxLeft->addWidget (hdm_);
  fboxLeft->addWidget (hd__);
  fboxRight->addWidget (sdms);
  fboxRight->addWidget (sdm_);
  fboxRight->addWidget (sd__);
  fbox->setLayout (fboxSplit);

  vbox->addWidget (fbox, 1);


  QGroupBox *miscBox = new QGroupBox (tr ("Miscellaneous"), this);
  QHBoxLayout *miscBoxLayout = new QHBoxLayout;
  miscBox->setLayout (miscBoxLayout);


  QGroupBox *zoomBox = new QGroupBox (tr ("Zoom percentage"), this);
  QHBoxLayout *zoomBoxLayout = new QHBoxLayout;
  zoomBox->setLayout (zoomBoxLayout);
  zoomPercent = new QSpinBox (zoomBox);
  zoomPercent->setRange (10, 50);
  zoomPercent->setSingleStep (5);
  zoomPercent->setToolTip (tr ("Change the zoom in/out percentage (10-50)"));
  zoomPercent->setWhatsThis (zoomPercentText);
  zoomBoxLayout->addWidget (zoomPercent);
  miscBoxLayout->addWidget (zoomBox);


  QGroupBox *featureBox = new QGroupBox (tr ("Feature Circle Diameter"), this);
  QHBoxLayout *featureBoxLayout = new QHBoxLayout;
  featureBox->setLayout (featureBoxLayout);
  featureDiameter = new QLineEdit (featureBox);
  featureDiameter->setToolTip (tr ("Change the add feature circle diameter (meters)"));
  featureDiameter->setWhatsThis (featureDiameterText);
  featureBoxLayout->addWidget (featureDiameter);
  miscBoxLayout->addWidget (featureBox);


  QGroupBox *textSearchBox = new QGroupBox (tr ("Feature search string"), this);
  QHBoxLayout *textSearchBoxLayout = new QHBoxLayout;
  textSearchBox->setLayout (textSearchBoxLayout);
  textSearch = new QLineEdit (textSearchBox);
  textSearch->setToolTip (tr ("Highlight features based on text search"));
  textSearch->setWhatsThis (textSearchText);
  textSearchBoxLayout->addWidget (textSearch);
  miscBoxLayout->addWidget (textSearchBox);


  vbox->addWidget (miscBox);


  QGroupBox *cbox = new QGroupBox (tr ("Colors"), this);
  QVBoxLayout *cboxLayout = new QVBoxLayout;
  cbox->setLayout (cboxLayout);
  QHBoxLayout *cboxTopLayout = new QHBoxLayout;
  QHBoxLayout *cboxBottomLayout = new QHBoxLayout;
  cboxLayout->addLayout (cboxTopLayout);
  cboxLayout->addLayout (cboxBottomLayout);


  bMarkerColor = new QPushButton (tr ("Marker"), this);
  bMarkerColor->setToolTip (tr ("Change marker color"));
  bMarkerColor->setWhatsThis (markerColorText);
  bMarkerPalette = bMarkerColor->palette ();
  connect (bMarkerColor, SIGNAL (clicked ()), this, SLOT (slotMarkerColor ()));
  cboxTopLayout->addWidget (bMarkerColor);


  bCoastColor = new QPushButton (tr ("Coast"), this);
  bCoastColor->setToolTip (tr ("Change coastline color"));
  bCoastColor->setWhatsThis (coastColorText);
  bCoastPalette = bCoastColor->palette ();
  connect (bCoastColor, SIGNAL (clicked ()), this, SLOT (slotCoastColor ()));
  cboxBottomLayout->addWidget (bCoastColor);


  bLandmaskColor = new QPushButton (tr ("Landmask"), this);
  bLandmaskColor->setToolTip (tr ("Change landmask color"));
  bLandmaskColor->setWhatsThis (landmaskColorText);
  bLandmaskPalette = bLandmaskColor->palette ();
  connect (bLandmaskColor, SIGNAL (clicked ()), this, SLOT (slotLandmaskColor ()));
  cboxTopLayout->addWidget (bLandmaskColor);


  bRectColor = new QPushButton (tr ("Zoom box"), this);
  bRectColor->setToolTip (tr ("Change zomm rectangle color"));
  bRectColor->setWhatsThis (rectColorText);
  bRectPalette = bRectColor->palette ();
  connect (bRectColor, SIGNAL (clicked ()), this, SLOT (slotRectColor ()));
  cboxBottomLayout->addWidget (bRectColor);


  bFeatureColor = new QPushButton (tr ("Feature"), this);
  bFeatureColor->setToolTip (tr ("Change feature color"));
  bFeatureColor->setWhatsThis (featureColorText);
  bFeaturePalette = bFeatureColor->palette ();
  connect (bFeatureColor, SIGNAL (clicked ()), this, SLOT (slotFeatureColor ()));
  cboxTopLayout->addWidget (bFeatureColor);


  bFeatureInfoColor = new QPushButton (tr ("Feature information"), this);
  bFeatureInfoColor->setToolTip (tr ("Change feature information text color"));
  bFeatureInfoColor->setWhatsThis (featureInfoColorText);
  bFeatureInfoPalette = bFeatureInfoColor->palette ();
  connect (bFeatureInfoColor, SIGNAL (clicked ()), this, SLOT (slotFeatureInfoColor ()));
  cboxBottomLayout->addWidget (bFeatureInfoColor);


  bFeaturePolyColor = new QPushButton (tr ("Feature polygon"), this);
  bFeaturePolyColor->setToolTip (tr ("Change feature polygonal area color"));
  bFeaturePolyColor->setWhatsThis (featurePolyColorText);
  bFeaturePolyPalette = bFeaturePolyColor->palette ();
  connect (bFeaturePolyColor, SIGNAL (clicked ()), this, SLOT (slotFeaturePolyColor ()));
  cboxTopLayout->addWidget (bFeaturePolyColor);


  bHighlightColor = new QPushButton (tr ("Highlight"), this);
  bHighlightColor->setToolTip (tr ("Change feature highlight color"));
  bHighlightColor->setWhatsThis (highlightColorText);
  bHighlightPalette = bHighlightColor->palette ();
  connect (bHighlightColor, SIGNAL (clicked ()), this, SLOT (slotHighlightColor ()));
  cboxBottomLayout->addWidget (bHighlightColor);


  vbox->addWidget (cbox, 1);


  QGroupBox *mBox = new QGroupBox (tr ("Display startup message"), this);
  QHBoxLayout *mBoxLayout = new QHBoxLayout;
  mBox->setLayout (mBoxLayout);
  sMessage = new QCheckBox (mBox);
  sMessage->setToolTip (tr ("Toggle display of startup message when program starts"));
  mBoxLayout->addWidget (sMessage);


  vbox->addWidget (mBox, 1);


  setFields ();


  QHBoxLayout *actions = new QHBoxLayout (0);
  vbox->addLayout (actions);

  QPushButton *bHelp = new QPushButton (this);
  bHelp->setIcon (QIcon (":/icons/contextHelp.xpm"));
  bHelp->setToolTip (tr ("Enter What's This mode for help"));
  connect (bHelp, SIGNAL (clicked ()), this, SLOT (slotHelp ()));
  actions->addWidget (bHelp);

  actions->addStretch (10);

  bRestoreDefaults = new QPushButton (tr ("Restore Defaults"), this);
  bRestoreDefaults->setToolTip (tr ("Restore all preferences to the default state"));
  bRestoreDefaults->setWhatsThis (restoreDefaultsText);
  connect (bRestoreDefaults, SIGNAL (clicked ()), this, SLOT (slotRestoreDefaults ()));
  actions->addWidget (bRestoreDefaults);

  QPushButton *applyButton = new QPushButton (tr ("OK"), this);
  applyButton->setToolTip (tr ("Accept changes and close dialog"));
  applyButton->setWhatsThis (applyPrefsText);
  connect (applyButton, SIGNAL (clicked ()), this, SLOT (slotApplyPrefs ()));
  actions->addWidget (applyButton);

  QPushButton *closeButton = new QPushButton (tr ("Cancel"), this);
  closeButton->setToolTip (tr ("Discard changes and close dialog"));
  closeButton->setWhatsThis (closePrefsText);
  connect (closeButton, SIGNAL (clicked ()), this, SLOT (slotClosePrefs ()));
  actions->addWidget (closeButton);


  show ();
}
void LDViewExportOption::populate(void)
{
	QWidget *parent;
	parent = m_box;
    LDExporterSettingList &settings = m_exporter->getSettings();
    LDExporterSettingList::iterator it;

	if (m_box != NULL)
	{
//		scrollArea->removeChild(m_box);
		scrollArea->adjustSize();
		delete m_box;
	}
	m_box = new QWidget(scrollArea);
	m_box->setObjectName("m_box");
	m_lay = new QVBoxLayout();
	m_lay->setObjectName("m_lay");
	m_lay->setMargin(11);
	m_lay->setSpacing(4);
	m_box->setLayout(m_lay);
	QVBoxLayout *vbl= NULL;
    std::stack<int> groupSizes;
	std::stack<QWidget *> parents;
    int groupSize = 0;
    for (it = settings.begin(); it != settings.end(); it++)
    {
        bool inGroup = groupSize > 0;

        if (groupSize > 0)
        {
            groupSize--;
            if (groupSize == 0)
            {
                // We just got to the end of a group, so pop the previous
                // groupSize value off the groupSizes stack.
                groupSize = groupSizes.top();
                groupSizes.pop();
				parent = parents.top();
				parents.pop();
//				vbl = new QVBoxLayout(parent->layout());
				//vbl = NULL;
            }
        }
        if (it->getGroupSize() > 0)
        {
            // This item is the start of a group.
            if (inGroup)
            {
                // At the beginning of this iteration we were in a group, so
                // use a bool setting instead of a group setting.
				QString qstmp;
				ucstringtoqstring(qstmp,it->getName());

				QCheckBox *check;
				check = new QCheckBox(qstmp,parent);
				check->setObjectName(qstmp);
				check->setChecked(it->getBoolValue());
				m_settings[&*it] = check;
				if (vbl)
				{
					vbl->addWidget(check);
					m_groups[vbl][&*it] = check;
				}
            }
            else
            {
                // Top level group; use a group setting.
				if (vbl)
				{
                	QSpacerItem *sp = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
                	QHBoxLayout *hbox;
                	QPushButton *rg;
                	hbox = new QHBoxLayout();
                	rg = new QPushButton("Reset Group");
                	hbox->addItem(sp);
                	hbox->addWidget(rg);
					rg->setObjectName("Reset Group");
                	vbl->addLayout(hbox);
					connect( rg, SIGNAL( clicked() ), this, SLOT( doResetGroup() ) );
				}
				QString qstmp;
				ucstringtoqstring(qstmp,it->getName());
				QGroupBox *gb;
				gb = new QGroupBox (qstmp, m_box);
				gb->setObjectName(qstmp);
				m_lay->addWidget(gb);
				vbl = new QVBoxLayout(gb);
				gb->setLayout(vbl);
				parent=gb;
				if (it->getType() == LDExporterSetting::TBool)
				{
					gb->setCheckable(true);
					gb->setChecked(it->getBoolValue());
					m_settings[&*it] = gb;
					m_groups[vbl][&*it] = gb;
				}
            }
			parents.push(parent);
            // We're now in a new group, so push the current groupSize onto
            // the groupSizes stack.
            groupSizes.push(groupSize);
            // Update groupSize based on the new group's size.
            groupSize = it->getGroupSize();
        }
        else
        {
            // This setting isn't the start of a group; add the appropriate type
            // of option UI to the canvas.
			QString qstmp;
			ucstringtoqstring(qstmp,it->getName());
			QHBoxLayout *hbox;
			QVBoxLayout *vbox;
			QLineEdit *li;
			QLabel *label;
			QHBoxLayout *hbox2;
			QCheckBox *check;
			hbox = new QHBoxLayout();
			hbox->setSpacing(4);
            switch (it->getType())
            {
            case LDExporterSetting::TBool:
				check = new QCheckBox(qstmp);
				check->setChecked(it->getBoolValue());
				check->setObjectName(qstmp);
				hbox->addWidget(check);
				m_settings[&*it] = check;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = check;
				}
                break;
            case LDExporterSetting::TFloat:
            case LDExporterSetting::TLong:
				// Long and float are intentionally handeled the same.
				label = new QLabel(qstmp);
				label->setObjectName(qstmp);
				hbox->addWidget(label);
				li = new QLineEdit(qstmp);
				li->setObjectName(qstmp);
				hbox->addWidget(li);
				ucstringtoqstring(qstmp,it->getStringValue());
				li->setText(qstmp);
				m_settings[&*it] = li;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = li;
				}
                break;
            case LDExporterSetting::TString:
				vbox = new QVBoxLayout();
				vbox->setSpacing(4);
				hbox->addLayout(vbox);
				label = new QLabel(qstmp);
				vbox->addWidget(label);
				hbox2 = new QHBoxLayout();
				hbox2->setSpacing(4);
				vbox->addLayout(hbox2);
				li = new QLineEdit(qstmp);
				hbox2->addWidget(li);
				ucstringtoqstring(qstmp,it->getStringValue());
				li->setText(qstmp);
				m_settings[&*it] = li;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = li;
				}
				if (it->isPath())
				{
					QPushButton *but = new QPushButton();
					but->setText(TCObject::ls("LDXBrowse..."));
					hbox2->addWidget(but);
					connect( but, SIGNAL( clicked() ), this, SLOT( doBrowse()));
					m_button[but]=li;
				}
                break;
            case LDExporterSetting::TEnum:
				vbox = new QVBoxLayout();
				vbox->setSpacing(4);
				hbox->addLayout(vbox);
                label = new QLabel(qstmp);
		vbox->addWidget(label);
				QComboBox *combo;
				combo = new QComboBox();
				vbox->addWidget(combo);
				for (size_t i = 0; i < it->getOptions().size(); i++)
				{
					ucstringtoqstring(qstmp,it->getOptions()[i]);
					combo->addItem(qstmp);
				}
				combo->setCurrentIndex(it->getSelectedOption());
				m_settings[&*it] = combo;
				if (vbl != NULL)
				{
					m_groups[vbl][&*it] = combo;
				}
                break;
            default:
                throw "not implemented";
            }
			if (it->getTooltip().size() > 0)
			{
				ucstringtoqstring(qstmp, it->getTooltip());
				//QToolTip::add(hbox, qstmp);
			}
			if (vbl) vbl->addLayout(hbox);
        }
	}
    if (vbl)
    {
        QSpacerItem *sp = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
        QHBoxLayout *hbox;
        QPushButton *rg;
        hbox = new QHBoxLayout();
        rg = new QPushButton("Reset Group");
		rg->setObjectName("Reset Group");
        hbox->addItem(sp);
        hbox->addWidget(rg);
        vbl->addLayout(hbox);
		connect( rg, SIGNAL( clicked() ), this, SLOT( doResetGroup() ) );
    }

	m_lay->addStretch();
	scrollArea->setWidget(m_box);
	m_box->adjustSize();
	scrollArea->adjustSize();
//	resize(width() + m_box->width() - scrollArea->visibleWidth(), height());
	setFixedWidth(width());
}
Example #12
0
void RfxDialog::AddUniformBox(RfxUniform *uni, int uniIndex)
{
	assert(uni);

	QLabel *lblUni = new QLabel();
	QString lblText;

	lblText.append(QString("(Pass #%1) ").arg(selPass));
	lblText.append(uni->GetName());

	if (!uni->GetSemantic().isNull()) {
		lblText.append("<span style=\"color:darkgreen;\"><br/> [P: ");
		lblText.append(uni->GetSemantic());
		lblText.append("]</span>");
	}

	lblUni->setText(lblText);

	QGridLayout *gridUni = new QGridLayout();

	switch (uni->GetType()) {
	case RfxUniform::INT:
	case RfxUniform::FLOAT:
	case RfxUniform::BOOL:
		DrawIFace(gridUni, uni, uniIndex, 1, 1);
		break;

	case RfxUniform::VEC2:
	case RfxUniform::IVEC2:
	case RfxUniform::BVEC2:
		DrawIFace(gridUni, uni, uniIndex, 1, 2);
		break;

	case RfxUniform::VEC3:
	case RfxUniform::IVEC3:
	case RfxUniform::BVEC3:
		DrawIFace(gridUni, uni, uniIndex, 1, 3);
		break;

	case RfxUniform::VEC4:
		if(uni->isRmColorVariable()){
			DrawIFace(gridUni, uni, uniIndex, 1, 1);
			break;
		}
	case RfxUniform::IVEC4:
	case RfxUniform::BVEC4:
		DrawIFace(gridUni, uni, uniIndex, 1, 4);
		break;

	case RfxUniform::MAT2:
		DrawIFace(gridUni, uni, uniIndex, 2, 2);
		break;

	case RfxUniform::MAT3:
		DrawIFace(gridUni, uni, uniIndex, 3, 3);
		break;

	case RfxUniform::MAT4:
		DrawIFace(gridUni, uni, uniIndex, 4, 4);
		break;

	default:
		return;
	}

	QHBoxLayout *boxContent = new QHBoxLayout();
	boxContent->addWidget(lblUni);
	boxContent->addLayout(gridUni);

	((QVBoxLayout*)ui.scrollUniformsContents->layout())->addLayout(boxContent);
}
Example #13
0
int main(int argc, char **argv)
{
    QApplication app(argc, argv);
    Q3DSurface *graph = new Q3DSurface();
    QWidget *container = QWidget::createWindowContainer(graph);
    QSize screenSize = graph->screen()->size();
    container->setMinimumSize(QSize(screenSize.width() / 2, screenSize.height() / 1.6));
    container->setMaximumSize(screenSize);
    container->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    container->setFocusPolicy(Qt::StrongFocus);
    QWidget *widget = new QWidget;
    QHBoxLayout *hLayout = new QHBoxLayout(widget);
    QVBoxLayout *vLayout = new QVBoxLayout();
    hLayout->addLayout(vLayout);
    hLayout->addWidget(container, 1);
    vLayout->setAlignment(Qt::AlignTop);
    widget->setWindowTitle(QStringLiteral("Интерполяция"));
    QGroupBox *modelGroupBox = new QGroupBox(QStringLiteral("Графики"));
    QRadioButton *InitPlotModelRB = new QRadioButton(widget);
    InitPlotModelRB->setText(QStringLiteral("Начальный график"));
    InitPlotModelRB->setChecked(false);
    QRadioButton *InterpModelRB = new QRadioButton(widget);
    InterpModelRB->setText(QStringLiteral("Интерполяция"));
    InterpModelRB->setChecked(false);
    QRadioButton *InitInterpModelRB = new QRadioButton(widget);
    InitInterpModelRB->setText(QStringLiteral("Изначальный и интерполяция"));
    InitInterpModelRB->setChecked(false);
    QRadioButton *ResidModelRB = new QRadioButton(widget);
    ResidModelRB->setText(QStringLiteral("Невязка"));
    ResidModelRB->setChecked(false);
    QVBoxLayout *modelVBox = new QVBoxLayout;
    modelVBox->addWidget(InitPlotModelRB);
    modelVBox->addWidget(InterpModelRB);
    modelVBox->addWidget(InitInterpModelRB);
    modelVBox->addWidget(ResidModelRB);
    modelGroupBox->setLayout(modelVBox);
    QLabel *countN = new QLabel(widget);
    QLabel *countM = new QLabel(widget);
    vLayout->addWidget(modelGroupBox);
    vLayout->addWidget(new QLabel(QStringLiteral("точек на оси Х")));
    vLayout->addWidget(countN);
    vLayout->addWidget(new QLabel(QStringLiteral("точек на оси Z")));
    vLayout->addWidget(countM);
    vLayout->addWidget((new QLabel(QStringLiteral("1-графики\n"
                                                  "2-больше точек на Х\n"
                                                  "3-больше точек на Z\n"
                                                  "4-увеличить диапазон X\n"
                                                  "5-уменьшить диапазон X\n"
                                                  "6-увеличить диапазон Z\n"
                                                  "7-уменьшить диапазон Z\n"
                                                  "8-меньше точек на X\n"
                                                  "9-меньше точек на Z"))));
    widget->show();
    SurfaceGraph *modifier = new SurfaceGraph(graph);
    modifier->key1 = new QShortcut(widget);
    modifier->key1->setKey(Qt::Key_1);
    QObject::connect(modifier->key1, SIGNAL(activated()), modifier, SLOT(slotShortcut1()));
    modifier->key2 = new QShortcut(widget);
    modifier->key2->setKey(Qt::Key_2);
    QObject::connect(modifier->key2, SIGNAL(activated()), modifier, SLOT(slotShortcut2()));
    modifier->key3 = new QShortcut(widget);
    modifier->key3->setKey(Qt::Key_3);
    QObject::connect(modifier->key3, SIGNAL(activated()), modifier, SLOT(slotShortcut3()));
    modifier->key4 = new QShortcut(widget);
    modifier->key4->setKey(Qt::Key_4);
    QObject::connect(modifier->key4, SIGNAL(activated()), modifier, SLOT(slotShortcut4()));
    modifier->key5 = new QShortcut(widget);
    modifier->key5->setKey(Qt::Key_5);
    QObject::connect(modifier->key5, SIGNAL(activated()), modifier, SLOT(slotShortcut5()));
    modifier->key6 = new QShortcut(widget);
    modifier->key6->setKey(Qt::Key_6);
    QObject::connect(modifier->key6, SIGNAL(activated()), modifier, SLOT(slotShortcut6()));
    modifier->key7 = new QShortcut(widget);
    modifier->key7->setKey(Qt::Key_7);
    QObject::connect(modifier->key7, SIGNAL(activated()), modifier, SLOT(slotShortcut7()));
    modifier->key8 = new QShortcut(widget);
    modifier->key8->setKey(Qt::Key_8);
    QObject::connect(modifier->key8, SIGNAL(activated()), modifier, SLOT(slotShortcut8()));
    modifier->key9 = new QShortcut(widget);
    modifier->key9->setKey(Qt::Key_9);
    QObject::connect(modifier->key9, SIGNAL(activated()), modifier, SLOT(slotShortcut9()));


    QObject::connect(InitPlotModelRB, &QRadioButton::toggled,
                     modifier, &SurfaceGraph::enableInitPlotModel);
    QObject::connect(InterpModelRB, &QRadioButton::toggled,
                     modifier, &SurfaceGraph::enableInterpModel);
    QObject::connect(InitInterpModelRB, &QRadioButton::toggled,
                     modifier, &SurfaceGraph::enableInitInterpModel);
    QObject::connect(ResidModelRB, &QRadioButton::toggled,
                     modifier, &SurfaceGraph::enableResidModel);
    InitPlotModelRB->setChecked(true);
    modifier->setCount(countN, countM);
    modifier->setKol(InitPlotModelRB,InterpModelRB, InitInterpModelRB,ResidModelRB);  //изначально выставим точки
    return app.exec();
}
EnvironmentWidget::EnvironmentWidget(QWidget *parent, QWidget *additionalDetailsWidget)
    : QWidget(parent), d(new EnvironmentWidgetPrivate)
{
    d->m_model = new Utils::EnvironmentModel();
    connect(d->m_model, SIGNAL(userChangesChanged()),
            this, SIGNAL(userChangesChanged()));
    connect(d->m_model, SIGNAL(modelReset()),
            this, SLOT(invalidateCurrentIndex()));

    connect(d->m_model, SIGNAL(focusIndex(QModelIndex)),
            this, SLOT(focusIndex(QModelIndex)));

    QVBoxLayout *vbox = new QVBoxLayout(this);
    vbox->setContentsMargins(0, 0, 0, 0);

    d->m_detailsContainer = new Utils::DetailsWidget(this);

    QWidget *details = new QWidget(d->m_detailsContainer);
    d->m_detailsContainer->setWidget(details);
    details->setVisible(false);

    QVBoxLayout *vbox2 = new QVBoxLayout(details);
    vbox2->setMargin(0);

    if (additionalDetailsWidget)
        vbox2->addWidget(additionalDetailsWidget);

    QHBoxLayout *horizontalLayout = new QHBoxLayout();
    horizontalLayout->setMargin(0);
    d->m_environmentView = new Internal::EnvironmentTreeView(this);
    d->m_environmentView->setModel(d->m_model);
    d->m_environmentView->setItemDelegate(new EnvironmentDelegate(d->m_model, d->m_environmentView));
    d->m_environmentView->setMinimumHeight(400);
    d->m_environmentView->setRootIsDecorated(false);
    d->m_environmentView->setUniformRowHeights(true);
    new Utils::HeaderViewStretcher(d->m_environmentView->header(), 1);
    d->m_environmentView->setSelectionMode(QAbstractItemView::SingleSelection);
    d->m_environmentView->setSelectionBehavior(QAbstractItemView::SelectItems);
    d->m_environmentView->setFrameShape(QFrame::NoFrame);
    QFrame *findWrapper = Core::ItemViewFind::createSearchableWrapper(d->m_environmentView, Core::ItemViewFind::LightColored);
    findWrapper->setFrameStyle(QFrame::StyledPanel);
    horizontalLayout->addWidget(findWrapper);

    QVBoxLayout *buttonLayout = new QVBoxLayout();

    d->m_editButton = new QPushButton(this);
    d->m_editButton->setText(tr("&Edit"));
    buttonLayout->addWidget(d->m_editButton);

    d->m_addButton = new QPushButton(this);
    d->m_addButton->setText(tr("&Add"));
    buttonLayout->addWidget(d->m_addButton);

    d->m_resetButton = new QPushButton(this);
    d->m_resetButton->setEnabled(false);
    d->m_resetButton->setText(tr("&Reset"));
    buttonLayout->addWidget(d->m_resetButton);

    d->m_unsetButton = new QPushButton(this);
    d->m_unsetButton->setEnabled(false);
    d->m_unsetButton->setText(tr("&Unset"));
    buttonLayout->addWidget(d->m_unsetButton);

    d->m_batchEditButton = new QPushButton(this);
    d->m_batchEditButton->setText(tr("&Batch Edit..."));
    buttonLayout->addWidget(d->m_batchEditButton);

    buttonLayout->addStretch();

    horizontalLayout->addLayout(buttonLayout);
    vbox2->addLayout(horizontalLayout);

    vbox->addWidget(d->m_detailsContainer);

    connect(d->m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)),
            this, SLOT(updateButtons()));

    connect(d->m_editButton, SIGNAL(clicked(bool)),
            this, SLOT(editEnvironmentButtonClicked()));
    connect(d->m_addButton, SIGNAL(clicked(bool)),
            this, SLOT(addEnvironmentButtonClicked()));
    connect(d->m_resetButton, SIGNAL(clicked(bool)),
            this, SLOT(removeEnvironmentButtonClicked()));
    connect(d->m_unsetButton, SIGNAL(clicked(bool)),
            this, SLOT(unsetEnvironmentButtonClicked()));
    connect(d->m_batchEditButton, SIGNAL(clicked(bool)),
            this, SLOT(batchEditEnvironmentButtonClicked()));
    connect(d->m_environmentView->selectionModel(), SIGNAL(currentChanged(QModelIndex,QModelIndex)),
            this, SLOT(environmentCurrentIndexChanged(QModelIndex)));

    connect(d->m_detailsContainer, SIGNAL(linkActivated(QString)),
            this, SLOT(linkActivated(QString)));

    connect(d->m_model, SIGNAL(userChangesChanged()), this, SLOT(updateSummaryText()));
}
Example #15
0
MainWindow::MainWindow(AmViewerState *state) : _state(state) {
    _state->recon_tree = NULL;
    _state->amEvent = NULL;
    _state->show_dBm = false;
    _state->filtered = true;
    _state->sumpols = false;
    _state->resetSearch(); // couldn't hurt?

    setWindowTitle("AmViewer");

    // creat dialogs
    _searchWindow = new SearchWindow(this,_state);
    _visWindow = new VisWindow(this,_state);
    _fovWindow = new FovWindow(this,_state);
    _filterWindow = NULL;
    _infoWindow = NULL;

    QWidget *centralWidget = new QWidget();
    setCentralWidget(centralWidget);
    QVBoxLayout *bigLayout = new QVBoxLayout(centralWidget);

    // File menu
    QAction *quitMenu = new QAction("&Exit",this);
    quitMenu->setShortcut(tr("Ctrl+Q"));
    connect(quitMenu,SIGNAL(triggered()),qApp,SLOT(quit()));

    QAction *openMenu = new QAction("&Open ROOT file...",this);
    openMenu->setShortcut(tr("Ctrl+O"));
    connect(openMenu,SIGNAL(triggered()),this,SLOT(openFile()));

    _saveMenu = new QAction("&Save event candidates...",this);
    connect(_saveMenu,SIGNAL(triggered()),this,SLOT(saveFile()));

    QMenu *fileDrop;
    fileDrop = menuBar()->addMenu("&File");
    fileDrop->addAction(openMenu);
    fileDrop->addAction(_saveMenu);
    fileDrop->addAction(quitMenu);

    _saveMenu->setEnabled(false);

    // View menu
    _unitsMenu = new QAction("&Display dBm",this);
    _unitsMenu->setCheckable(true);
    _unitsMenu->setChecked(false);
    connect(_unitsMenu,SIGNAL(triggered()),this,SLOT(applyUnits()));

    // Filter dialog
    _filterMenu = new QAction("&Filter Settings",this);
    connect(_filterMenu,SIGNAL(triggered()),this,SLOT(openFilter()));

    // Polarization checkbox
    _polMenu = new QAction("&Sum Polarizations",this);
    _polMenu->setCheckable(true);
    _polMenu->setChecked(false);
    _polMenu->setEnabled(false);
    connect(_polMenu,SIGNAL(triggered()),this,SLOT(applySumPol()));

    QMenu *viewDrop;
    viewDrop = menuBar()->addMenu("&View");
    viewDrop->addAction(_unitsMenu);
    viewDrop->addAction(_polMenu);
    viewDrop->addAction(_filterMenu);
    _filterMenu->setEnabled(false);

    // Analysis menu
    QAction *infoMenu = new QAction("&Event Info",this);
    connect(infoMenu,SIGNAL(triggered()),this,SLOT(openInfo()));

    _analysisDrop = menuBar()->addMenu("&Analysis");
    _analysisDrop->addAction(infoMenu);

    QAction *searchMenu = new QAction("&Search Parameters",this);
    connect(searchMenu,SIGNAL(triggered()),this,SLOT(openSearch()));

    _analysisDrop->addAction(searchMenu);
    _analysisDrop->setEnabled(false);

    QAction *visMenu = new QAction("&Event Visualization",this);
    connect(visMenu,SIGNAL(triggered()),this,SLOT(openVis()));
    _analysisDrop->addAction(visMenu);

    QAction*fovMenu = new QAction("&AMBER Field of View",this);
    connect(fovMenu,SIGNAL(triggered()),this,SLOT(openFov()));
    _analysisDrop->addAction(fovMenu);

    // Set up layout for event browser, pixel windows, graphs
    QHBoxLayout *hbox = new QHBoxLayout();
    bigLayout->addLayout(hbox);

    // Event list stuff
    _eventList = new QTreeWidget(this);
    _eventList->setColumnCount(2);
    _eventList->setColumnHidden(1,true); //'true' valid in C++?

    QTreeWidgetItem *_source0 = new QTreeWidgetItem(_eventList);
    _source0->setText(0,"Source:0 (LTRIG)");

    QTreeWidgetItem *_source1 = new QTreeWidgetItem(_eventList);
    _source1->setText(0,"Source:1 (PPS)");

    QTreeWidgetItem *_source2 = new QTreeWidgetItem(_eventList);
    _source2->setText(0,"Source:2 (Auger)");

    _eventList->setHeaderLabel("Events");

    hbox->addWidget(_eventList);

    // Some gross stuff concerning the clickable horns
    _hornDisplay = new HornDisplay(this,1);

    CenterHorns *centerLegend = new CenterHorns("center",true);
    QGraphicsProxyWidget *centerLegendProxy = new QGraphicsProxyWidget();
    centerLegendProxy->setWidget(centerLegend->widget);

    _hornDisplay->hornScene->addItem(centerLegendProxy);

    centerLegendProxy->rotate(45);
    centerLegendProxy->setPos(0,-50);
    centerLegendProxy->setZValue(0.0);

    AmHorn *ppsHorn[4];

    int i;
    stringstream out;

    QToolButton *b;

    for(i=0; i<4; i++) {
        b = new QToolButton();
        b->setFixedSize(25,25);
        out.str("");
        out << (i+1);
        ppsHorn[i] = new AmHorn(b,"PPS" + out.str());
        ppsHorn[i]->proxyWidget = new QGraphicsProxyWidget();
        ppsHorn[i]->proxyWidget->setWidget(ppsHorn[i]->_button);
        _hornDisplay->hornScene->addItem(ppsHorn[i]->proxyWidget);
        ppsHorn[i]->proxyWidget->setPos(25*i-145,375);

        // probably stupid, delete
        //ppsHorn[i]->trigger_color = "blue";
        //ppsHorn[i]->updateStyle();

        //delete b;
    }

    QGraphicsSimpleTextItem *item;

    for(i=0; i<4; i++) {
        item = new QGraphicsSimpleTextItem();
        _hornDisplay->hornScene->addItem(item);
        if(i==0) {
            item->setText("CH");
            item->setPos(-7,-31);
            item->setZValue(1.0);
        }
        if(i==1) {
            item->setText("CV");
            item->setPos(-7,5);
            item->setZValue(1.0);
        }
        if(i==2) {
            item->setText("KH");
            item->setPos(-24,-15);
            item->setZValue(1.0);
        }
        if(i==3) {
            item->setText("KV");
            item->setPos(12,-15);
            item->setZValue(1.0);
        }
        //delete item;
    }

    // CRUFT ALERT
    // THIS WHOLE NEXT LOOP IS HIGHLY SUSPECT, I DOUBT IT DOES ANYTHING
    QString qstr;
    for(i=0; i<16; i++) {
        out.str("");
        out << (i+1);
        qstr = QString::fromStdString(out.str());
        item = new QGraphicsSimpleTextItem(qstr);
        _hornDisplay->hornScene->addItem(item);
        if(i==0)
            item->setPos(-2.5,75.0);
        else if(i==1)
            item->setPos(-105.0,177.5);
        else if(i==2)
            item->setPos(-2.5,280.0);
        else if(i==3)
            item->setPos(102.5,177.5);
        else if(i==4)
            item->setPos(-70.0,55.0);
        else if(i==5)
            item->setPos(-95.0,80.0);
        else if(i==6)
            item->setPos(-120.0,105.0);
        else if(i==7)
            item->setPos(-125.0,250.0);
        else if(i==8)
            item->setPos(-100.0,275.5);
        else if(i==9)
            item->setPos(-75.0,300.0);
        else if(i==10)
            item->setPos(60.0,300.0);
        else if(i==11)
            item->setPos(85.0,275.0);
        else if(i==12)
            item->setPos(110.0,250.0);
        else if(i==13)
            item->setPos(120.0,110.0);
        else if(i==14)
            item->setPos(95.0,85.0);
        else if(i==15)
            item->setPos(70.0,60.0);
    }

    QVBoxLayout *evVbox = new QVBoxLayout();
    hbox->addLayout(evVbox);

    QGridLayout *evInfoGrid = new QGridLayout();
    evVbox->addLayout(evInfoGrid);

    _evIdLabel = new QLabel("");
    _evSourceLabel = new QLabel("");
    _evSecLabel = new QLabel("");
    _evNsLabel = new QLabel("");
    _evInfoLabel = new QLabel("");

    evInfoGrid->addWidget(_evIdLabel,0,0);
    evInfoGrid->addWidget(_evSourceLabel,0,1);
    evInfoGrid->addWidget(_evSecLabel,1,0);
    evInfoGrid->addWidget(_evNsLabel,1,1);
    evInfoGrid->addWidget(_evInfoLabel,2,0);

    evVbox->addWidget(_hornDisplay);

    QVBoxLayout *pixelVbox = new QVBoxLayout();
    hbox->addLayout(pixelVbox);

    for(i=0; i<4; i++) {
        pixelWindow[i] = new PixelWindow(this,i);
        pixelWindow[i]->setMinimumHeight(100);
        pixelWindow[i]->setMinimumWidth(300);
        pixelVbox->addWidget(pixelWindow[i]);
    }

    for(i=0; i<28; i++) {
        _hornDisplay->channel[i]->setHornClickFunction(this);
        connect(_hornDisplay->channel[i]->_button,SIGNAL(clicked()),_hornDisplay->channel[i],SLOT(hornClick()));
    }

    for(i=0; i<4; i++) {
        //ppsHorn[i]->setHornClickFunction(clickHornSetPixel);
        ppsHorn[i]->setHornClickFunction(this);
        connect(ppsHorn[i]->_button,SIGNAL(clicked()),ppsHorn[i],SLOT(hornClick()));
    }
}
Example #16
0
PreFlightMiscPage::PreFlightMiscPage(QWidget *parent) :
  QWidget(parent)
{
  setObjectName("PreFlightMiscPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Common") );

  if( parent )
    {
      resize( parent->size() );
    }

  // Layout used by scroll area
  QHBoxLayout *sal = new QHBoxLayout;

  // new widget used as container for the dialog layout.
  QWidget* sw = new QWidget;

  // Scroll area
  QScrollArea* sa = new QScrollArea;
  sa->setWidgetResizable( true );
  sa->setFrameStyle( QFrame::NoFrame );
  sa->setWidget( sw );

#ifdef QSCROLLER
  QScroller::grabGesture( sa->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture( sa->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  // Add scroll area to its own layout
  sal->addWidget( sa );

  QHBoxLayout *contentLayout = new QHBoxLayout(this);

  // Pass scroll area layout to the content layout.
  contentLayout->addLayout( sal, 10 );

  // Top layout's parent is the scroll widget
  QGridLayout *topLayout = new QGridLayout(sw);

  int row = 0;

  QLabel *lbl = new QLabel(tr("Minimal arrival altitude:"));
  topLayout->addWidget(lbl, row, 0);

  // get current set altitude unit. This unit must be considered during
  // storage. The internal storage is always in meters.
  m_altUnit = Altitude::getUnit();

  // Input accept only feet and meters all other make no sense. Therefore all
  // other (FL) is treated as feet.
  m_edtMinimalArrival = new NumberEditor;
  m_edtMinimalArrival->setDecimalVisible( false );
  m_edtMinimalArrival->setPmVisible( false );
  m_edtMinimalArrival->setRange( 0, 9999);
  m_edtMinimalArrival->setMaxLength(4);
  m_edtMinimalArrival->setSuffix(" " + Altitude::getUnitText());

  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,4})" ), this );
  m_edtMinimalArrival->setValidator( eValidator );

  int maw = QFontMetrics(font()).width("9999 ft") + 10;
  m_edtMinimalArrival->setMinimumWidth( maw );

  topLayout->addWidget(m_edtMinimalArrival, row, 1);
  topLayout->setColumnStretch(2, 2);
  row++;

  lbl = new QLabel(tr("Arrival altitude display:"));
  topLayout->addWidget(lbl, row, 0);
  m_edtArrivalAltitude = new QComboBox;
  m_edtArrivalAltitude->addItem( tr("Landing Target"), GeneralConfig::landingTarget );
  m_edtArrivalAltitude->addItem( tr("Next Target"), GeneralConfig::nextTarget );
  topLayout->addWidget(m_edtArrivalAltitude, row, 1);
  row++;

  lbl = new QLabel(tr("QNH:"));
  topLayout->addWidget(lbl, row, 0);

  m_edtQNH = new NumberEditor;
  m_edtQNH->setDecimalVisible( false );
  m_edtQNH->setPmVisible( false );
  m_edtQNH->setRange( 0, 9999);
  m_edtQNH->setMaxLength(4);
  m_edtQNH->setSuffix(" hPa");

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,4})" ), this );
  m_edtQNH->setValidator( eValidator );

  int mqw = QFontMetrics(font()).width("9999 hPa") + 10;
  m_edtQNH->setMinimumWidth( mqw );

  topLayout->addWidget(m_edtQNH, row, 1);
  row++;

  lbl = new QLabel(tr("LD average time") + ":");
  topLayout->addWidget(lbl, row, 0);

  m_edtLDTime = new NumberEditor;
  m_edtLDTime->setDecimalVisible( false );
  m_edtLDTime->setPmVisible( false );
  m_edtLDTime->setRange( 5, 600 );
  m_edtLDTime->setMaxLength(3);
  m_edtLDTime->setSuffix(" s");
  m_edtLDTime->setTitle( tr("LD average time") );
  m_edtLDTime->setTip( "5 ... 600 s" );

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,3})" ), this );
  m_edtLDTime->setValidator( eValidator );

  topLayout->addWidget(m_edtLDTime, row, 1);
  row++;

  topLayout->setRowMinimumHeight(row, 10);
  row++;

  m_chkLogAutoStart = new QCheckBox(tr("Autostart IGC logger"));
  topLayout->addWidget(m_chkLogAutoStart, row, 0 );

  // get current used horizontal speed unit. This unit must be considered
  // during storage.
  m_speedUnit = Speed::getHorizontalUnit();

  m_logAutoStartSpeed = new DoubleNumberEditor( this );
  m_logAutoStartSpeed->setDecimalVisible( true );
  m_logAutoStartSpeed->setPmVisible( false );
  m_logAutoStartSpeed->setMaxLength(4);
  m_logAutoStartSpeed->setRange( 1.0, 99.9);
  m_logAutoStartSpeed->setPrefix( "> " );
  m_logAutoStartSpeed->setSuffix( QString(" ") + Speed::getHorizontalUnitText() );
  m_logAutoStartSpeed->setDecimals( 1 );

  int mlw = QFontMetrics(font()).width("99.9" + Speed::getHorizontalUnitText()) + 10;
  m_logAutoStartSpeed->setMinimumWidth( mlw );

  topLayout->addWidget( m_logAutoStartSpeed, row, 1 );
  row++;

  lbl = new QLabel(tr("B-Record Interval:"));
  topLayout->addWidget(lbl, row, 0);

  m_bRecordInterval = new NumberEditor;
  m_bRecordInterval->setDecimalVisible( false );
  m_bRecordInterval->setPmVisible( false );
  m_bRecordInterval->setRange( 1, 60);
  m_bRecordInterval->setTip("1...60 s");
  m_bRecordInterval->setMaxLength(2);
  m_bRecordInterval->setSuffix(" s");

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,2})" ), this );
  m_bRecordInterval->setValidator( eValidator );

  int mbrw = QFontMetrics(font()).width("99 s") + 10;
  m_bRecordInterval->setMinimumWidth( mbrw );

  topLayout->addWidget(m_bRecordInterval, row, 1);
  row++;

  lbl = new QLabel(tr("K-Record Interval:"));
  topLayout->addWidget(lbl, row, 0);

  m_kRecordInterval = new NumberEditor;
  m_kRecordInterval->setDecimalVisible( false );
  m_kRecordInterval->setPmVisible( false );
  m_kRecordInterval->setRange( 0, 300);
  m_kRecordInterval->setTip("0...300 s");
  m_kRecordInterval->setMaxLength(3);
  m_kRecordInterval->setSuffix(" s");
  m_kRecordInterval->setSpecialValueText(tr("Off"));

  eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,2})" ), this );
  m_kRecordInterval->setValidator( eValidator );

  int mkrw = QFontMetrics(font()).width("999 s") + 10;
  m_kRecordInterval->setMinimumWidth( mkrw );

  topLayout->addWidget(m_kRecordInterval, row, 1);
  row++;

  topLayout->setRowMinimumHeight(row, 10);
  row++;

  topLayout->setRowStretch(row, 10);

  QPushButton *help = new QPushButton(this);
  help->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("help32.png")));
  help->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  help->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QPushButton *ok = new QPushButton(this);
  ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  ok->setIconSize(QSize(Layout::getButtonSize(12), Layout::getButtonSize(12)));
  ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);

  QLabel *titlePix = new QLabel(this);
  titlePix->setAlignment( Qt::AlignCenter );
  titlePix->setPixmap( _globalMapConfig->createGlider(315, 1.6) );

  connect(help, SIGNAL(pressed()), this, SLOT(slotHelp()));
  connect(ok, SIGNAL(pressed()), this, SLOT(slotAccept()));
  connect(cancel, SIGNAL(pressed()), this, SLOT(slotReject()));

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addWidget(help, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(ok, 1);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
  contentLayout->addLayout(buttonBox);

  load();
}
Example #17
0
CDialogPaveNum::CDialogPaveNum()
	: QDialog()
{
	
	m_tabWidget = new QTabWidget(this);
	QWidget* widgetMain= new QWidget(this);

	//Barre de gauche
	/*m_lblNameSeuil1 = new QLabel(tr("Valeur max :"), this);
	m_lblNameSeuil1->setObjectName("lblPaveNumTxtBorne");
	m_lblValueSeuil1 = new QLabel(tr("Value"), this);
	m_lblValueSeuil1->setObjectName("lblPaveNumValueBorne");
	m_lblNameSeuil2 = new QLabel(tr("Valeur min :"), this);
	m_lblNameSeuil2->setObjectName("lblPaveNumTxtBorne");
	m_lblValueSeuil2 = new QLabel(tr("Value"), this);
	m_lblValueSeuil2->setObjectName("lblPaveNumValueBorne");*/
	
	/*QFormLayout* formLayout = new QFormLayout();
	formLayout->addRow(m_lblNameSeuil1, m_lblValueSeuil1);
	formLayout->addRow(m_lblNameSeuil2, m_lblValueSeuil2);*/
		

	//Block du milleu
	m_lblValue = new QLineEdit("0000000", this);
	m_lblValue->setEnabled(false);
	m_lblValue->setAlignment(Qt::AlignRight);
	//m_lblValue->setObjectName("lineEdit");
	//m_lblValue->setObjectName("lblPaveNumValue");
	//: Virgule à changer en point pour les nombres
	m_btComma = new QPushButton(tr(","), this);
	m_btComma->setObjectName("btPaveNum");
	m_btPlusMinus = new QPushButton("+/-", this);
	m_btPlusMinus->setObjectName("btPaveNum");
	m_btZero = new QPushButton("0", this);
	m_btZero->setObjectName("btPaveNum");
	m_btOne = new QPushButton("1", this);
	m_btOne->setObjectName("btPaveNum");
	m_btTwo = new QPushButton("2", this);
	m_btTwo->setObjectName("btPaveNum");
	m_btThree = new QPushButton("3", this);
	m_btThree->setObjectName("btPaveNum");
	m_btFour = new QPushButton("4", this);
	m_btFour->setObjectName("btPaveNum");
	m_btFive = new QPushButton("5", this);
	m_btFive->setObjectName("btPaveNum");
	m_btSix = new QPushButton("6", this);
	m_btSix->setObjectName("btPaveNum");
	m_btSeven = new QPushButton("7", this);
	m_btSeven->setObjectName("btPaveNum");
	m_btEight = new QPushButton("8", this);
	m_btEight->setObjectName("btPaveNum");
	m_btNine = new QPushButton("9", this);
	m_btNine->setObjectName("btPaveNum");

	QGridLayout* gridLayoutPaveNum = new QGridLayout();
	gridLayoutPaveNum->addWidget(m_btOne, 0, 0, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btTwo, 0, 1, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btThree, 0, 2, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btFour, 1, 0, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btFive, 1, 1, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btSix, 1, 2, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btSeven, 2, 0, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btEight, 2, 1, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btNine, 2, 2, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btPlusMinus, 3, 0, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btZero, 3, 1, Qt::AlignCenter);
	gridLayoutPaveNum->addWidget(m_btComma, 3, 2, Qt::AlignCenter);

	QVBoxLayout* vLayoutPaveNum = new QVBoxLayout();
	vLayoutPaveNum->addWidget(m_lblValue, 0, Qt::AlignRight);
	vLayoutPaveNum->addLayout(gridLayoutPaveNum);

	//Menu de droite
	m_btApply = new QPushButton();
	m_btApply->setObjectName("btApply");
	m_btBack = new QPushButton();
	m_btBack->setObjectName("btCancel");
	m_btDelete = new QPushButton();
	m_btDelete->setObjectName("btBack");

	QVBoxLayout* layoutMenu = new QVBoxLayout();
	layoutMenu->addStretch();
	layoutMenu->addWidget(m_btDelete);
	layoutMenu->addWidget(m_btApply);
	layoutMenu->addWidget(m_btBack);
	
	//Assemblage des trois principaux layout
	QHBoxLayout* hLayout = new QHBoxLayout(); //parent: widgetMain
	/*hLayout->addLayout(formLayout);
	hLayout->addStretch(0);*/
	hLayout->addLayout(vLayoutPaveNum);
	//hLayout->addStretch(0);
	hLayout->addLayout(layoutMenu);
	widgetMain->setLayout(hLayout);
	//: Nom de l'onglet à mettre en majuscule dans toutes les langues si possible
	m_tabWidget->addTab(widgetMain, tr("PAVE NUMERIQUE"));

	QHBoxLayout* layoutMain = new QHBoxLayout();
	layoutMain->addWidget(m_tabWidget);

	setLayout(layoutMain);
	this->setObjectName("dialogModal");
	this->setWindowFlags(Qt::FramelessWindowHint);
	
	setConnexion();
}
Example #18
0
SearchView::SearchView(QWidget *parent) : View(parent) {

#if defined(APP_MAC) | defined(APP_WIN)
    // speedup painting since we'll paint the whole background
    // by ourselves anyway in paintEvent()
    setAttribute(Qt::WA_OpaquePaintEvent);
#endif

    QBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setMargin(PADDING);
    mainLayout->setSpacing(0);

    // hidden message widget
    message = new QLabel(this);
    message->hide();
    mainLayout->addWidget(message);

    mainLayout->addStretch();

    QBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setAlignment(Qt::AlignCenter);
    mainLayout->addLayout(hLayout);

    QLabel *logo = new QLabel(this);
    logo->setPixmap(IconUtils::pixmap(":/images/app.png"));
    hLayout->addWidget(logo, 0, Qt::AlignTop);
    hLayout->addSpacing(PADDING);

    QVBoxLayout *layout = new QVBoxLayout();
    layout->setAlignment(Qt::AlignCenter);
    hLayout->addLayout(layout);

    QLabel *welcomeLabel =
            new QLabel("<h1 style='font-weight:100'>" +
                       tr("Welcome to <a href='%1'>%2</a>,")
                       .replace("<a ", "<a style='text-decoration:none; color:palette(text);font-weight:normal' ")
                       .arg(Constants::WEBSITE, Constants::NAME)
                       + "</h1>", this);
    welcomeLabel->setOpenExternalLinks(true);
    welcomeLabel->setProperty("heading", true);
#ifdef APP_MAC
    QFont f = welcomeLabel->font();
    f.setFamily("Helvetica Neue");
    f.setStyleName("Thin");
    welcomeLabel->setFont(f);
#elif APP_WIN
    QFont f = welcomeLabel->font();
    f.setFamily("Segoe UI Light");
    welcomeLabel->setFont(f);
#endif
    layout->addWidget(welcomeLabel);

    layout->addSpacing(PADDING / 2);

    QBoxLayout *tipLayout = new QHBoxLayout();
    tipLayout->setSpacing(10);

#ifndef APP_MAC
    const QFont &biggerFont = FontUtils::big();
#endif

    //: "Enter", as in "type". The whole phrase says: "Enter a keyword to start watching videos"
    QLabel *tipLabel = new QLabel(tr("Enter"), this);
#ifndef APP_MAC
    tipLabel->setFont(biggerFont);
#endif
    tipLayout->addWidget(tipLabel);

    typeCombo = new QComboBox(this);
    typeCombo->addItem(tr("a keyword"));
    typeCombo->addItem(tr("a channel"));
#ifndef APP_MAC
    typeCombo->setFont(biggerFont);
#endif
    connect(typeCombo, SIGNAL(currentIndexChanged(int)), SLOT(searchTypeChanged(int)));
    tipLayout->addWidget(typeCombo);

    tipLabel = new QLabel(tr("to start watching videos."), this);
#ifndef APP_MAC
    tipLabel->setFont(biggerFont);
#endif
    tipLayout->addWidget(tipLabel);
    layout->addLayout(tipLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *searchLayout = new QHBoxLayout();
    searchLayout->setAlignment(Qt::AlignVCenter);

#ifdef APP_MAC_SEARCHFIELD
    queryEdit = new SearchLineEditMac(this);
#else
    SearchLineEdit *sle = new SearchLineEdit(this);
    sle->setFont(biggerFont);
    queryEdit = sle;
#endif

    connect(queryEdit->toWidget(), SIGNAL(search(const QString&)), SLOT(watch(const QString&)));
    connect(queryEdit->toWidget(), SIGNAL(textChanged(const QString &)), SLOT(textChanged(const QString &)));
    connect(queryEdit->toWidget(), SIGNAL(suggestionAccepted(Suggestion*)), SLOT(suggestionAccepted(Suggestion*)));

    youtubeSuggest = new YTSuggester(this);
    channelSuggest = new ChannelSuggest(this);
    searchTypeChanged(0);

    searchLayout->addWidget(queryEdit->toWidget());
    searchLayout->addSpacing(10);

    watchButton = new QPushButton(tr("Watch"), this);
#ifndef APP_MAC
    watchButton->setFont(biggerFont);
#endif
    watchButton->setDefault(true);
    watchButton->setEnabled(false);
    watchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    connect(watchButton, SIGNAL(clicked()), this, SLOT(watch()));
    searchLayout->addWidget(watchButton);

    layout->addItem(searchLayout);

    layout->addSpacing(PADDING / 2);

    QHBoxLayout *otherLayout = new QHBoxLayout();
    otherLayout->setMargin(0);
    otherLayout->setSpacing(10);

    recentKeywordsLayout = new QVBoxLayout();
    recentKeywordsLayout->setSpacing(5);
    recentKeywordsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentKeywordsLabel = new QLabel(tr("Recent keywords"), this);
    recentKeywordsLabel->setProperty("recentHeader", true);
    recentKeywordsLabel->hide();
    recentKeywordsLayout->addWidget(recentKeywordsLabel);

    otherLayout->addLayout(recentKeywordsLayout);

    // recent channels
    recentChannelsLayout = new QVBoxLayout();
    recentChannelsLayout->setSpacing(5);
    recentChannelsLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
    recentChannelsLabel = new QLabel(tr("Recent channels"), this);
    recentChannelsLabel->setProperty("recentHeader", true);
    recentChannelsLabel->setForegroundRole(QPalette::Dark);
    recentChannelsLabel->hide();
    recentChannelsLayout->addWidget(recentChannelsLabel);

    otherLayout->addLayout(recentChannelsLayout);

    layout->addLayout(otherLayout);

    mainLayout->addStretch();

#ifdef APP_ACTIVATION
    if (!Activation::instance().isActivated())
        mainLayout->addWidget(Extra::buyButton(tr("Get the full version")), 0, Qt::AlignRight);
#endif
}
FilterDialog::FilterDialog(int type, QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl ), filter_type(type)
{
	setObjectName( "FilterDialog" );
	setWindowTitle(tr("QtiPlot - Filter options"));
	setSizeGripEnabled( true );

    QGroupBox *gb1 = new QGroupBox();
    QGridLayout *gl1 = new QGridLayout(gb1);
	gl1->addWidget(new QLabel(tr("Filter curve: ")), 0, 0);

	boxName = new QComboBox();
	gl1->addWidget(boxName, 0, 1);

	if (type <= FFTFilter::HighPass)
		gl1->addWidget(new QLabel(tr("Frequency cutoff (Hz)")), 1, 0);
	else
		gl1->addWidget(new QLabel(tr("Low Frequency (Hz)")), 1, 0);

	ApplicationWindow *app = (ApplicationWindow *)parent;

	boxStart = new DoubleSpinBox();
	boxStart->setValue(0.0);
	boxStart->setDecimals(app->d_decimal_digits);
	boxStart->setLocale(app->locale());
	boxStart->setMinimum(0.0);
	gl1->addWidget(boxStart, 1, 1);

	boxColor = new ColorBox(false);
	boxColor->setColor(QColor(Qt::red));
	if (type >= FFTFilter::BandPass){
	    gl1->addWidget(new QLabel(tr("High Frequency (Hz)")), 2, 0);

		boxEnd = new DoubleSpinBox();
		boxEnd->setValue(0.0);
		boxEnd->setDecimals(app->d_decimal_digits);
		boxEnd->setLocale(app->locale());
		boxEnd->setMinimum(0.0);
        gl1->addWidget(boxEnd, 2, 1);

		if (type == FFTFilter::BandPass)
		    gl1->addWidget(new QLabel(tr("Add DC Offset")), 3, 0);
		else
		    gl1->addWidget(new QLabel(tr("Substract DC Offset")), 3, 0);

		boxOffset = new QCheckBox();
		gl1->addWidget(boxOffset, 3, 1);

		gl1->addWidget(new QLabel(tr("Color")), 4, 0);
		gl1->addWidget(boxColor, 4, 1);
        gl1->setRowStretch(5, 1);
	} else {
        gl1->addWidget(new QLabel(tr("Color")), 2, 0);
		gl1->addWidget(boxColor, 2, 1);
        gl1->setRowStretch(3, 1);
	}
	gl1->setColumnStretch(1, 1);

	buttonFilter = new QPushButton(tr( "&Filter" ));
    buttonFilter->setDefault( true );
    buttonCancel = new QPushButton(tr( "&Close" ));

    QVBoxLayout *vl = new QVBoxLayout();
 	vl->addWidget(buttonFilter);
	vl->addWidget(buttonCancel);
    vl->addStretch();

    QHBoxLayout *hb = new QHBoxLayout(this);
    hb->addWidget(gb1, 1);
    hb->addLayout(vl);

	connect( buttonFilter, SIGNAL( clicked() ), this, SLOT( filter() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
Example #20
0
WndCustomizeGUI::WndCustomizeGUI():
   Wnd("Customize GUI")
{
    QVBoxLayout * topLayout = new QVBoxLayout(this);

    QTabWidget * tabWidet = new QTabWidget(this);
    topLayout->addWidget( tabWidet);

    QWidget * colorsWidget = new QWidget( this);
    tabWidet->addTab( colorsWidget, "Colors");
    colorsWidget->setBackgroundRole( QPalette::Mid);
    colorsWidget->setAutoFillBackground( true);

    QWidget * starsWidget = new QWidget( this);
    tabWidet->addTab( starsWidget, "Stars Shape");
    starsWidget->setBackgroundRole( QPalette::Mid);
    starsWidget->setAutoFillBackground( true);

    QWidget * fontsWidget = new QWidget( this);
    tabWidet->addTab( fontsWidget, "Fonts");
    fontsWidget->setBackgroundRole( QPalette::Mid);
    fontsWidget->setAutoFillBackground( true);

    QWidget * imagesWidget = new QWidget( this);
    tabWidet->addTab( imagesWidget, "Images");
    imagesWidget->setBackgroundRole( QPalette::Mid);
    imagesWidget->setAutoFillBackground( true);

    QHBoxLayout * hlayout;
    QVBoxLayout * vlayout;
    QLabel * label;
    ColorWidget * cw;
    NumberWidget * nw;
    FontWidget * ftw;
    FileWidget * flw;

    hlayout = new QHBoxLayout( colorsWidget);

    vlayout = new QVBoxLayout();
    #if QT_VERSION >= 0x040300
    vlayout->setContentsMargins( 1, 1, 1, 1);
    #endif
    vlayout->setSpacing( 2);
    hlayout->addLayout( vlayout);

    label = new QLabel("QT standart GUI pallete:", this);
    label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter);
    vlayout->addWidget( label);

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Window          ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_WindowText      ));
    //vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_AlternateBase ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Base            ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Text            ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Button          ));

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Light           ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Midlight        ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Mid             ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Dark            ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Shadow          ));

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Highlight       ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_HighlightedText ));

    label = new QLabel("Watch specific colors:", this);
    label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter);
    vlayout->addWidget( label);

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_item     ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_selected ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_running  ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_done     ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_error    ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_outline  ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_star     ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_starline ));

    vlayout = new QVBoxLayout();
    #if QT_VERSION >= 0x040300
    vlayout->setContentsMargins( 1, 1, 1, 1);
    #endif
    vlayout->setSpacing( 2);
    hlayout->addLayout( vlayout);


    label = new QLabel("Qt not used palette:", this);
    label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter);
    vlayout->addWidget( label);

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_Link        ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_LinkVisited ));

    label = new QLabel("Job Item Colors:", this);
    label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter);
    vlayout->addWidget( label);

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjoberror  ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjoboff    ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjobwtime  ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjobwdep   ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjobdone   ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemjob       ));

    label = new QLabel("Render Item Colors:", this);
    label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter);
    vlayout->addWidget( label);

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrender       ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrenderoff    ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrenderbusy   ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrendernimby  ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_itemrenderpltclr ));

    label = new QLabel("Watch Nodes Font Colors:", this);
    label->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter);
    vlayout->addWidget( label);

    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textbright ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textmuted  ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textdone   ));
    vlayout->addWidget( new ColorWidget( this, &afqt::QEnvironment::clr_textstars  ));


    // Stars:
    vlayout = new QVBoxLayout( starsWidget);
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_numpoints ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_radiusin  ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_radiusout ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::star_rotate    ));


    // Images:
    vlayout = new QVBoxLayout( imagesWidget);

    QString filesmask("PNG Images [*.png] (*.png)");

    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_back, filesmask));

    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_top,      filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_topleft , filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_topright, filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_bot,      filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_botleft , filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_border_botright, filesmask ));

    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_leftoff , filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_lefton  , filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_rightoff, filesmask ));
    vlayout->addWidget( new FileWidget( this, &afqt::QEnvironment::image_snap_righton , filesmask ));


    // Fonts:
    vlayout = new QVBoxLayout( fontsWidget);
    vlayout->addWidget( new FontWidget(   this, &afqt::QEnvironment::font_family     ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizename   ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizeinfo   ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizemin    ));
    vlayout->addWidget( new NumberWidget( this, &afqt::QEnvironment::font_sizeplotter));


    QPushButton * button = new QPushButton("Save GUI Preferences", this);
    connect( button, SIGNAL( pressed()), this, SLOT(save()));
    topLayout->addWidget( button);
}
Example #21
0
PPPdArguments::PPPdArguments(QWidget *parent, const char *name)
  : QDialog(parent, name, TRUE)
{
  setCaption(i18n("Customize pppd Arguments"));
  KWin::setIcons(winId(), kapp->icon(), kapp->miniIcon());
  QVBoxLayout *l = new QVBoxLayout(this, 10, 10);
  QHBoxLayout *tl = new QHBoxLayout(10);
  l->addLayout(tl);
  QVBoxLayout *l1 = new QVBoxLayout();
  QVBoxLayout *l2 = new QVBoxLayout();
  tl->addLayout(l1, 1);
  tl->addLayout(l2, 0);

  QHBoxLayout *l11 = new QHBoxLayout(10);
  l1->addLayout(l11);

  argument_label = new QLabel(i18n("Arg&ument:"), this);
  l11->addWidget(argument_label);

  argument = new QLineEdit(this);
  argument_label->setBuddy(argument);
  connect(argument, SIGNAL(returnPressed()),
	  SLOT(addbutton()));
  l11->addWidget(argument);
  connect(argument, SIGNAL(textChanged(const QString &)),
	  this, SLOT(textChanged(const QString &)));

  arguments = new QListBox(this);
  arguments->setMinimumSize(1, fontMetrics().lineSpacing()*10);
  connect(arguments, SIGNAL(highlighted(int)),
	  this, SLOT(itemSelected(int)));
  l1->addWidget(arguments, 1);

  add = new QPushButton(i18n("&Add"), this);
  connect(add, SIGNAL(clicked()), SLOT(addbutton()));
  l2->addWidget(add);
  l2->addStretch(1);

  remove = new QPushButton(i18n("&Remove"), this);
  connect(remove, SIGNAL(clicked()), SLOT(removebutton()));
  l2->addWidget(remove);

  defaults = new KPushButton(KStdGuiItem::defaults(), this);
  connect(defaults, SIGNAL(clicked()), SLOT(defaultsbutton()));
  l2->addWidget(defaults);

  l->addSpacing(5);

  KButtonBox *bbox = new KButtonBox(this);
  bbox->addStretch(1);
  closebtn = bbox->addButton(KStdGuiItem::ok());
  connect(closebtn, SIGNAL(clicked()), SLOT(closebutton()));
  QPushButton *cancel = bbox->addButton(KStdGuiItem::cancel());
  connect(cancel, SIGNAL(clicked()),
	  this, SLOT(reject()));
  bbox->layout();
  l->addWidget(bbox);

  setFixedSize(sizeHint());

  //load info from gpppdata
  init();

  add->setEnabled(false);
  remove->setEnabled(false);
  argument->setFocus();
}
BaselineDialog::BaselineDialog( QWidget* parent, Qt::WFlags fl )
	: QDialog( parent, fl ),
	d_baseline(NULL),
	d_table(NULL),
	d_picker_tool(NULL)
{
	setObjectName( "BaselineDialog" );
	setWindowTitle(tr("QtiPlot") + " - " + tr("Baseline"));
	setAttribute(Qt::WA_DeleteOnClose);
	setSizeGripEnabled( true );

	QGroupBox *gb1 = new QGroupBox();
	QGridLayout *gl1 = new QGridLayout(gb1);

	gl1->addWidget(new QLabel(tr("Curve")), 0, 0);

	boxInputName = new QComboBox();
	gl1->addWidget(boxInputName, 0, 1);

	boxPoints = new QSpinBox();
	boxPoints->setMinimum(2);
	boxPoints->setMaximum(INT_MAX);

	gl1->addWidget(new QLabel(tr("Points")), 1, 0);
	gl1->addWidget(boxPoints, 1, 1);

	btnAutomatic = new QRadioButton(tr("&Interpolation"));
	btnAutomatic->setChecked(true);
	gl1->addWidget(btnAutomatic, 2, 0);

	boxInterpolationMethod = new QComboBox();
	boxInterpolationMethod->addItems(QStringList() << tr("Linear") << tr("Cubic") << tr("Non-rounded Akima"));
	gl1->addWidget(boxInterpolationMethod, 2, 1);

	btnEquation = new QRadioButton(tr("User Defined &Equation Y ="));
	btnEquation->setChecked(false);
	gl1->addWidget(btnEquation, 3, 0);

	boxEquation = new QLineEdit();
	gl1->addWidget(boxEquation, 3, 1);

	btnDataset = new QRadioButton(tr("Existing &Dataset"));
	btnDataset->setChecked(false);
	gl1->addWidget(btnDataset, 4, 0);

	boxTableName = new QComboBox();
	boxColumnName = new QComboBox();

	QHBoxLayout *hb0 = new QHBoxLayout();
	hb0->addWidget(boxTableName);
	hb0->addWidget(boxColumnName);
	gl1->addLayout(hb0, 4, 1);

	gl1->setColumnStretch(1, 1);
	gl1->setRowStretch(5, 1);

	ApplicationWindow *app = (ApplicationWindow *)parent;
	boxTableName->addItems(app->tableNames());
	updateTableColumns(0);

	buttonCreate = new QPushButton(tr( "Create &Baseline" ));
	buttonCreate->setDefault( true );
	buttonSubtract = new QPushButton(tr( "&Subtract" ));
	buttonUndo = new QPushButton(tr( "&Undo Subtraction" ));
	buttonModify = new QPushButton(tr( "&Modify" ));
	buttonModify->setCheckable(true);
	buttonCancel = new QPushButton(tr( "&Close" ));

	QVBoxLayout *vl = new QVBoxLayout();
	vl->addWidget(buttonCreate);
	vl->addWidget(buttonModify);
	vl->addWidget(buttonSubtract);
	vl->addWidget(buttonUndo);
	vl->addStretch();
	vl->addWidget(buttonCancel);

	QHBoxLayout *hb = new QHBoxLayout(this);
	hb->addWidget(gb1);
	hb->addLayout(vl);

	enableBaselineOptions();

	connect(boxTableName, SIGNAL(activated(int)), this, SLOT(updateTableColumns(int)));
	connect(buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
	connect(buttonCreate, SIGNAL(clicked()), this, SLOT(createBaseline()));
	connect(buttonSubtract, SIGNAL(clicked()), this, SLOT(subtractBaseline()));
	connect(buttonUndo, SIGNAL(clicked()), this, SLOT(undo()));
	connect(buttonModify, SIGNAL(clicked()), this, SLOT(modifyBaseline()));

	connect(btnAutomatic, SIGNAL(toggled(bool)), this, SLOT(enableBaselineOptions()));
	connect(btnEquation, SIGNAL(toggled(bool)), this, SLOT(enableBaselineOptions()));
	connect(btnDataset, SIGNAL(toggled(bool)), this, SLOT(enableBaselineOptions()));
}
Example #23
0
int KMessageBox::createKMessageBox(KDialog *dialog, const QIcon &icon,
                             const QString &text, const QStringList &strlist,
                             const QString &ask, bool *checkboxReturn, Options options,
                             const QString &details, QMessageBox::Icon notifyType)
{
    QWidget *mainWidget = new QWidget(dialog);
    QVBoxLayout *mainLayout = new QVBoxLayout(mainWidget);
    mainLayout->setSpacing(KDialog::spacingHint() * 2); // provide extra spacing
    mainLayout->setMargin(0);

    QHBoxLayout *hLayout = new QHBoxLayout();
    hLayout->setMargin(0);
    hLayout->setSpacing(-1); // use default spacing
    mainLayout->addLayout(hLayout,5);

    QLabel *iconLabel = new QLabel(mainWidget);

    if (!icon.isNull()) {
        QStyleOption option;
        option.initFrom(mainWidget);
        iconLabel->setPixmap(icon.pixmap(mainWidget->style()->pixelMetric(QStyle::PM_MessageBoxIconSize, &option, mainWidget)));
    }

    QVBoxLayout *iconLayout = new QVBoxLayout();
    iconLayout->addStretch(1);
    iconLayout->addWidget(iconLabel);
    iconLayout->addStretch(5);

    hLayout->addLayout(iconLayout,0);
    hLayout->addSpacing(KDialog::spacingHint());

    QLabel *messageLabel = new QLabel(text, mainWidget);
    messageLabel->setOpenExternalLinks(options & KMessageBox::AllowLink);
    Qt::TextInteractionFlags flags = Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard;
    if (options & KMessageBox::AllowLink) {
        flags |= Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard;
    }
    messageLabel->setTextInteractionFlags(flags);

    QRect desktop = KGlobalSettings::desktopGeometry(dialog);
    bool usingSqueezedTextLabel = false;
    if (messageLabel->sizeHint().width() > desktop.width() * 0.5) {
        // enable automatic wrapping of messages which are longer than 50% of screen width
        messageLabel->setWordWrap(true);
        // display a text widget with scrollbar if still too wide
        usingSqueezedTextLabel = messageLabel->sizeHint().width() > desktop.width() * 0.85;
        if (usingSqueezedTextLabel)
        {
            delete messageLabel;
            messageLabel = new KSqueezedTextLabel(text, mainWidget);
            messageLabel->setOpenExternalLinks(options & KMessageBox::AllowLink);
            messageLabel->setTextInteractionFlags(flags);
        }
    }

    QPalette messagePal(messageLabel->palette());
    messagePal.setColor(QPalette::Window, Qt::transparent);
    messageLabel->setPalette(messagePal);


    bool usingScrollArea=desktop.height() / 3 < messageLabel->sizeHint().height();
    if (usingScrollArea)
    {
        QScrollArea* messageScrollArea = new QScrollArea(mainWidget);
        messageScrollArea->setWidget(messageLabel);
        messageScrollArea->setFrameShape(QFrame::NoFrame);
        messageScrollArea->setWidgetResizable(true);
        QPalette scrollPal(messageScrollArea->palette());
        scrollPal.setColor(QPalette::Window, Qt::transparent);
        messageScrollArea->viewport()->setPalette(scrollPal);
        hLayout->addWidget(messageScrollArea,5);
    }
    else
        hLayout->addWidget(messageLabel,5);


    const bool usingListWidget=!strlist.isEmpty();
    if (usingListWidget) {
        // enable automatic wrapping since the listwidget has already a good initial width
        messageLabel->setWordWrap(true);
        QListWidget *listWidget = new QListWidget(mainWidget);
        listWidget->addItems(strlist);

        QStyleOptionViewItem styleOption;
        styleOption.initFrom(listWidget);
        QFontMetrics fm(styleOption.font);
        int w = listWidget->width();
        Q_FOREACH(const QString &str, strlist) {
            w = qMax(w, fm.width(str));
        }
        const int borderWidth = listWidget->width() - listWidget->viewport()->width() + listWidget->verticalScrollBar()->height();
        w += borderWidth;
        if (w > desktop.width() * 0.85) { // limit listWidget size to 85% of screen width
            w = qRound(desktop.width() * 0.85);
        }
        listWidget->setMinimumWidth(w);

        mainLayout->addWidget(listWidget,usingScrollArea?10:50);
        listWidget->setSelectionMode(QListWidget::NoSelection);
        messageLabel->setSizePolicy(QSizePolicy::Preferred,QSizePolicy::Minimum);
    }
Example #24
0
LTMWindow::LTMWindow(Context *context) :
            GcChartWindow(context), context(context), dirty(true), stackDirty(true), compareDirty(true)
{
    useToToday = useCustom = false;
    plotted = DateRange(QDate(01,01,01), QDate(01,01,01));

    // the plot
    QVBoxLayout *mainLayout = new QVBoxLayout;
    ltmPlot = new LTMPlot(this, context, true);

    // the stack of plots
    QPalette palette;
    palette.setBrush(QPalette::Background, QBrush(GColor(CPLOTBACKGROUND)));

    plotsWidget = new QWidget(this);
    plotsWidget->setPalette(palette);
    plotsLayout = new QVBoxLayout(plotsWidget);
    plotsLayout->setSpacing(0);
    plotsLayout->setContentsMargins(0,0,0,0);

    plotArea = new QScrollArea(this);
    plotArea->setAutoFillBackground(false);
    plotArea->setWidgetResizable(true);
    plotArea->setWidget(plotsWidget);
    plotArea->setFrameStyle(QFrame::NoFrame);
    plotArea->setContentsMargins(0,0,0,0);
    plotArea->setPalette(palette);

    // the data table
    dataSummary = new QWebView(this);
    dataSummary->setContentsMargins(0,0,0,0);
    dataSummary->page()->view()->setContentsMargins(0,0,0,0);
    dataSummary->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    dataSummary->setAcceptDrops(false);

    QFont defaultFont; // mainwindow sets up the defaults.. we need to apply
    dataSummary->settings()->setFontSize(QWebSettings::DefaultFontSize, defaultFont.pointSize()+1);
    dataSummary->settings()->setFontFamily(QWebSettings::StandardFont, defaultFont.family());

    // compare plot page
    compareplotsWidget = new QWidget(this);
    compareplotsWidget->setPalette(palette);
    compareplotsLayout = new QVBoxLayout(compareplotsWidget);
    compareplotsLayout->setSpacing(0);
    compareplotsLayout->setContentsMargins(0,0,0,0);

    compareplotArea = new QScrollArea(this);
    compareplotArea->setAutoFillBackground(false);
    compareplotArea->setWidgetResizable(true);
    compareplotArea->setWidget(compareplotsWidget);
    compareplotArea->setFrameStyle(QFrame::NoFrame);
    compareplotArea->setContentsMargins(0,0,0,0);
    compareplotArea->setPalette(palette);

    // the stack
    stackWidget = new QStackedWidget(this);
    stackWidget->addWidget(ltmPlot);
    stackWidget->addWidget(dataSummary);
    stackWidget->addWidget(plotArea);
    stackWidget->addWidget(compareplotArea);
    stackWidget->setCurrentIndex(0);
    mainLayout->addWidget(stackWidget);
    setChartLayout(mainLayout);

    // reveal controls
    QHBoxLayout *revealLayout = new QHBoxLayout;
    revealLayout->setContentsMargins(0,0,0,0);
    revealLayout->addStretch();
    revealLayout->addWidget(new QLabel(tr("Group by"),this));

    rGroupBy = new QxtStringSpinBox(this);
    QStringList strings;
    strings << tr("Days")
            << tr("Weeks")
            << tr("Months")
            << tr("Years")
            << tr("Time Of Day");
    rGroupBy->setStrings(strings);
    rGroupBy->setValue(0);

    revealLayout->addWidget(rGroupBy);
    rData = new QCheckBox(tr("Data Table"), this);
    rStack = new QCheckBox(tr("Stacked"), this);
    QVBoxLayout *checks = new QVBoxLayout;
    checks->setSpacing(2);
    checks->setContentsMargins(0,0,0,0);
    checks->addWidget(rData);
    checks->addWidget(rStack);
    revealLayout->addLayout(checks);
    revealLayout->addStretch();
    setRevealLayout(revealLayout);

    // the controls
    QWidget *c = new QWidget;
    c->setContentsMargins(0,0,0,0);
    QVBoxLayout *cl = new QVBoxLayout(c);
    cl->setContentsMargins(0,0,0,0);
    cl->setSpacing(0);
    setControls(c);

    // the popup
    popup = new GcPane();
    ltmPopup = new LTMPopup(context);
    QVBoxLayout *popupLayout = new QVBoxLayout();
    popupLayout->addWidget(ltmPopup);
    popup->setLayout(popupLayout);

    ltmTool = new LTMTool(context, &settings);

    // initialise
    settings.ltmTool = ltmTool;
    settings.data = NULL;
    settings.groupBy = LTM_DAY;
    settings.legend = ltmTool->showLegend->isChecked();
    settings.events = ltmTool->showEvents->isChecked();
    settings.shadeZones = ltmTool->shadeZones->isChecked();
    settings.showData = ltmTool->showData->isChecked();
    settings.stack = ltmTool->showStack->isChecked();
    settings.stackWidth = ltmTool->stackSlider->value();
    rData->setChecked(ltmTool->showData->isChecked());
    rStack->setChecked(ltmTool->showStack->isChecked());
    cl->addWidget(ltmTool);

    connect(this, SIGNAL(dateRangeChanged(DateRange)), this, SLOT(dateRangeChanged(DateRange)));
    connect(ltmTool, SIGNAL(filterChanged()), this, SLOT(filterChanged()));
    connect(context, SIGNAL(homeFilterChanged()), this, SLOT(filterChanged()));
    connect(ltmTool->groupBy, SIGNAL(currentIndexChanged(int)), this, SLOT(groupBySelected(int)));
    connect(rGroupBy, SIGNAL(valueChanged(int)), this, SLOT(rGroupBySelected(int)));
    //!!! connect(ltmTool->saveButton, SIGNAL(clicked(bool)), this, SLOT(saveClicked(void)));
    connect(ltmTool->applyButton, SIGNAL(clicked(bool)), this, SLOT(applyClicked(void)));
    connect(ltmTool->shadeZones, SIGNAL(stateChanged(int)), this, SLOT(shadeZonesClicked(int)));
    connect(ltmTool->showData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int)));
    connect(rData, SIGNAL(stateChanged(int)), this, SLOT(showDataClicked(int)));
    connect(ltmTool->showStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int)));
    connect(rStack, SIGNAL(stateChanged(int)), this, SLOT(showStackClicked(int)));
    connect(ltmTool->stackSlider, SIGNAL(valueChanged(int)), this, SLOT(zoomSliderChanged()));
    connect(ltmTool->showLegend, SIGNAL(stateChanged(int)), this, SLOT(showLegendClicked(int)));
    connect(ltmTool->showEvents, SIGNAL(stateChanged(int)), this, SLOT(showEventsClicked(int)));
    connect(ltmTool, SIGNAL(useCustomRange(DateRange)), this, SLOT(useCustomRange(DateRange)));
    connect(ltmTool, SIGNAL(useThruToday()), this, SLOT(useThruToday()));
    connect(ltmTool, SIGNAL(useStandardRange()), this, SLOT(useStandardRange()));
    connect(ltmTool, SIGNAL(curvesChanged()), this, SLOT(refresh()));
    connect(context, SIGNAL(filterChanged()), this, SLOT(refresh()));

    // comparing things
    connect(context, SIGNAL(compareDateRangesStateChanged(bool)), this, SLOT(compareChanged()));
    connect(context, SIGNAL(compareDateRangesChanged()), this, SLOT(compareChanged()));

    connect(context, SIGNAL(rideAdded(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(rideDeleted(RideItem*)), this, SLOT(refresh(void)));
    connect(context, SIGNAL(configChanged()), this, SLOT(refresh()));
}
Example #25
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"));
}
Example #26
0
PfPvWindow::PfPvWindow(Context *context) :
    GcChartWindow(context), context(context), current(NULL), compareStale(true)
{
    QWidget *c = new QWidget;
    QVBoxLayout *cl = new QVBoxLayout(c);
    setControls(c);

    //
    // reveal controls widget
    //

    // layout reveal controls
    QHBoxLayout *revealLayout = new QHBoxLayout;
    revealLayout->setContentsMargins(0,0,0,0);

    rShade = new QCheckBox(tr("Shade zones"));
    if (appsettings->value(this, GC_SHADEZONES, true).toBool() == true)
        rShade->setCheckState(Qt::Checked);
    else
        rShade->setCheckState(Qt::Unchecked);
    rMergeInterval = new QCheckBox;
    rMergeInterval->setText(tr("Merge intervals"));
    rMergeInterval->setCheckState(Qt::Unchecked);
    rMergeInterval->hide(); // lets not - its not that useful
    rFrameInterval = new QCheckBox;
    rFrameInterval->setText(tr("Frame intervals"));
    rFrameInterval->setCheckState(Qt::Checked);

    QVBoxLayout *checks = new QVBoxLayout;
    checks->addStretch();
    checks->addWidget(rShade);
    checks->addWidget(rMergeInterval);
    checks->addWidget(rFrameInterval);
    checks->addStretch();

    revealLayout->addStretch();
    revealLayout->addLayout(checks);
    revealLayout->addStretch();

    setRevealLayout(revealLayout);

    // the plot
    QVBoxLayout *vlayout = new QVBoxLayout;
    pfPvPlot = new PfPvPlot(context);
    vlayout->addWidget(pfPvPlot);

    setChartLayout(vlayout);
    setAutoFillBackground(true);

    // allow zooming
    pfpvZoomer = new QwtPlotZoomer(pfPvPlot->canvas());
    pfpvZoomer->setRubberBand(QwtPicker::RectRubberBand);
    pfpvZoomer->setRubberBandPen(GColor(CPLOTSELECT));
    pfpvZoomer->setTrackerMode(QwtPicker::AlwaysOff);
    pfpvZoomer->setEnabled(true);
    pfpvZoomer->setMousePattern(QwtEventPattern::MouseSelect1, Qt::LeftButton);
    pfpvZoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::RightButton, Qt::ControlModifier);
    pfpvZoomer->setMousePattern(QwtEventPattern::MouseSelect3, Qt::RightButton);

    // double click
    doubleClickPicker = new PfPvDoubleClickPicker(pfPvPlot);

    // the controls
    QFormLayout *f = new QFormLayout;
    cl->addLayout(f);

    QLabel *qaCPLabel = new QLabel(tr("Watts:"), this);
    qaCPValue = new QLineEdit(QString("%1").arg(pfPvPlot->getCP()));
    qaCPValue->setValidator(new QIntValidator(0, 9999, qaCPValue));
    f->addRow(qaCPLabel, qaCPValue);

    QLabel *qaCadLabel = new QLabel(tr("RPM:"), this);
    qaCadValue = new QLineEdit(QString("%1").arg(pfPvPlot->getCAD()));
    qaCadValue->setValidator(new QIntValidator(0, 999, qaCadValue));
    f->addRow(qaCadLabel, qaCadValue);

    QLabel *qaClLabel = new QLabel(tr("Crank Length (m):"), this);
    qaClValue = new QLineEdit(QString("%1").arg(1000 * pfPvPlot->getCL()));
    f->addRow(qaClLabel, qaClValue);

    shadeZonesPfPvCheckBox = new QCheckBox;
    shadeZonesPfPvCheckBox->setText(tr("Shade zones"));
    if (appsettings->value(this, GC_SHADEZONES, true).toBool() == true)
        shadeZonesPfPvCheckBox->setCheckState(Qt::Checked);
    else
        shadeZonesPfPvCheckBox->setCheckState(Qt::Unchecked);
    cl->addWidget(shadeZonesPfPvCheckBox);

    mergeIntervalPfPvCheckBox = new QCheckBox;
    mergeIntervalPfPvCheckBox->setText(tr("Merge intervals"));
    mergeIntervalPfPvCheckBox->setCheckState(Qt::Unchecked);
    cl->addWidget(mergeIntervalPfPvCheckBox);

    frameIntervalPfPvCheckBox = new QCheckBox;
    frameIntervalPfPvCheckBox->setText(tr("Frame intervals"));
    frameIntervalPfPvCheckBox->setCheckState(Qt::Checked);
    cl->addWidget(frameIntervalPfPvCheckBox);
    cl->addStretch();

    connect(pfPvPlot, SIGNAL(changedCP(const QString&)),
            qaCPValue, SLOT(setText(const QString&)) );
    connect(pfPvPlot, SIGNAL(changedCAD(const QString&)),
            qaCadValue, SLOT(setText(const QString&)) );
    connect(pfPvPlot, SIGNAL(changedCL(const QString&)),
            qaClValue, SLOT(setText(const QString&)) );
    connect(qaCPValue, SIGNAL(editingFinished()),
	    this, SLOT(setQaCPFromLineEdit()));
    connect(qaCadValue, SIGNAL(editingFinished()),
	    this, SLOT(setQaCADFromLineEdit()));
    connect(qaClValue, SIGNAL(editingFinished()),
	    this, SLOT(setQaCLFromLineEdit()));
    connect(shadeZonesPfPvCheckBox, SIGNAL(stateChanged(int)),
            this, SLOT(setShadeZonesPfPvFromCheckBox()));
    connect(rShade, SIGNAL(stateChanged(int)),
            this, SLOT(setrShadeZonesPfPvFromCheckBox()));
    connect(mergeIntervalPfPvCheckBox, SIGNAL(stateChanged(int)),
                this, SLOT(setMergeIntervalsPfPvFromCheckBox()));
    connect(rMergeInterval, SIGNAL(stateChanged(int)),
                this, SLOT(setrMergeIntervalsPfPvFromCheckBox()));
    connect(frameIntervalPfPvCheckBox, SIGNAL(stateChanged(int)),
                this, SLOT(setFrameIntervalsPfPvFromCheckBox()));
    connect(rFrameInterval, SIGNAL(stateChanged(int)),
                this, SLOT(setrFrameIntervalsPfPvFromCheckBox()));
    connect(doubleClickPicker, SIGNAL(doubleClicked(int, int)), this, SLOT(doubleClicked(int, int)));

    // GC signals
    connect(this, SIGNAL(rideItemChanged(RideItem*)), this, SLOT(rideSelected()));
    connect(context, SIGNAL(intervalSelected()), this, SLOT(intervalSelected()));
    connect(context, SIGNAL(intervalsChanged()), this, SLOT(intervalSelected()));
    connect(context->athlete, SIGNAL(zonesChanged()), this, SLOT(zonesChanged()));
    connect(context, SIGNAL(configChanged()), this, SLOT(configChanged()));
    connect(context, SIGNAL(configChanged()), pfPvPlot, SLOT(configChanged()));

    // comparing things
    connect(context, SIGNAL(compareIntervalsStateChanged(bool)), this, SLOT(compareChanged()));
    connect(context, SIGNAL(compareIntervalsChanged()), this, SLOT(compareChanged()));

    configChanged();
}
Example #27
0
FilterDialog::FilterDialog(int type, QWidget *parent, Qt::WFlags fl)
    : QDialog(parent, fl), graph(nullptr), buttonFilter(nullptr),
      buttonCancel(nullptr), boxName(nullptr), boxOffset(nullptr),
      boxStart(nullptr), boxEnd(nullptr), boxColor(nullptr) {
  setWindowTitle(tr("MantidPlot - Filter options"));
  filter_type = type;

  setObjectName("FilterDialog");

  QGroupBox *gb1 = new QGroupBox();
  QGridLayout *gl1 = new QGridLayout(gb1);
  gl1->addWidget(new QLabel(tr("Filter curve: ")), 0, 0);

  boxName = new QComboBox();
  gl1->addWidget(boxName, 0, 1);

  if (type <= FFTFilter::HighPass)
    gl1->addWidget(new QLabel(tr("Frequency cutoff (Hz)")), 1, 0);
  else
    gl1->addWidget(new QLabel(tr("Low Frequency (Hz)")), 1, 0);

  boxStart = new QLineEdit();
  boxStart->setText(tr("0"));
  gl1->addWidget(boxStart, 1, 1);

  boxColor = new ColorBox();
  boxColor->setColor(QColor(Qt::red));
  if (type >= FFTFilter::BandPass) {
    gl1->addWidget(new QLabel(tr("High Frequency (Hz)")), 2, 0);

    boxEnd = new QLineEdit();
    boxEnd->setText(tr("0"));
    gl1->addWidget(boxEnd, 2, 1);

    if (type == FFTFilter::BandPass)
      gl1->addWidget(new QLabel(tr("Add DC Offset")), 3, 0);
    else
      gl1->addWidget(new QLabel(tr("Substract DC Offset")), 3, 0);

    boxOffset = new QCheckBox();
    gl1->addWidget(boxOffset, 3, 1);

    gl1->addWidget(new QLabel(tr("Color")), 4, 0);
    gl1->addWidget(boxColor, 4, 1);
    gl1->setRowStretch(5, 1);
  } else {
    gl1->addWidget(new QLabel(tr("Color")), 2, 0);
    gl1->addWidget(boxColor, 2, 1);
    gl1->setRowStretch(3, 1);
  }

  buttonFilter = new QPushButton(tr("&Filter"));
  buttonFilter->setDefault(true);
  buttonCancel = new QPushButton(tr("&Close"));

  QVBoxLayout *vl = new QVBoxLayout();
  vl->addWidget(buttonFilter);
  vl->addWidget(buttonCancel);
  vl->addStretch();

  QHBoxLayout *hb = new QHBoxLayout(this);
  hb->addWidget(gb1);
  hb->addLayout(vl);

  connect(buttonFilter, SIGNAL(clicked()), this, SLOT(filter()));
  connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
}
Example #28
0
AdminSailingTimesItem::AdminSailingTimesItem(QString id, QString cat, SaverDbSailingTimes data, QStringList islands, QWidget *parent) : QWidget(parent) {

	allData = data;
	this->islands = islands;
	this->id = id;
	category = cat;

	fromIsland = (data.from == cat);
	toIsland = (data.to == cat);

	// THIS IS THE LAYOUT STRUCTURE:
	/****************************************************************************************
	 *		islands				time	*			*	*
	 ********************************************************	dates		*  del	*
	 *			days				*			*	*
	 ****************************************************************************************/



	// The first row containing the islands and the time


	QLabel *labelSailingFrom = new QLabel("Sailing from");
	labelSailingFrom->setStyleSheet("font-weight: bold");


	QLabel *islandFixed = new QLabel(cat);
	islandFixed->setStyleSheet("font-weight: bold");

	QLabel *labelSailingTo = new QLabel("to");
	labelSailingTo->setStyleSheet("font-weight: bold");

	islandVariable = new QComboBox;
	islandVariable->setStyleSheet("font-weight: bold");
	islandVariable->addItem("Mainland");
	for(int j = 0; j < islands.length(); ++j) {
		islandVariable->addItem(islands.at(j));
		if(islands.at(j) == data.to && !fromIsland) islandVariable->setCurrentIndex(j+1);
	}
	if((fromIsland && !toIsland) || (!fromIsland && toIsland)) islandVariable->setCurrentIndex(0);



	QLabel *timeLabel = new QLabel("at");
	timeLabel->setStyleSheet("font-weight: bold");
	time = new Clock;
	time->setStyleSheet("font-weight: bold");
	time->setTime(QTime(data.sailingtime/100,data.sailingtime%100));


	QHBoxLayout *islandTimesLay = new QHBoxLayout;
	islandTimesLay->addWidget(labelSailingFrom);
	if(fromIsland) islandTimesLay->addWidget(islandFixed);
	else islandTimesLay->addWidget(islandVariable);
	islandTimesLay->addWidget(labelSailingTo);
	if(fromIsland) islandTimesLay->addWidget(islandVariable);
	else islandTimesLay->addWidget(islandFixed);
	islandTimesLay->addWidget(timeLabel);
	islandTimesLay->addWidget(time);
	islandTimesLay->addSpacing(10);
	islandTimesLay->addStretch();



	// The part containing checkboxes for all the days


	QHBoxLayout *dayLay = new QHBoxLayout;

	QStringList days;
	days << "Mo" << "Tue" << "Wed" << "Thu" << "Fri" << "Sat" << "Sun";
	for(int j = 0; j < days.length(); ++j) {
		QCheckBox *ch = new QCheckBox(days.at(j));
		ch->setCursor(Qt::PointingHandCursor);
		allDays.append(ch);
		if(data.daysofweek.at(j) == *"1") ch->setChecked(true);
		dayLay->addWidget(ch);
	}

	QVBoxLayout *islandsTimesDaysLay = new QVBoxLayout;
	islandsTimesDaysLay->addLayout(islandTimesLay);
	islandsTimesDaysLay->addLayout(dayLay);


	// the two rows of dates (start and end)

	QLabel *dateStartLabel = new QLabel("Starting:");
	dateStart = new DateEdit(150,"dd MMMM yyyy");
	dateStart->setDate(data.start);
	dateStart->setNoDateLimits();
	QHBoxLayout *dateStartLay = new QHBoxLayout;
	dateStartLay->addWidget(dateStartLabel);
	dateStartLay->addWidget(dateStart);

	QLabel *dateEndLabel = new QLabel("Ending:");
	dateEnd = new DateEdit(150,"dd MMMM yyyy");
	dateEnd->setDate(data.end);
	dateEnd->setNoDateLimits();
	QHBoxLayout *dateEndLay = new QHBoxLayout;
	dateEndLay->addWidget(dateEndLabel);
	dateEndLay->addWidget(dateEnd);

	QVBoxLayout *dateLay = new QVBoxLayout;
	dateLay->addLayout(dateStartLay);
	dateLay->addLayout(dateEndLay);


	// A delete button

	QPushButton *del = new QPushButton("X");
	del->setFixedWidth(40);
	del->setCursor(Qt::PointingHandCursor);
	del->setStyleSheet("font-weight: bold; color: red");
	connect(del, SIGNAL(clicked()), this, SLOT(delClicked()));



	// The main layout combining all the elements above

	QHBoxLayout *lay = new QHBoxLayout;
	lay->addStretch();
	lay->addLayout(islandsTimesDaysLay);
	lay->addSpacing(10);
	lay->addLayout(dateLay);
	lay->addSpacing(10);
	lay->addWidget(del);
	lay->addStretch();

	this->setLayout(lay);

}
void EditorConfigDialog::setupSpeedWidgets(QWidget* parent)
{
	QIntValidator* allInts = new QIntValidator(this);

	QHBoxLayout* hboxLayout = new QHBoxLayout(parent);
	hboxLayout->setSpacing(4);
	hboxLayout->setMargin(4);

	hboxLayout->addItem(
		new QSpacerItem(20, 20, QSizePolicy::Preferred, QSizePolicy::Ignored));

	QGridLayout* gridLayout = new QGridLayout;
	gridLayout->setSpacing(1);
	gridLayout->setMargin(0);

	gridLayout->addItem(new QSpacerItem(
		0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding),
		0, 0);

	QLabel* label;
#define ADDSPEEDLABEL(text, row) \
	label = new QLabel(tr(text), parent); \
	label->setAlignment(Qt::AlignTrailing|Qt::AlignVCenter); \
	gridLayout->addWidget(label, row, 0, 1, 1); \

	ADDSPEEDLABEL("Scrolling Speeds:", 1);
	ADDSPEEDLABEL("Keyboard Scroll:", 2);
	ADDSPEEDLABEL("Mouse Scroll:", 3);
	ADDSPEEDLABEL("Tile Edit Window Scroll:", 4);
#undef ADDSPEEDLABEL

	label = new QLabel(tr("X"), parent);
	label->setMinimumSize(QSize(30, 0));
	label->setAlignment(Qt::AlignCenter);
	gridLayout->addWidget(label, 1, 1, 1, 1);

	label = new QLabel(tr("Y"), parent);
	label->setMinimumSize(QSize(30, 0));
	label->setAlignment(Qt::AlignCenter);
	gridLayout->addWidget(label, 1, 2, 1, 1);

#define ADDSPEEDLINEEDIT(var, row, col) \
	var = new QLineEdit(parent); \
	var ->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); \
	var ->setValidator(allInts); \
	gridLayout->addWidget( var , row , col , 1, 1); \

#define ADDSPEEDXYPAIR(enum, row) \
	ADDSPEEDLINEEDIT(scrollSpeeds[ enum ][0], row , 1) \
	ADDSPEEDLINEEDIT(scrollSpeeds[ enum ][1], row , 2) \

	ADDSPEEDXYPAIR(keyboardScroll, 2);
	ADDSPEEDXYPAIR(mouseScroll, 3);
	ADDSPEEDXYPAIR(tileeditScroll, 4);
#undef ADDSPEEDXYPAIR
#undef ADDSPEEDLINEEDIT

	gridLayout->addItem(new QSpacerItem(
		0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding),
		5, 0);

	hboxLayout->addLayout(gridLayout);

	hboxLayout->addItem(
		new QSpacerItem(20, 20, QSizePolicy::Preferred, QSizePolicy::Ignored));

	QVBoxLayout* vboxLayout = new QVBoxLayout;

	vboxLayout->addItem(
		new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Expanding));

	label = new QLabel(tr("Object Edit Scroll:"), parent);
	label->setAlignment(Qt::AlignCenter);
	vboxLayout->addWidget(label);

	editScrollSpeed = new QLineEdit(parent);
	editScrollSpeed->setValidator(allInts);
	vboxLayout->addWidget(editScrollSpeed);

	vboxLayout->addItem(
		new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Expanding));

	lowZoomedScrollSpeed = new QCheckBox(tr("Low scroll speed\nwhile zoomed out"), parent);
	vboxLayout->addWidget(lowZoomedScrollSpeed);

	vboxLayout->addItem(
		new QSpacerItem(20, 40, QSizePolicy::Expanding, QSizePolicy::Expanding));

	hboxLayout->addLayout(vboxLayout);

	hboxLayout->addItem(
		new QSpacerItem(20, 20, QSizePolicy::Preferred, QSizePolicy::Ignored));

	vboxLayout = new QVBoxLayout;

	vboxLayout->addItem(
		new QSpacerItem(20, 40, QSizePolicy::Ignored, QSizePolicy::Preferred));

	label = new QLabel(tr("Mouse Speed:"), parent);
	label->setAlignment(Qt::AlignCenter);
	vboxLayout->addWidget(label);

	QHBoxLayout* hboxLayout2;
#define ADDMOUSESPEED(text, index) \
	hboxLayout2 = new QHBoxLayout; \
	label = new QLabel(tr(text), parent); \
	label->setAlignment(Qt::AlignRight|Qt::AlignVCenter); \
	label->setMaximumWidth(20); \
	hboxLayout2->addWidget(label); \
	mouseSpeeds[index] = new QLineEdit(parent); \
	mouseSpeeds[index]->setValidator(allInts); \
	mouseSpeeds[index]->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); \
	hboxLayout2->addWidget(mouseSpeeds[index]); \
	vboxLayout->addLayout(hboxLayout2); \

	ADDMOUSESPEED("X:", 0);
	ADDMOUSESPEED("Y:", 1);
#undef ADDMOUSESPEED

	vboxLayout->addItem(
		new QSpacerItem(20, 40, QSizePolicy::Ignored, QSizePolicy::Preferred));

	hboxLayout->addLayout(vboxLayout);

	hboxLayout->addItem(
		new QSpacerItem(20, 20, QSizePolicy::Preferred, QSizePolicy::Ignored));
}
FunctionDialog::FunctionDialog( QWidget* parent, Qt::WFlags fl )
    : QDialog( parent, fl )
{
    ApplicationWindow *app = (ApplicationWindow *)parent;
    QLocale locale = QLocale();
    int prec = 6;
    if (app) {
        locale = app->locale();
        prec = app->d_decimal_digits;
    }

    setObjectName( "FunctionDialog" );
    setWindowTitle( tr( "QtiPlot - Add function curve" ) );
    setSizeGripEnabled(true);

    QHBoxLayout *hbox1 = new QHBoxLayout();
    hbox1->addWidget(new QLabel(tr( "Curve type " )));
    boxType = new QComboBox();
    boxType->addItem( tr( "Function" ) );
    boxType->addItem( tr( "Parametric plot" ) );
    boxType->addItem( tr( "Polar plot" ) );
    hbox1->addWidget(boxType);

    optionStack = new QStackedWidget();
    optionStack->setFrameShape( QFrame::StyledPanel );
    optionStack->setFrameShadow( QStackedWidget::Plain );

    QGridLayout *gl1 = new QGridLayout();
    gl1->addWidget(new QLabel(tr( "f(x)= " )), 0, 0);
    boxFunction = new QTextEdit();
    boxFunction->setMinimumWidth(350);
    gl1->addWidget(boxFunction, 0, 1);
    gl1->addWidget(new QLabel(tr( "From x= " )), 1, 0);
    boxFrom = new DoubleSpinBox();
    boxFrom->setValue(0);
    boxFrom->setLocale(locale);
    boxFrom->setDecimals(prec);
    gl1->addWidget(boxFrom, 1, 1);
    gl1->addWidget(new QLabel(tr( "To x= " )), 2, 0);
    boxTo = new DoubleSpinBox();
    boxTo->setValue(1);
    boxTo->setLocale(locale);
    boxTo->setDecimals(prec);
    gl1->addWidget(boxTo, 2, 1);
    gl1->addWidget(new QLabel(tr( "Points" )), 3, 0);
    boxPoints = new QSpinBox();
    boxPoints->setRange(2, INT_MAX);
    boxPoints->setSingleStep(100);
    boxPoints->setValue(100);
    gl1->addWidget(boxPoints, 3, 1);

    boxConstants = new QTableWidget();
    boxConstants->setColumnCount(2);
    boxConstants->horizontalHeader()->setClickable(false);
    boxConstants->horizontalHeader()->setResizeMode (0, QHeaderView::ResizeToContents);
    boxConstants->horizontalHeader()->setResizeMode (1, QHeaderView::Stretch);
    QStringList header = QStringList() << tr("Constant") << tr("Value");
    boxConstants->setHorizontalHeaderLabels(header);
    boxConstants->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
    boxConstants->verticalHeader()->hide();
    boxConstants->setMinimumWidth(200);
    boxConstants->hide();

    functionPage = new QWidget();

    QHBoxLayout *hb = new QHBoxLayout(functionPage);
    hb->addLayout(gl1);
    hb->addWidget(boxConstants);

    optionStack->addWidget( functionPage );

    QGridLayout *gl2 = new QGridLayout();
    gl2->addWidget(new QLabel(tr( "Parameter" )), 0, 0);
    boxParameter = new QLineEdit();
    boxParameter->setText("m");
    gl2->addWidget(boxParameter, 0, 1);
    gl2->addWidget(new QLabel(tr( "From" )), 1, 0);
    boxParFrom = new QLineEdit();
    boxParFrom->setText("0");
    gl2->addWidget(boxParFrom, 1, 1);
    gl2->addWidget(new QLabel(tr( "To" )), 2, 0);
    boxParTo = new QLineEdit();
    boxParTo->setText("1");
    gl2->addWidget(boxParTo, 2, 1);
    gl2->addWidget(new QLabel(tr( "x = " )), 3, 0);
    boxXFunction = new QComboBox( );
    boxXFunction->setEditable ( true );
    gl2->addWidget(boxXFunction, 3, 1);
    gl2->addWidget(new QLabel(tr( "y = " )), 4, 0);
    boxYFunction = new QComboBox( );
    boxYFunction->setEditable ( true );
    gl2->addWidget(boxYFunction, 4, 1);
    gl2->addWidget(new QLabel(tr( "Points" )), 5, 0);
    boxParPoints = new QSpinBox();
    boxParPoints->setRange(2, 1000000);
    boxParPoints->setSingleStep(100);
    boxParPoints->setValue(100);
    gl2->addWidget(boxParPoints, 5, 1);
    gl2->setRowStretch(6, 1);

    parametricPage = new QWidget();
    parametricPage->setLayout(gl2);
    optionStack->addWidget( parametricPage );

    QGridLayout *gl3 = new QGridLayout();
    gl3->addWidget(new QLabel(tr( "Parameter" )), 0, 0);
    boxPolarParameter = new QLineEdit();
    boxPolarParameter->setText ("t");
    gl3->addWidget(boxPolarParameter, 0, 1);
    gl3->addWidget(new QLabel(tr( "From" )), 2, 0);
    boxPolarFrom = new QLineEdit();
    boxPolarFrom->setText("0");
    gl3->addWidget(boxPolarFrom, 2, 1);
    gl3->addWidget(new QLabel(tr( "To" )), 3, 0);
    boxPolarTo = new QLineEdit();
    boxPolarTo->setText("pi");
    gl3->addWidget(boxPolarTo, 3, 1);
    gl3->addWidget(new QLabel(tr( "R =" )), 4, 0);
    boxPolarRadius = new QComboBox();
    boxPolarRadius->setEditable ( true );
    gl3->addWidget(boxPolarRadius, 4, 1);
    gl3->addWidget(new QLabel(tr( "Theta =" )), 5, 0);
    boxPolarTheta = new QComboBox();
    boxPolarTheta->setEditable ( true );
    gl3->addWidget(boxPolarTheta, 5, 1);
    gl3->addWidget(new QLabel(tr( "Points" )), 6, 0);
    boxPolarPoints = new QSpinBox();
    boxPolarPoints->setRange(2, 1000000);
    boxPolarPoints->setSingleStep(100);
    boxPolarPoints->setValue(100);
    gl3->addWidget(boxPolarPoints, 6, 1);
    gl3->setRowStretch(7, 1);

    polarPage = new QWidget();
    polarPage->setLayout(gl3);
    optionStack->addWidget( polarPage );

    buttonClear = new QPushButton(tr( "Clea&r Function" ));
    buttonClear->setAutoDefault(false);
    buttonOk = new QPushButton(tr( "&Ok" ));
    buttonOk->setDefault(true);
    buttonCancel = new QPushButton(tr( "&Close" ));
    buttonCancel->setAutoDefault(false);

    QHBoxLayout *hbox2 = new QHBoxLayout();
    hbox2->addStretch();
    hbox2->addWidget(buttonClear);
    hbox2->addWidget(buttonOk);
    hbox2->addWidget(buttonCancel);

    QVBoxLayout *vbox1 = new QVBoxLayout();
    vbox1->addLayout(hbox1);
    vbox1->addWidget(optionStack);
    vbox1->addLayout(hbox2);

    setLayout(vbox1);
    setFocusProxy (boxFunction);

    connect( boxType, SIGNAL( activated(int) ), this, SLOT( raiseWidget(int) ) );
    connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
    connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
    connect( buttonClear, SIGNAL( clicked() ), this, SLOT(clearList() ) );

    curveID = -1;
    graph = 0;
}