Exemplo n.º 1
0
void VirtualConsole::initMenuBar()
{
    QString dir;
    _app->settings()->get(KEY_SYSTEM_DIR, dir);
    dir += QString("/") + PIXMAPPATH;

    setIcon(dir + QString("/virtualconsole.xpm"));

    m_layout = new QHBoxLayout(this);
    m_layout->setAutoAdd(false);

    m_menuBar = new QMenuBar(this);
    m_layout->setMenuBar(m_menuBar);

    //
    // Add menu
    //
    m_addMenu = new QPopupMenu();
    m_addMenu->insertItem(QPixmap(dir + "/button.xpm"),
                          "&Button", this, SLOT(slotAddButton()),
                          0, KVCMenuAddButton);
    m_addMenu->insertItem(QPixmap(dir + "/slider.xpm"),
                          "&Slider", this, SLOT(slotAddSlider()),
                          0, KVCMenuAddSlider);
    m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"),
                          "&Frame", this, SLOT(slotAddFrame()),
                          0, KVCMenuAddFrame);
    m_addMenu->insertItem(QPixmap(dir + "/frame.xpm"),
                          "&XY-Pad", this, SLOT(slotAddXYPad()),
                          0, KVCMenuAddXYPad);
    m_addMenu->setItemEnabled(KVCMenuAddXYPad, false);
    m_addMenu->insertItem(QPixmap(dir + "/rename.xpm"),
                          "L&abel", this, SLOT(slotAddLabel()),
                          0, KVCMenuAddLabel);

    //
    // Tools menu
    //
    m_toolsMenu = new QPopupMenu();
    m_toolsMenu->insertItem(QPixmap(dir + "/settings.xpm"),
                            "&Settings...", this, SLOT(slotToolsSettings()),
                            0, KVCMenuToolsSettings);
    m_toolsMenu->insertItem(QPixmap(dir + "/slider.xpm"),
                            "&Default Sliders", this, SLOT(slotToolsSliders()),
                            0, KVCMenuToolsSliders);
    m_toolsMenu->insertSeparator();
    m_toolsMenu->insertItem(QPixmap(dir + "/panic.xpm"),
                            "&Panic!", this, SLOT(slotToolsPanic()),
                            0, KVCMenuToolsPanic);


    //
    // Foreground menu
    //
    QPopupMenu* fgMenu = new QPopupMenu();
    fgMenu->insertItem(QPixmap(dir + QString("/color.xpm")),
                       "&Color...", this, SLOT(slotForegroundColor()),
                       0, KVCMenuForegroundColor);
    fgMenu->insertItem(QPixmap(dir + QString("/rename.xpm")),
                       "&Font...", this, SLOT(slotForegroundFont()),
                       0, KVCMenuForegroundFont);
    fgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")),
                       "&Default", this, SLOT(slotForegroundNone()),
                       0, KVCMenuForegroundNone);

    //
    // Background Menu
    //
    QPopupMenu* bgMenu = new QPopupMenu();
    bgMenu->insertItem(QPixmap(dir + QString("/color.xpm")),
                       "&Color...", this, SLOT(slotBackgroundColor()),
                       0, KVCMenuBackgroundColor);
    bgMenu->insertItem(QPixmap(dir + QString("/image.xpm")),
                       "&Image...", this, SLOT(slotBackgroundImage()),
                       0, KVCMenuBackgroundPixmap);
    bgMenu->insertItem(QPixmap(dir + QString("/fileclose.xpm")),
                       "&Default", this, SLOT(slotBackgroundNone()),
                       0, KVCMenuBackgroundNone);
    bgMenu->insertSeparator();
    bgMenu->insertItem(QPixmap(dir + QString("/frame.xpm")),
                       "Toggle &Frame", this, SLOT(slotBackgroundFrame()),
                       0, KVCMenuBackgroundFrame);

    //
    // Stacking order menu
    //
    QPopupMenu* stackMenu = new QPopupMenu();
    stackMenu->insertItem(QPixmap(dir + QString("/up.xpm")),
                          "&Raise", this, SLOT(slotStackingRaise()),
                          0, KVCMenuStackingRaise);
    stackMenu->insertItem(QPixmap(dir + QString("/down.xpm")),
                          "&Lower", this, SLOT(slotStackingLower()),
                          0, KVCMenuStackingLower);

    //
    // Edit menu
    //
    m_editMenu = new QPopupMenu();
    m_editMenu->insertItem(QPixmap(dir + "/editcut.xpm"),
                           "Cut", this, SLOT(slotEditCut()),
                           0, KVCMenuEditCut);

    m_editMenu->insertItem(QPixmap(dir + "/editcopy.xpm"),
                           "Copy", this, SLOT(slotEditCopy()),
                           0, KVCMenuEditCopy);

    m_editMenu->insertItem(QPixmap(dir + "/editpaste.xpm"),
                           "Paste", this, SLOT(slotEditPaste()),
                           0, KVCMenuEditPaste);

    m_editMenu->insertItem(QPixmap(dir + "/remove.xpm"),
                           "Delete", this, SLOT(slotEditDelete()),
                           0, KVCMenuEditDelete);

    m_editMenu->insertSeparator();

    m_editMenu->insertItem(QPixmap(dir + "/settings.xpm"),
                           "&Properties...", this, SLOT(slotEditProperties()),
                           0, KVCMenuEditProperties);
    m_editMenu->insertItem(QPixmap(dir + QString("/rename.xpm")),
                           "&Rename...", this, SLOT(slotEditRename()),
                           0, KVCMenuEditRename);

    m_editMenu->setItemEnabled(KVCMenuEditCut, false);
    m_editMenu->setItemEnabled(KVCMenuEditCopy, false);
    m_editMenu->setItemEnabled(KVCMenuEditPaste, false);

    m_editMenu->insertSeparator();

    m_editMenu->insertItem("Foreground", fgMenu, KVCMenuForegroundMin);
    m_editMenu->insertItem("Background", bgMenu, KVCMenuBackgroundMin);
    m_editMenu->insertItem("Stacking Order", stackMenu, KVCMenuStackingMin);

    m_menuBar->insertItem("&Tools", m_toolsMenu);
    m_menuBar->insertItem("&Add", m_addMenu);
    m_menuBar->insertItem("&Edit", m_editMenu);
}
Exemplo n.º 2
0
Prefs::Prefs (QWidget * parent, OPTIONS *op, MISC *mi):
  QDialog (parent, (Qt::WindowFlags) Qt::WA_DeleteOnClose)
{
  options = op;
  mod_options = *options;
  misc = mi;
  dataChanged = NVFalse;


  setWindowTitle (tr ("areaCheck 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 *cbox = new QGroupBox (tr ("Colors"), this);
  QHBoxLayout *cboxSplit = new QHBoxLayout;
  cbox->setLayout (cboxSplit);
  QVBoxLayout *cboxLeft = new QVBoxLayout;
  QVBoxLayout *cboxRight = new QVBoxLayout;
  cboxSplit->addLayout (cboxLeft);
  cboxSplit->addLayout (cboxRight);


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


  bMaskColor = new QPushButton (tr ("Landmask"), this);
  bMaskPalette = bMaskColor->palette ();
  bMaskColor->setToolTip (tr ("Change landmask color"));
  bMaskColor->setWhatsThis (maskColorText);
  connect (bMaskColor, SIGNAL (clicked ()), this, SLOT (slotMaskColor ()));
  cboxLeft->addWidget (bMaskColor);


  bBackgroundColor = new QPushButton (tr ("Background"), this);
  bBackgroundPalette = bBackgroundColor->palette ();
  bBackgroundColor->setToolTip (tr ("Change display background color"));
  bBackgroundColor->setWhatsThis (backgroundColorText);
  connect (bBackgroundColor, SIGNAL (clicked ()), this, SLOT (slotBackgroundColor ()));
  cboxRight->addWidget (bBackgroundColor);


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


  vbox->addWidget (cbox, 1);


  QGroupBox *c2box = new QGroupBox (tr ("Data Type Colors"), this);
  c2box->setWhatsThis (colorGrpText);

  c2[0] = new QPushButton (misc->type_name[ISS60_AREA], this);
  c2Palette[0] = c2[0]->palette ();
  c2[1] = new QPushButton (misc->type_name[GENERIC_AREA], this);
  c2Palette[1] = c2[1]->palette ();
  c2[2] = new QPushButton (misc->type_name[ACE_AREA], this);
  c2Palette[2] = c2[2]->palette ();
  c2[3] = new QPushButton (misc->type_name[ISS60_ZONE], this);
  c2Palette[3] = c2[3]->palette ();
  c2[4] = new QPushButton (misc->type_name[GENERIC_ZONE], this);
  c2Palette[4] = c2[4]->palette ();
  c2[5] = new QPushButton (misc->type_name[SHAPE], this);
  c2Palette[5] = c2[5]->palette ();
  c2[6] = new QPushButton (misc->type_name[TRACK], this);
  c2Palette[6] = c2[6]->palette ();
  c2[7] = new QPushButton (misc->type_name[FEATURE], this);
  c2Palette[7] = c2[7]->palette ();
  c2[8] = new QPushButton (misc->type_name[YXZ], this);
  c2Palette[8] = c2[8]->palette ();
  c2[9] = new QPushButton (misc->type_name[LLZ_DATA], this);
  c2Palette[9] = c2[9]->palette ();
  c2[10] = new QPushButton (misc->type_name[GEOTIFF], this);
  c2Palette[10] = c2[10]->palette ();
  c2[11] = new QPushButton (misc->type_name[CHRTR], this);
  c2Palette[11] = c2[11]->palette ();
  c2[12] = new QPushButton (misc->type_name[BAG], this);
  c2Palette[12] = c2[12]->palette ();
  c2[13] = new QPushButton (misc->type_name[OPTECH_FLT], this);
  c2Palette[13] = c2[13]->palette ();


  colorGrp = new QButtonGroup (c2box);
  colorGrp->setExclusive (FALSE);
  connect (colorGrp, SIGNAL (buttonClicked (int)), this, SLOT (slotColor (int)));

  colorGrp->addButton (c2[0], ISS60_AREA);
  colorGrp->addButton (c2[1], GENERIC_AREA);
  colorGrp->addButton (c2[2], ACE_AREA);
  colorGrp->addButton (c2[3], ISS60_ZONE);
  colorGrp->addButton (c2[4], GENERIC_ZONE);
  colorGrp->addButton (c2[5], SHAPE);
  colorGrp->addButton (c2[6], TRACK);
  colorGrp->addButton (c2[7], FEATURE);
  colorGrp->addButton (c2[8], YXZ);
  colorGrp->addButton (c2[9], LLZ_DATA);
  colorGrp->addButton (c2[10], GEOTIFF);
  colorGrp->addButton (c2[11], CHRTR);
  colorGrp->addButton (c2[12], BAG);
  colorGrp->addButton (c2[13], OPTECH_FLT);

  QHBoxLayout *c2boxSplit = new QHBoxLayout;
  QVBoxLayout *c2boxLeft = new QVBoxLayout;
  QVBoxLayout *c2boxRight = new QVBoxLayout;
  c2boxSplit->addLayout (c2boxLeft);
  c2boxSplit->addLayout (c2boxRight);
  c2boxLeft->addWidget (c2[0]);
  c2boxLeft->addWidget (c2[1]);
  c2boxLeft->addWidget (c2[2]);
  c2boxLeft->addWidget (c2[3]);
  c2boxLeft->addWidget (c2[4]);
  c2boxLeft->addWidget (c2[5]);
  c2boxLeft->addWidget (c2[6]);
  c2boxRight->addWidget (c2[7]);
  c2boxRight->addWidget (c2[8]);
  c2boxRight->addWidget (c2[9]);
  c2boxRight->addWidget (c2[10]);
  c2boxRight->addWidget (c2[11]);
  c2boxRight->addWidget (c2[12]);
  c2boxRight->addWidget (c2[13]);
  c2box->setLayout (c2boxSplit);

  vbox->addWidget (c2box, 1);


  QGroupBox *sunBox = new QGroupBox (tr ("CHRTR/BAG Sun Shading"), this);
  QHBoxLayout *sunBoxLayout = new QHBoxLayout;
  sunBox->setLayout (sunBoxLayout);

  QGroupBox *angBox = new QGroupBox (tr ("Angle"), this);
  QHBoxLayout *angBoxLayout = new QHBoxLayout;
  angBox->setLayout (angBoxLayout);
  sunAz = new QDoubleSpinBox (angBox);
  sunAz->setDecimals (1);
  sunAz->setRange (0.0, 359.9);
  sunAz->setSingleStep (1.0);
  sunAz->setValue (mod_options.sunopts.azimuth);
  sunAz->setWrapping (TRUE);
  sunAz->setToolTip (tr ("Change the sun angle (0.0-360.0)"));
  sunAz->setWhatsThis (sunAzText);
  angBoxLayout->addWidget (sunAz);
  sunBoxLayout->addWidget (angBox);


  QGroupBox *eleBox = new QGroupBox (tr ("Elevation"), this);
  QHBoxLayout *eleBoxLayout = new QHBoxLayout;
  eleBox->setLayout (eleBoxLayout);
  sunEl = new QDoubleSpinBox (eleBox);
  sunEl->setDecimals (1);
  sunEl->setRange (0.0, 90.0);
  sunEl->setSingleStep (1.0);
  sunEl->setValue (mod_options.sunopts.elevation);
  sunEl->setWrapping (TRUE);
  sunEl->setToolTip (tr ("Change the sun elevation (0.0-90.0)"));
  sunEl->setWhatsThis (sunElText);
  eleBoxLayout->addWidget (sunEl);
  sunBoxLayout->addWidget (eleBox);


  QGroupBox *exaBox = new QGroupBox (tr ("Exaggeration"), this);
  QHBoxLayout *exaBoxLayout = new QHBoxLayout;
  exaBox->setLayout (exaBoxLayout);
  sunEx = new QDoubleSpinBox (exaBox);
  sunEx->setDecimals (1);
  sunEx->setRange (0.0, 359.9);
  sunEx->setSingleStep (1.0);
  sunEx->setValue (mod_options.sunopts.exag);
  sunEx->setWrapping (TRUE);
  sunEx->setToolTip (tr ("Change the sun Z exaggeration (1-10)"));
  sunEx->setWhatsThis (sunExText);
  exaBoxLayout->addWidget (sunEx);
  sunBoxLayout->addWidget (exaBox);


  vbox->addWidget (sunBox, 1);


  QGroupBox *mbox = new QGroupBox (tr ("MINMAX parameters"), this);
  mbox->setWhatsThis (colorGrpText);
  QHBoxLayout *mboxLayout = new QHBoxLayout;
  mbox->setLayout (mboxLayout);

  QGroupBox *sBox = new QGroupBox (tr ("Use stoplight colors"), this);
  QHBoxLayout *sBoxLayout = new QHBoxLayout;
  sBox->setLayout (sBoxLayout);
  stopLight = new QCheckBox (this);
  connect (stopLight, SIGNAL (clicked ()), this, SLOT (slotStopLightClicked ()));
  stopLight->setToolTip (tr ("Use stoplight colors when displaying MINMAX .trk files"));
  stopLight->setWhatsThis (stopLightText);
  sBoxLayout->addWidget (stopLight);
  mboxLayout->addWidget (sBox);

  QGroupBox *gBox = new QGroupBox (tr ("Green to yellow value"), this);
  QHBoxLayout *gBoxLayout = new QHBoxLayout;
  gBox->setLayout (gBoxLayout);
  minStop = new QLineEdit (this);
  mboxLayout->addWidget (minStop);
  minStop->setToolTip (tr ("Set value below which data is green"));
  minStop->setWhatsThis (minStopText);
  gBoxLayout->addWidget (minStop);
  mboxLayout->addWidget (gBox);

  QGroupBox *yBox = new QGroupBox (tr ("Yellow to red value"), this);
  QHBoxLayout *yBoxLayout = new QHBoxLayout;
  yBox->setLayout (yBoxLayout);
  maxStop = new QLineEdit (this);
  mboxLayout->addWidget (maxStop);
  maxStop->setToolTip (tr ("Set value above which data is red"));
  maxStop->setWhatsThis (maxStopText);
  yBoxLayout->addWidget (maxStop);
  mboxLayout->addWidget (yBox);


  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 ();
}