示例#1
1
PreFlightGliderPage::PreFlightGliderPage(QWidget *parent) :
  QWidget(parent),
  m_lastGlider(0)
{
  setObjectName("PreFlightGliderPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Glider") );

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

  QHBoxLayout *contentLayout = new QHBoxLayout;
  setLayout(contentLayout);

  QGridLayout* topLayout = new QGridLayout;
  topLayout->setMargin(5);

  contentLayout->addLayout(topLayout);

  int row = 0;
  QLabel* lblPilot = new QLabel(tr("Pilot:"), this);
  topLayout->addWidget(lblPilot, row, 0);

  Qt::InputMethodHints imh;

  m_edtPilot = new QLineEdit(this);
  imh = (m_edtPilot->inputMethodHints() | Qt::ImhNoPredictiveText);
  m_edtPilot->setInputMethodHints(imh);
  m_edtPilot->setText( GeneralConfig::instance()->getSurname() );

  connect( m_edtPilot, SIGNAL(returnPressed()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  topLayout->addWidget(m_edtPilot, row, 1);

  QLabel* lblLoad = new QLabel(tr("Load corr:"), this);
  topLayout->addWidget(lblLoad, row, 2);

  m_edtLoad = new NumberEditor;
  m_edtLoad->setDecimalVisible( false );
  m_edtLoad->setPmVisible( true );
  m_edtLoad->setMaxLength(4);
  m_edtLoad->setSuffix(" kg");
  m_edtLoad->setRange( -999, 999 );
  m_edtLoad->setValue( 0 );
  topLayout->addWidget(m_edtLoad, row, 3);
  row++;

  m_edtCoPilotLabel = new QLabel(tr("Copilot:"), this);
  topLayout->addWidget(m_edtCoPilotLabel, row, 0);
  m_edtCoPilot = new QLineEdit(this);
  m_edtCoPilot->setInputMethodHints(imh);

  connect( m_edtCoPilot, SIGNAL(returnPressed()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  topLayout->addWidget(m_edtCoPilot, row, 1);

  QLabel* lblWater = new QLabel(tr("Water ballast:"), this);
  topLayout->addWidget(lblWater, row, 2);

  m_edtWater = new NumberEditor;
  m_edtWater->setDecimalVisible( false );
  m_edtWater->setPmVisible( false );
  m_edtWater->setMaxLength(4);
  m_edtWater->setSuffix(" l");
  m_edtWater->setRange( 0, 9999 );
  m_edtWater->setValue( 0 );
  topLayout->addWidget(m_edtWater, row, 3);
  row++;

  QHBoxLayout* hbox = new QHBoxLayout;
  hbox->addWidget( new QLabel(tr("Ref. weight:"), this) );
  m_refWeight = new QLabel;
  m_refWeight->setFocusPolicy(Qt::NoFocus);
  hbox->addWidget( m_refWeight, 10 );
  topLayout->addLayout( hbox, row, 0, 1, 2 );

  hbox = new QHBoxLayout;
  hbox->addWidget( new QLabel(tr("Wing load:"), this) );
  m_wingLoad = new QLabel;
  m_wingLoad->setFocusPolicy(Qt::NoFocus);
  hbox->addWidget( m_wingLoad, 10 );
  topLayout->addLayout( hbox, row, 2, 1, 2 );
  row++;

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

  m_gliderList = new GliderListWidget( this, true );

#ifndef ANDROID
  m_gliderList->setToolTip(tr("Select a glider to be used"));
#endif

#ifdef ANDROID
  QScrollBar* lvsb = m_gliderList->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

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

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

  topLayout->addWidget(m_gliderList, row, 0, 1, 4);
  row++;

  //---------------------------------------------------------------------
  QPushButton* deselect = new QPushButton( tr("Deselect"), this );
#ifndef ANDROID
  deselect->setToolTip( tr("Clear glider selection") );
#endif
  topLayout->addWidget( deselect, row, 3 );

  //---------------------------------------------------------------------
  m_gliderList->fillList();
  m_gliderList->clearSelection();
  m_gliderList->selectItemFromList();

  connect(deselect, SIGNAL(clicked()), this, SLOT(slotGliderDeselected()) );
  connect(m_gliderList, SIGNAL(itemSelectionChanged()), this, SLOT(slotGliderChanged()));
  connect(m_edtLoad, SIGNAL(numberEdited(const QString&)), this, SLOT(slotLoadEdited(const QString&)));
  connect(m_edtWater, SIGNAL(numberEdited(const QString&)), this, SLOT(slotWaterEdited(const QString&)));

  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);
}
示例#2
0
    // ScriptDialog
    ScriptDialog::ScriptDialog(QDesignerDialogGuiInterface *m_dialogGui, QWidget *parent) :
        QDialog(parent),
        m_dialogGui(m_dialogGui),
        m_textEdit(new QTextEdit)
    {
        setWindowTitle(tr("Edit script"));
        setModal(true);

        QVBoxLayout *vboxLayout = new QVBoxLayout(this);

        const QString textHelp = tr("\
<html>Enter a Qt Script snippet to be executed while loading the form.<br>\
The widget and its children are accessible via the \
variables <i>widget</i> and <i>childWidgets</i>, respectively.");
        m_textEdit->setToolTip(textHelp);
        m_textEdit->setWhatsThis(textHelp);
        m_textEdit->setMinimumSize(QSize(600, 400));
        vboxLayout->addWidget(m_textEdit);
        new QScriptHighlighter(m_textEdit->document());
        // button box
        QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
        connect(buttonBox , SIGNAL(rejected()), this, SLOT(reject()));
        connect(buttonBox , SIGNAL(accepted()), this, SLOT(slotAccept()));
        vboxLayout->addWidget(buttonBox);
    }
示例#3
0
/**
 * Starts authentication by opening the browser
 */
void Authorize::doOAuth()
{
    QUrl url(QString::fromLatin1("https://accounts.google.com/o/oauth2/auth"));
    QUrlQuery urlQuery;
    urlQuery.addQueryItem(QString::fromLatin1("scope"),         m_scope);
    urlQuery.addQueryItem(QString::fromLatin1("redirect_uri"),  m_redirect_uri);
    urlQuery.addQueryItem(QString::fromLatin1("response_type"), m_response_type);
    urlQuery.addQueryItem(QString::fromLatin1("client_id"),     m_client_id);
    urlQuery.addQueryItem(QString::fromLatin1("access_type"),   QString::fromLatin1("offline"));
    url.setQuery(urlQuery);
    qCDebug(KIPIPLUGINS_LOG) << "OAuth URL: " << url;
    QDesktopServices::openUrl(url);

    emit signalBusy(false);

    m_window = new QDialog(QApplication::activeWindow(),0);
    m_window->setModal(true);
    m_window->setWindowTitle(i18n("Google Drive Authorization"));

    QDialogButtonBox* const buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
    QPushButton* const okButton       = buttonBox->button(QDialogButtonBox::Ok);
    okButton->setDefault(true);

    m_window->connect(buttonBox, SIGNAL(accepted()),
                      this, SLOT(slotAccept()));

    m_window->connect(buttonBox, SIGNAL(rejected()),
                      this, SLOT(slotReject()));

    QLineEdit* const textbox      = new QLineEdit();
    QPlainTextEdit* const infobox = new QPlainTextEdit(i18n("Please follow the instructions in the browser. "
                                                            "After logging in and authorizing the application, "
                                                            "copy the code from the browser, paste it in the "
                                                            "textbox below, and click OK."));
    QVBoxLayout* const layout = new QVBoxLayout;
    m_window->setLayout(layout);
    infobox->setReadOnly(true);
    layout->addWidget(infobox);
    layout->addWidget(textbox);
    layout->addWidget(buttonBox);

    m_window->exec();

    if (m_window->result() == QDialog::Accepted && !(textbox->text().isEmpty()))
    {
        qCDebug(KIPIPLUGINS_LOG) << "1";
        m_code = textbox->text();
    }

    if (textbox->text().isEmpty())
    {
        qCDebug(KIPIPLUGINS_LOG) << "3";
        emit signalTextBoxEmpty();
    }

    if (m_code != QString::fromLatin1("0"))
    {
        getAccessToken();
    }
}
示例#4
0
ShortcutsImpl::ShortcutsImpl(QWidget * parent)
    : QDialog(parent), m_mainImpl((MainImpl *)parent)
{
    setupUi(this);
    initTable( m_mainImpl );
    connect(okButton, SIGNAL(clicked()), this, SLOT(slotAccept()) );
    connect(defaultButton, SIGNAL(clicked()), this, SLOT(slotDefault()) );
}
/*
 *  Constructs a AddDirectoryServiceDialogImpl which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 *
 *  The dialog will by default be modeless, unless you set 'modal' to
 *  TRUE to construct a modal dialog.
 */
AddDirectoryServiceDialogImpl::AddDirectoryServiceDialogImpl( QWidget* parent,  const char* name, bool modal, Qt::WindowFlags fl )
    : QDialog(parent, fl), AddDirectoryServiceDialog()
{
    setObjectName( name );
    setModal( modal );
    setupUi(this);
    portED->setValidator( new QIntValidator( 0, 65535, portED ) );
    connect(PushButton3, SIGNAL(clicked()), SLOT(slotAccept()));
    connect(PushButton4, SIGNAL(clicked()), SLOT(slotCancel()));
}
QuickConnect::QuickConnect(QWidget *parent) : QDialog(parent) {
    setupUi(this);

    comboBox_HUB->addItems(WulforSettings::getInstance()->getStr(WS_QCONNECT_HISTORY).split(" ", QString::SkipEmptyParts));

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()));
    connect(comboBox_HUB, SIGNAL(activated(int)), this, SLOT(slotAccept()));

    comboBox_HUB->setFocus();
}
SM_CreateFolderDialog::SM_CreateFolderDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::CreateFolderDialog)
{
    ui->setupUi(this);
    ui->nameEdit->setFocus();

    connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()));
    connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(slotReject()));
    connect(this, SIGNAL(finished(int)), this, SLOT(slotFinished(int)));
}
示例#8
0
Export::Export( QWidget *parent ) : QDialog( parent, "Export", true )
{
    //Initializations
    setCaption( tr( "Export" ) );
    setFont( QFont( "helvetica", 10 ) );
    setPaletteBackgroundColor( QColor( 239, 237, 223 ) );
    parent_widget = parent;
    k_toon = ( Ktoon * )parent_widget;
    setMinimumSize( 210, 220 );
    setMaximumSize( 210, 220 );

    //------------- Operations on the static texts ----------

    main_text = new QLabel( tr( "Select the option to export:" ), this );
    main_text -> resize( 200, 20 );
    main_text -> move( 10, 10 );

    //------------- Operations on the radio buttons -------------

    group = new QButtonGroup( this );
    group -> move( main_text -> x(), main_text -> y() + main_text -> height() + 10 );
    group -> resize( 190, 130 );

    rb_animation = new QRadioButton( tr( "Animation" ), group );
    rb_animation -> move( 5, 5 );
    rb_animation -> setChecked( true );

    rb_single_frame = new QRadioButton( tr( "Single Frame" ), group );
    rb_single_frame -> move( rb_animation -> x(), rb_animation -> y() + rb_animation -> height() );
    rb_single_frame -> resize( 180, rb_single_frame -> height() );

    rb_swf = new QRadioButton( tr( "SWF (Macromedia Flash)" ), group );
    rb_swf -> move( rb_single_frame -> x(), rb_single_frame -> y() + rb_single_frame -> height() );
    rb_swf -> resize( 180, rb_swf -> height() );

    rb_svg = new QRadioButton( tr( "SVG" ), group );
    rb_svg -> move( rb_swf -> x(), rb_swf -> y() + rb_swf -> height() );

    //------------- Operations on the buttons -----------------

    accept = new QPushButton( tr( "Accept" ), this );
    accept -> resize( 60, 30 );
    accept -> move( group -> x() + 50, group -> y() + group -> height() + 10 );
    connect( accept, SIGNAL( clicked() ), SLOT( slotAccept() ) );

    cancel = new QPushButton( tr( "Cancel" ), this );
    cancel -> resize( 60, 30 );
    cancel -> move( accept -> x() + accept -> width() + 10, accept -> y() );
    connect( cancel, SIGNAL( clicked() ), SLOT( slotCancel() ) );
}
示例#9
0
/** Ask for authorization and login by opening browser
 */
void DBTalker::doOAuth()
{
    QUrl url(QString::fromLatin1("https://api.dropbox.com/1/oauth/authorize"));
    qCDebug(KIPIPLUGINS_LOG) << "in doOAuth()" << m_oauthToken;
    QUrlQuery q(url);
    q.addQueryItem(QString::fromLatin1("oauth_token"), m_oauthToken);
    url.setQuery(q);

    qCDebug(KIPIPLUGINS_LOG) << "OAuth URL: " << url;
    QDesktopServices::openUrl(url);

    emit signalBusy(false);

    m_dialog = new QDialog(QApplication::activeWindow(), 0);
    m_dialog->setModal(true);
    m_dialog->setWindowTitle(i18n("Authorize Dropbox"));
    QDialogButtonBox* const buttons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, m_dialog);
    buttons->button(QDialogButtonBox::Ok)->setDefault(true);

    m_dialog->connect(buttons, SIGNAL(accepted()),
                      this, SLOT(slotAccept()));

    m_dialog->connect(buttons, SIGNAL(rejected()),
                      this, SLOT(slotReject()));

    QPlainTextEdit* const infobox = new QPlainTextEdit(i18n("Please follow the instructions in the browser. "
                                                            "After logging in and authorizing the application, press OK."));
    infobox->setReadOnly(true);

    QVBoxLayout* const vbx = new QVBoxLayout(m_dialog);
    vbx->addWidget(infobox);
    vbx->addWidget(buttons);
    m_dialog->setLayout(vbx);

    m_dialog->exec();

    if (m_dialog->result() == QDialog::Accepted)
    {
        getAccessToken();
    }
    else
    {
        return;
    }
}
示例#10
0
CustomVideoFmtDlg::CustomVideoFmtDlg(QWidget* parent, VideoFormat& vidfmt)
: QDialog(parent, QT_DEFAULT_DIALOG_HINTS)
, m_vidfmt(vidfmt)
{
    ui.setupUi(this);
    setWindowIcon(QIcon(APPICON));

    if(vidfmt.nFPS_Denominator>0)
        ui.fpsEdit->setText(QString::number(vidfmt.nFPS_Numerator/vidfmt.nFPS_Denominator));
    else
        ui.fpsEdit->setText(QString::number(10));

    ui.widthEdit->setText(QString::number(vidfmt.nWidth));
    ui.heightEdit->setText(QString::number(vidfmt.nHeight));


    connect(this, SIGNAL(accepted()), SLOT(slotAccept()));
}
示例#11
0
void PlotterFrame::initGUI()
{
    std::cout << "initGUI()\n";
    setWindowTitle(QObject::tr("Plotter"));
    leX = new QLineEdit();
    leY = new QLineEdit();
    QHBoxLayout* loCoords = new QHBoxLayout;
    loCoords->addWidget(leX);
    loCoords->addWidget(leY);
    btAccept = new QPushButton(QObject::tr("Accept"));
    connect(btAccept, SIGNAL(clicked()), this, SLOT(slotAccept()));
    pnPlotter = new Plotter();
    QVBoxLayout* loMain = new QVBoxLayout;
    loMain->addLayout(loCoords);
    loMain->addWidget(btAccept);
    loMain->addWidget(pnPlotter);
    setCentralWidget(new QWidget());
    centralWidget()->setLayout(loMain);
};
示例#12
0
void AntiSpamFrame::InitDocument() {
   if (WBGET(WB_ANTISPAM_ENABLED)) {
        if (!AntiSpam::getInstance())
            AntiSpam::newInstance();

        AntiSpam::getInstance()->loadSettings();
        AntiSpam::getInstance()->loadLists();

        checkBox_ASENABLE->setChecked(true);
    } else
        checkBox_ASENABLE->setChecked(false);

    loadGUIData();

    connect(checkBox_ASENABLE, SIGNAL(clicked()), this, SLOT(slotAntiSpamSwitch()));
    connect(checkBox_ASFILTER, SIGNAL(clicked()), this, SLOT(slotAsFilter()));
    connect(checkBox_FILTER_OPS, SIGNAL(clicked()), this, SLOT(slotFilterOps()));

    connect(pushButton_ADDWHITE, SIGNAL(clicked()), this, SLOT(slotAddToWhite()));
    connect(pushButton_ADDBLACK, SIGNAL(clicked()), this, SLOT(slotAddToBlack()));
    connect(pushButton_ADDGRAY, SIGNAL(clicked()), this, SLOT(slotAddToGray()));
    connect(pushButton_REMWHITE, SIGNAL(clicked()), this, SLOT(slotRemFromWhite()));
    connect(pushButton_REMBLACK, SIGNAL(clicked()), this, SLOT(slotRemFromBlack()));
    connect(pushButton_REMGRAY, SIGNAL(clicked()), this, SLOT(slotRemFromGray()));
    connect(pushButton_CLRWHITE, SIGNAL(clicked()), this, SLOT(slotClearWhite()));
    connect(pushButton_CLRBLACK, SIGNAL(clicked()), this, SLOT(slotClearBlack()));
    connect(pushButton_CLRGRAY, SIGNAL(clicked()), this, SLOT(slotClearGray()));

    connect(pushButton_OK, SIGNAL(clicked()), this, SLOT(slotAccept()));

    connect(pushButton_WTOG, SIGNAL(clicked()), this, SLOT(slotWToG()));
    connect(pushButton_WTOB, SIGNAL(clicked()), this, SLOT(slotWToB()));
    connect(pushButton_BTOW, SIGNAL(clicked()), this, SLOT(slotBToW()));
    connect(pushButton_BTOG, SIGNAL(clicked()), this, SLOT(slotBToG()));
    connect(pushButton_GTOB, SIGNAL(clicked()), this, SLOT(slotGToB()));
    connect(pushButton_GTOW, SIGNAL(clicked()), this, SLOT(slotGToW()));

    connect(WulforSettings::getInstance(), SIGNAL(strValueChanged(QString,QString)), this, SLOT(slotSettingsChanged(QString,QString)));

    slotAntiSpamSwitch();
}
KSimPackageFileDialog::KSimPackageFileDialog(QWidget *parent, const char * name)
	:	KDialogBase(KDialogBase::Plain,
		            i18n("Package Files"),
		            KDialogBase::Default | KDialogBase::Ok | KDialogBase::Cancel,
		            KDialogBase::Ok,
		            parent, name)
{
	QWidget * wid = plainPage();
			
	KSimPackageFileWidget * child = new KSimPackageFileWidget(wid, i18n("Package Files"));
			
	QBoxLayout * horLayout = new QHBoxLayout(wid);
/*	horLayout->setMargin(KDialog::marginHint());
	horLayout->setSpacing(KDialog::spacingHint());*/
	horLayout->addWidget(child);
			
	connect(this, SIGNAL(okClicked()), child, SLOT(slotAccept()));
	connect(this, SIGNAL(defaultClicked()), child, SLOT(slotDefault()));
	connect(this, SIGNAL(cancelClicked()), child, SLOT(slotCancel()));
	
}
示例#14
0
void SettingsDialog::accept()
{
    m_saveSignalCount = 0;

    Q_FOREACH(ConfigurationWidgetInterface *page, pages) {
        if (!page->checkValidity()) {
            stack->setCurrentWidget(page->asWidget());
            return;
        }
        connect(page->asWidget(), SIGNAL(saved()), this, SLOT(slotAccept()));
        ++m_saveSignalCount;
    }

#ifndef Q_OS_WIN
    // Try to wour around QSettings' inability to set umask for its file access. We don't want to set umask globally.
    QFile settingsFile(m_settings->fileName());
    settingsFile.setPermissions(QFile::ReadUser | QFile::WriteUser);
#endif

    buttons->setEnabled(false);
    Q_FOREACH(ConfigurationWidgetInterface *page, pages) {
        page->asWidget()->setEnabled(false);
    }
示例#15
0
PreFlightCheckListPage::PreFlightCheckListPage( QWidget* parent ) :
  QWidget( parent ),
  CheckListFileName("cumulus-checklist.txt")
{
  setObjectName("PreFlightCheckListPage");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("PreFlight - Checklist") );

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

  QVBoxLayout *contentLayout = new QVBoxLayout;
  setLayout(contentLayout);

  m_fileDisplay = new QLabel;
  m_fileDisplay->setWordWrap( true );
  m_fileDisplay->hide();
  contentLayout->addWidget( m_fileDisplay );

  QHBoxLayout *hbox = new QHBoxLayout;
  hbox->setMargin( 0 );
  contentLayout->addLayout( hbox );

  m_list = new QTableWidget( 0, 2, this );
  m_list->setSelectionBehavior( QAbstractItemView::SelectItems );
  m_list->setHorizontalScrollBarPolicy( Qt::ScrollBarAsNeeded );
  m_list->setAlternatingRowColors( true );
  m_list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  m_list->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

  // calculates the needed icon size
  QFontMetrics qfm( font() );
  int iconSize = qfm.height();

  // Sets the icon size of a list entry
  m_list->setIconSize( QSize(iconSize, iconSize) );

  hbox->addWidget( m_list );

  connect( m_list, SIGNAL(cellDoubleClicked(int, int)),
           SLOT(slotEditCell(int, int)) );

  connect( m_list, SIGNAL(cellClicked(int, int)),
           SLOT(slotCellClicked(int, int)) );

#ifdef ANDROID
  QScrollBar* lvsb = m_list->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

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

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

  QString style = "QTableView QTableCornerButton::section { background: gray }";
  m_list->setStyleSheet( style );
  QHeaderView *vHeader = m_list->verticalHeader();
  style = "QHeaderView::section { width: 2em }";
  vHeader->setStyleSheet( style );

  // set new row height from configuration
  int afMargin = GeneralConfig::instance()->getListDisplayAFMargin();
  rowDelegate = new RowDelegate( m_list, afMargin );
  m_list->setItemDelegate( rowDelegate );

  QHeaderView* hHeader = m_list->horizontalHeader();
  hHeader->setStretchLastSection( true );
  hHeader->hide();

  QTableWidgetItem *item = new QTableWidgetItem( tr(" Check Point ") );
  m_list->setHorizontalHeaderItem( 0, item );

#ifndef ANDROID
  int buttonSize = Layout::getButtonSize();
#else
  int buttonSize = Layout::getButtonSize(16);
#endif

  iconSize   = buttonSize - 5;

  QPushButton* toggleButton = new QPushButton(this);
  toggleButton->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("file-32.png")));
  toggleButton->setIconSize( QSize(iconSize, iconSize) );
  toggleButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  toggleButton->setMinimumSize(buttonSize, buttonSize);
  toggleButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *addButton = new QPushButton;
  addButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "add.png" ) ) );
  addButton->setIconSize(QSize(iconSize, iconSize));
  addButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  addButton->setMinimumSize(buttonSize, buttonSize);
  addButton->setMaximumSize(buttonSize, buttonSize);

  m_editButton = new QPushButton(this);
  m_editButton->setIcon( QIcon(GeneralConfig::instance()->loadPixmap("edit_new.png")) );
  m_editButton->setIconSize( QSize(iconSize, iconSize) );
  m_editButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_editButton->setMinimumSize(buttonSize, buttonSize);
  m_editButton->setMaximumSize(buttonSize, buttonSize);

  m_deleteButton = new QPushButton;
  m_deleteButton->setIcon( QIcon( GeneralConfig::instance()->loadPixmap( "delete.png" ) ) );
  m_deleteButton->setIconSize( QSize(iconSize, iconSize) );
  m_deleteButton->setEnabled(false);
  m_deleteButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_deleteButton->setMinimumSize(buttonSize, buttonSize);
  m_deleteButton->setMaximumSize(buttonSize, buttonSize);

  QPushButton *cancel = new QPushButton(this);
  cancel->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("cancel.png")));
  cancel->setIconSize(QSize(iconSize, iconSize));
  cancel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  cancel->setMinimumSize(buttonSize, buttonSize);
  cancel->setMaximumSize(buttonSize, buttonSize);

  m_ok = new QPushButton(this);
  m_ok->setIcon(QIcon(GeneralConfig::instance()->loadPixmap("ok.png")));
  m_ok->setIconSize(QSize(iconSize, iconSize));
  m_ok->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::QSizePolicy::Preferred);
  m_ok->setMinimumSize(buttonSize, buttonSize);
  m_ok->setMaximumSize(buttonSize, buttonSize);

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

  connect( addButton, SIGNAL(pressed()), SLOT(slotAddRow()) );
  connect( toggleButton, SIGNAL(pressed()), SLOT(slotToogleFilenameDisplay()) );
  connect( m_editButton, SIGNAL(pressed()), SLOT(slotEdit()) );
  connect( m_deleteButton, SIGNAL(pressed()), SLOT(slotDeleteRows()) );
  connect( m_ok, SIGNAL(pressed()), SLOT(slotAccept()) );
  connect( cancel, SIGNAL(pressed()), SLOT(slotReject()) );

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

  buttonBox->setSpacing(0);
  buttonBox->addWidget(toggleButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(addButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_editButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_deleteButton);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(cancel);
  buttonBox->addSpacing(10 * Layout::getIntScaledDensity());
  buttonBox->addWidget(m_ok);
  buttonBox->addStretch(2);
  buttonBox->addWidget(titlePix);
}
示例#16
0
SettingsPageUnits::SettingsPageUnits(QWidget *parent) : QWidget(parent)
{
  setObjectName("SettingsPageUnits");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Units") );

  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 ANDROID
  QScrollBar* lvsb = sa->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#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;
  setLayout(contentLayout);

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

  // The parent of the layout is the scroll widget
  QGridLayout *topLayout = new QGridLayout(sw);

  int row=0;

  QLabel *label = new QLabel(tr("Altitude:"), this);
  topLayout->addWidget(label, row, 0);
  UnitAlt = new QComboBox(this);
  UnitAlt->setObjectName("UnitAlt");
  UnitAlt->setEditable(false);
  topLayout->addWidget(UnitAlt,row++,1);
  UnitAlt->addItem(tr("meters"));
  UnitAlt->addItem(tr("feet"));
  altitudes[0] = int(Altitude::meters);
  altitudes[1] = int(Altitude::feet);

  label = new QLabel(tr("Speed:"), this);
  topLayout->addWidget(label, row, 0);
  UnitSpeed = new QComboBox(this);
  UnitSpeed->setObjectName("UnitSpeed");
  UnitSpeed->setEditable(false);
  topLayout->addWidget(UnitSpeed,row++,1);
  UnitSpeed->addItem(tr("meters per second"));
  UnitSpeed->addItem(tr("kilometers per hour"));
  UnitSpeed->addItem(tr("knots"));
  UnitSpeed->addItem(tr("miles per hour"));
  speeds[0] = Speed::metersPerSecond;
  speeds[1] = Speed::kilometersPerHour;
  speeds[2] = Speed::knots;
  speeds[3] = Speed::milesPerHour;

  label = new QLabel(tr("Distance:"), this);
  topLayout->addWidget(label, row, 0);
  UnitDistance = new QComboBox(this);
  UnitDistance->setObjectName("UnitDistance");
  UnitDistance->setEditable(false);
  topLayout->addWidget(UnitDistance,row++,1);
  UnitDistance->addItem(tr("kilometers"));
  UnitDistance->addItem(tr("statute miles"));
  UnitDistance->addItem(tr("nautical miles"));
  distances[0] = Distance::kilometers;
  distances[1] = Distance::miles;
  distances[2] = Distance::nautmiles;

  label = new QLabel(tr("Vario:"), this);
  topLayout->addWidget(label, row, 0);
  UnitVario = new QComboBox(this);
  UnitVario->setObjectName("UnitVario");
  UnitVario->setEditable(false);
  topLayout->addWidget(UnitVario,row++,1);
  UnitVario->addItem(tr("meters per second"));
  UnitVario->addItem(tr("feet per minute"));
  UnitVario->addItem(tr("knots"));
  varios[0] = Speed::metersPerSecond;
  varios[1] = Speed::feetPerMinute;
  varios[2] = Speed::knots;

  label = new QLabel(tr("Wind:"), this);
  topLayout->addWidget(label, row, 0);
  UnitWind = new QComboBox(this);
  UnitWind->setObjectName("UnitWind");
  UnitWind->setEditable(false);
  topLayout->addWidget(UnitWind,row++,1);
  UnitWind->addItem(tr("meters per second"));
  UnitWind->addItem(tr("kilometers per hour"));
  UnitWind->addItem(tr("knots"));
  UnitWind->addItem(tr("miles per hour"));
  winds[0] = Speed::metersPerSecond;
  winds[1] = Speed::kilometersPerHour;
  winds[2] = Speed::knots;
  winds[3] = Speed::milesPerHour;

  label = new QLabel(tr("Position:"), this);
  topLayout->addWidget(label, row, 0);
  UnitPosition = new QComboBox(this);
  UnitPosition->setObjectName("UnitPosition");
  UnitPosition->setEditable(false);
  topLayout->addWidget(UnitPosition,row++,1);
  UnitPosition->addItem(QString("ddd") + Qt::Key_degree + "mm'ss\"");
  UnitPosition->addItem(QString("ddd") + Qt::Key_degree + "mm.mmm'");
  UnitPosition->addItem(QString("ddd.ddddd") + Qt::Key_degree);
  positions[0] = WGSPoint::DMS;
  positions[1] = WGSPoint::DDM;
  positions[2] = WGSPoint::DDD;

  label = new QLabel(tr("Time:"), this);
  topLayout->addWidget(label, row, 0);
  UnitTime = new QComboBox(this);
  UnitTime->setObjectName("UnitTime");
  UnitTime->setEditable(false);
  topLayout->addWidget(UnitTime,row++,1);
  UnitTime->addItem(tr("UTC"));
  UnitTime->addItem(tr("Local"));
  times[0] = Time::utc;
  times[1] = Time::local;

  label = new QLabel(tr("Temperature:"), this);
  topLayout->addWidget(label, row, 0);
  UnitTemperature = new QComboBox(this);
  UnitTemperature->setObjectName("UnitTemperature");
  UnitTemperature->setEditable(false);
  topLayout->addWidget(UnitTemperature,row++,1);
  UnitTemperature->addItem(tr("Celsius"));
  UnitTemperature->addItem(tr("Fahrenheit"));
  temperature[0] = GeneralConfig::Celsius;
  temperature[1] = GeneralConfig::Fahrenheit;

  label = new QLabel(tr("Air Pressure:"), this);
  topLayout->addWidget(label, row, 0);
  UnitAirPressure = new QComboBox(this);
  UnitAirPressure->setObjectName("UnitAirPressure");
  UnitAirPressure->setEditable(false);
  topLayout->addWidget(UnitAirPressure,row++,1);
  UnitAirPressure->addItem(tr("hPa"));
  UnitAirPressure->addItem(tr("inHg"));
  airPressure[0] = GeneralConfig::hPa;
  airPressure[1] = GeneralConfig::inHg;

  topLayout->setRowStretch(row++, 10);
  topLayout->setColumnStretch(2, 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(GeneralConfig::instance()->loadPixmap("setup.png"));

  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();
}
ImageProperties::ImageProperties( QWidget *parent ) : QDialog( parent, "Image Properties", true )
{
    Q_CHECK_PTR( parent );

    //Initializations
    setCaption( tr( "Image Properties" ) );
    setFont( QFont( "helvetica", 10 ) );
    parent_widget = parent;
    resize( 235, 130 );
    setMinimumSize( 235, 130 );
    setMaximumSize( 235, 130 );
    drawing_area = ( DrawingArea * )parent_widget;

    //------------- Operations on the static texts ----------

    text_origin = new QLabel( tr( "Origin Point" ) + QString( ":" ), this );
    text_origin -> resize( 100, 20 );
    text_origin -> move( 10, 10 );

    text_origin_x = new QLabel( "X", this );
    text_origin_x -> resize( 15, 20 );
    text_origin_x -> move( text_origin -> x() + text_origin -> width() + 5, text_origin -> y() );

    text_origin_y = new QLabel( "Y", this );
    text_origin_y -> resize( 15, 20 );
    text_origin_y -> move( text_origin_x -> x() + text_origin_x -> width() + 45, text_origin_x -> y() );

    text_size = new QLabel( tr( "Size" ) + QString( ":" ), this );
    text_size -> resize( 100, 20 );
    text_size -> move( text_origin -> x(), text_origin -> y() + text_origin -> height() + 5 );

    text_size_w = new QLabel( "W", this );
    text_size_w -> resize( 15, 20 );
    text_size_w -> move( text_size -> x() + text_size -> width() + 5, text_size -> y() );

    text_size_h = new QLabel( "H", this );
    text_size_h -> resize( 15, 20 );
    text_size_h -> move( text_size_w -> x() + text_size_w -> width() + 45, text_size_w -> y() );

    text_angle = new QLabel( tr( "Rotation Angle" ) + QString( ":" ), this );
    text_angle -> resize( 100, 20 );
    text_angle -> move( text_size -> x(), text_size -> y() + text_size -> height() + 5 );

    //------------- Operations on the Textfields -------------

    value_origin_x = new QLineEdit( this );
    value_origin_x -> resize( 30, 20 );
    value_origin_x -> move( text_origin_x -> x() + text_origin_x -> width() + 5, text_origin_x -> y() );

    value_origin_y = new QLineEdit( this );
    value_origin_y -> resize( 30, 20 );
    value_origin_y -> move( text_origin_y -> x() + text_origin_y -> width() + 5, text_origin_y -> y() );

    value_size_w = new QLineEdit( this );
    value_size_w -> resize( 30, 20 );
    value_size_w -> move( text_size_w -> x() + text_size_w -> width() + 5, text_size_w -> y() );

    value_size_h = new QLineEdit( this );
    value_size_h -> resize( 30, 20 );
    value_size_h -> move( text_size_h -> x() + text_size_h -> width() + 5, text_size_h -> y() );

    value_angle = new QLineEdit( this );
    value_angle -> resize( 110, 20 );
    value_angle -> move( text_angle -> x() + text_angle -> width() + 5, text_angle -> y() );

    //------------- Operations on the buttons -----------------

    accept = new QPushButton( tr( "Accept" ), this );
    accept -> resize( 60, 30 );
    accept -> move( text_angle -> x() + 45, text_angle -> y() + text_angle -> height() + 10 );
    connect( accept, SIGNAL( clicked() ), SLOT( slotAccept() ) );

    cancel = new QPushButton( tr( "Cancel" ), this );
    cancel -> resize( 60, 30 );
    cancel -> move( accept -> x() + accept -> width() + 5, accept -> y() );
    connect( cancel, SIGNAL( clicked() ), SLOT( slotCancel() ) );
}
示例#18
0
SettingsPageGPS4A::SettingsPageGPS4A(QWidget *parent) : QWidget(parent)
{
    setObjectName("SettingsPageGPS4A");
    setWindowFlags( Qt::Tool );
    setWindowModality( Qt::WindowModal );
    setAttribute(Qt::WA_DeleteOnClose);
    setWindowTitle( tr("Settings - GPS") );

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

    QHBoxLayout *contentLayout = new QHBoxLayout;
    setLayout(contentLayout);

    QGridLayout* topLayout = new QGridLayout;
    contentLayout->addLayout(topLayout, 10);

    int row = 0;

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

    // Defines from which device the altitude data shall be taken. Possible
    // devices are the GPS or a pressure sonde.
    GpsAltitude = new QComboBox;
    GpsAltitude->setEditable(false);
    GpsAltitude->addItem(tr("GPS"));
    GpsAltitude->addItem(tr("Pressure"));

    QFormLayout* fl = new QFormLayout;
    fl->addRow( tr("Altitude Reference:"), GpsAltitude );
    topLayout->addLayout( fl, row++, 0, Qt::AlignLeft );
    topLayout->setRowMinimumHeight( row++, 10);

    saveNmeaData = new QCheckBox (tr("Save NMEA Data to file"));
    topLayout->addWidget( saveNmeaData, row++, 0, Qt::AlignLeft );

    topLayout->setRowStretch( row, 10 );

    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(GeneralConfig::instance()->loadPixmap("setup.png"));

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

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

    load();
}
SettingsPageTerrainColors::SettingsPageTerrainColors(QWidget *parent) :
  QWidget(parent),
  colorsChanged(false),
  m_autoSip( true )
{
  setObjectName("SettingsPageTerrainColors");

  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Terrain Colors") );

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

  /**
   * Altitude levels in meters to be displayed in color combo box.
   */
  const char *altitudes[51] = {
                 "< 0",
                 "0",
                 "10",
                 "25",
                 "50",
                 "75",
                 "100",
                 "150",
                 "200",
                 "250",
                 "300",
                 "350",
                 "400",
                 "450",
                 "500",
                 "600",
                 "700",
                 "800",
                 "900",
                 "1000",
                 "1250",
                 "1500",
                 "1750",
                 "2000",
                 "2250",
                 "2500",
                 "2750",
                 "3000",
                 "3250",
                 "3500",
                 "3750",
                 "4000",
                 "4250",
                 "4500",
                 "4750",
                 "5000",
                 "5250",
                 "5500",
                 "5750",
                 "6000",
                 "6250",
                 "6500",
                 "6750",
                 "7000",
                 "7250",
                 "7500",
                 "7750",
                 "8000",
                 "8250",
                 "8500",
                 "8750"
  };

  // Determine pixmap size to be used for icons in dependency of the used font
  int size = QFontMetrics(font()).boundingRect("XM").height() - 2;
  pixmapSize = QSize( size, size );
  QPixmap pixmap(pixmapSize);

  // load stored terrain colors into working list
  for( int i = 0; i < SIZEOF_TERRAIN_COLORS; i++ )
    {
      QColor color = GeneralConfig::instance()->getTerrainColor(i);
      terrainColor[i] = color;
    }

  // load ground color
  groundColor = GeneralConfig::instance()->getGroundColor();

  // put all widgets in a HBox layout
  QHBoxLayout *topLayout = new QHBoxLayout(sw);

  // create elevation color bar as image
  elevationImage = new ElevationColorImage( &terrainColor[0], this );
  topLayout->addWidget( elevationImage );

  // all editor widgets will be put into a group box to get a better view
  QGroupBox *editBox = new QGroupBox( tr("Color Selection"), this );

  // put group box in an extra VBox layout to center it vertically
  QVBoxLayout *editAll = new QVBoxLayout;
  editAll->addStretch( 10 );
  editAll->addWidget( editBox );
  editAll->addStretch( 10 );

  topLayout->addLayout( editAll );

  // put all edit widgets (combo box and buttons) in a separate VBox layout
  QVBoxLayout *editLayout = new QVBoxLayout;
  editLayout->setSpacing( editLayout->spacing() * Layout::getIntScaledDensity() );

  QLabel *label = new QLabel( tr("Terrain Level") );
  editLayout->addWidget( label );

  //--------------------------------------------------------------------------
  // The users altitude unit (meters/feed) must be considered during
  // elevation display in the combo box.
  QString unit;

  elevationBox = new QComboBox( this );

#ifdef ANDROID
  QAbstractItemView* listView = elevationBox->view();
  QScrollBar* lvsb = listView->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  elevationBox->view()->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  QScroller::grabGesture( elevationBox->view()->viewport(), QScroller::LeftMouseButtonGesture );
#endif

#ifdef QTSCROLLER
  elevationBox->view()->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  QtScroller::grabGesture( elevationBox->view()->viewport(), QtScroller::LeftMouseButtonGesture );
#endif

  if( Altitude::getUnit() == Altitude::meters )
    {
      // use unit meter
       unit = "m";

       for( int i = SIZEOF_TERRAIN_COLORS-1; i > 1; i-- )
        {
          pixmap.fill( terrainColor[i] );
          elevationBox->addItem( QIcon( pixmap ), QString(altitudes[i]) + unit );
        }
    }
  else
    {
      // use unit feed
      unit = "ft";

      for( int i = SIZEOF_TERRAIN_COLORS-1; i > 1; i-- )
        {
          int altFeed = static_cast<int>(QString(altitudes[i]).toDouble() * 3.28095);
          pixmap.fill( terrainColor[i] );
          elevationBox->addItem( QIcon( pixmap ), QString::number(altFeed) + unit );
        }
    }

  pixmap.fill( terrainColor[1] );
  elevationBox->addItem( QIcon( pixmap ), QString(altitudes[1]) );

  pixmap.fill( terrainColor[0] );
  elevationBox->addItem( QIcon( pixmap ), QString(altitudes[0]) );

  // set index to level 0
  elevationBox->setCurrentIndex( SIZEOF_TERRAIN_COLORS-2 );

  editLayout->addWidget( elevationBox );

  //--------------------------------------------------------------------------
  // add push button for elevation color chooser dialog
  editColorButton = new QPushButton( tr("Terrain Color") );

  // on click the color chooser dialog will be opened
  connect( editColorButton, SIGNAL(clicked()), this, SLOT(slot_editColor()) );

  editLayout->addWidget( editColorButton );

  //--------------------------------------------------------------------------
  // add push button for ground color chooser dialog
  groundColorButton = new QPushButton( tr("Ground Color") );

  pixmap.fill( groundColor );
  groundColorButton->setIcon( QIcon(pixmap) );

  // on click the color chooser dialog will be opened
  connect( groundColorButton, SIGNAL(clicked()), this, SLOT(slot_editGroundColor()) );

  editLayout->addSpacing( 10 * Layout::getIntScaledDensity() );
  editLayout->addWidget( groundColorButton );
  editLayout->addSpacing( 20 * Layout::getIntScaledDensity() );

  //--------------------------------------------------------------------------
  // add button for assigning of default colors
  defaultColorButton = new QPushButton( tr("Color Defaults") );

  // on click all colors are reset to the defaults
  connect( defaultColorButton, SIGNAL(clicked()), this, SLOT(slot_setColorDefaults()) );

  editLayout->addWidget( defaultColorButton );

  // add stretch items to posit editor widgets in the center of the VBox layout
  editLayout->insertStretch(0, 10 );
  editLayout->addStretch( 10 );

  editBox->setLayout(editLayout);

  //--------------------------------------------------------------------------
  // add spin box for moving elevation zero line
  QGroupBox *setOffsetBox = new QGroupBox( tr("Elevation Offset"), this );

  // put group box in an extra VBox layout to center it vertically
  QVBoxLayout *offsetLayout = new QVBoxLayout;
  offsetLayout->addStretch( 10 );
  offsetLayout->addWidget( setOffsetBox );
  offsetLayout->addStretch( 10 );

  QVBoxLayout *spinboxLayout = new QVBoxLayout;

  elevationOffset = new QSpinBox;
  elevationOffset->setSingleStep(1);
  elevationOffset->setRange(-50, 50);

  connect( elevationOffset, SIGNAL(editingFinished()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  VarSpinBox* hspin = new VarSpinBox( elevationOffset );
  spinboxLayout->addWidget(hspin);
  setOffsetBox->setLayout(spinboxLayout);

  topLayout->addLayout( offsetLayout );
  topLayout->insertSpacing(1, 60 );
  topLayout->addStretch( 10 );

  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(GeneralConfig::instance()->loadPixmap("setup.png"));

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

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

  load();
}
示例#20
0
SettingsPageInformation::SettingsPageInformation( QWidget *parent ) :
  QWidget(parent)
{
  setObjectName("SettingsPageInformation");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Information") );

  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;
  setLayout(contentLayout);

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

  // The parent of the layout is the scroll widget
  QGridLayout *topLayout = new QGridLayout(sw);

  topLayout->setHorizontalSpacing(20 * Layout::getIntScaledDensity() );
  topLayout->setVerticalSpacing(10 * Layout::getIntScaledDensity() );

  int row=0;

#ifndef ANDROID

  QHBoxLayout *hBox = new QHBoxLayout();

  QPushButton *soundSelection = new QPushButton( tr("Sound Player"), this );
  soundSelection->setToolTip(tr("Select a sound player, use %s if played file is enclosed in command line arguments"));
  hBox->addWidget(soundSelection);

  connect(soundSelection, SIGNAL( clicked()), this, SLOT(slot_openToolDialog()) );

  Qt::InputMethodHints imh;

  soundTool = new QLineEdit( this );
  imh = (soundTool->inputMethodHints() | Qt::ImhNoPredictiveText);
  soundTool->setInputMethodHints(imh);

  connect( soundTool, SIGNAL(returnPressed()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  hBox->addWidget(soundTool);
  topLayout->addLayout( hBox, row++, 0, 1, 3 );
  topLayout->setRowMinimumHeight( row++, 10 );

#endif

  topLayout->addWidget(new QLabel(tr("Airfield display time:"), this), row, 0);

  spinAirfield = createNumEd( this );
  topLayout->addWidget( spinAirfield, row, 1 );
  row++;
  topLayout->addWidget(new QLabel(tr("Airspace display time:"), this), row, 0);

  spinAirspace = createNumEd( this );
  topLayout->addWidget( spinAirspace, row, 1 );
  row++;
  topLayout->addWidget(new QLabel(tr("Info display time:"), this), row, 0);

  spinInfo = createNumEd( this );
  topLayout->addWidget( spinInfo, row, 1 );
  row++;
  topLayout->addWidget(new QLabel(tr("Waypoint display time:"), this), row, 0);

  spinWaypoint = createNumEd( this );
  topLayout->addWidget( spinWaypoint, row, 1 );
  row++;
  topLayout->addWidget(new QLabel(tr("Warning display time:"), this), row, 0);

  spinWarning = createNumEd( this );
  topLayout->addWidget( spinWarning, row, 1 );
  row++;
  topLayout->addWidget(new QLabel(tr("Warning suppress time:"), this), row, 0);

  spinSuppress = new NumberEditor;
  spinSuppress->setDecimalVisible( false );
  spinSuppress->setPmVisible( false );
  spinSuppress->setMaxLength(3);
  spinSuppress->setRange(0, 60);
  spinSuppress->setSpecialValueText(tr("Off"));
  spinSuppress->setSuffix( " min" );
  spinSuppress->setTip("0...60 min");
  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "([0-9]{1,2})" ), this );
  spinSuppress->setValidator( eValidator );

  // Sets a minimum width for the widget
  int mw = QFontMetrics(font()).width(QString("999 min")) + 10;
  spinSuppress->setMinimumWidth( mw );
  topLayout->addWidget( spinSuppress, row, 1 );

  buttonReset = new QPushButton (tr("Defaults"), this);
  topLayout->addWidget( buttonReset, row, 2, Qt::AlignLeft );
  row++;

  checkAlarmSound = new QCheckBox(tr("Alarm Sound"), this);
  checkAlarmSound->setObjectName("checkAlarmSound");
  checkAlarmSound->setChecked(true);
  topLayout->addWidget( checkAlarmSound, row, 0 );

  checkFlarmAlarms = new QCheckBox(tr("Flarm Alarms"), this);
  checkFlarmAlarms->setObjectName("checkFlarmAlarms");
  checkFlarmAlarms->setChecked(true);
  topLayout->addWidget( checkFlarmAlarms, row, 1, 1, 2 );
  row++;

  calculateNearestSites = new QCheckBox(tr("Nearest Site Calculator"), this);
  calculateNearestSites->setObjectName("calcNearest");
  calculateNearestSites->setChecked(true);
  topLayout->addWidget( calculateNearestSites, row, 0 );

  inverseInfoDisplay = new QCheckBox(tr("Black Display"), this);
  inverseInfoDisplay->setObjectName("inverseDisplay");
  inverseInfoDisplay->setChecked(false);

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

  topLayout->setRowStretch ( row, 10 );
  topLayout->setColumnStretch( 2, 10 );

  connect( buttonReset, SIGNAL(clicked()), SLOT(slot_setFactoryDefault()) );

  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(GeneralConfig::instance()->loadPixmap("setup.png"));

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

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

  load();
}
示例#21
0
AirfieldSelectionList::AirfieldSelectionList( QWidget *parent ) :
 QWidget(parent)
{
  setObjectName( "AirfieldSelectionList" );
  setWindowTitle(tr("Airfield Selection"));
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);

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

  QHBoxLayout* mainLayout = new QHBoxLayout( this );

  m_airfieldTreeWidget = new QTreeWidget( this );

  mainLayout->addWidget( m_airfieldTreeWidget );

  m_airfieldTreeWidget->setRootIsDecorated( false );
  m_airfieldTreeWidget->setItemsExpandable( false );
  m_airfieldTreeWidget->setSortingEnabled( true );
  m_airfieldTreeWidget->setSelectionMode( QAbstractItemView::SingleSelection );
  m_airfieldTreeWidget->setSelectionBehavior( QAbstractItemView::SelectRows );
  m_airfieldTreeWidget->setAlternatingRowColors(true);
  m_airfieldTreeWidget->setColumnCount( 1 );
  m_airfieldTreeWidget->setFocusPolicy( Qt::StrongFocus );
  m_airfieldTreeWidget->setUniformRowHeights(true);
  m_airfieldTreeWidget->setHeaderLabel( tr( "Airfields" ) );

  connect( m_airfieldTreeWidget, SIGNAL(itemSelectionChanged()),
           SLOT(slotItemSelectionChanged()) );

  // Set additional space per row
  RowDelegate* rowDelegate = new RowDelegate( m_airfieldTreeWidget, 10 );
  m_airfieldTreeWidget->setItemDelegate( rowDelegate );

  QTreeWidgetItem* headerItem = m_airfieldTreeWidget->headerItem();
  headerItem->setTextAlignment( 0, Qt::AlignCenter );

  m_airfieldTreeWidget->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
  m_airfieldTreeWidget->setHorizontalScrollMode( QAbstractItemView::ScrollPerPixel );

#ifdef ANDROID
  QScrollBar* lvsb = m_airfieldTreeWidget->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

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

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

  QVBoxLayout* groupLayout = new QVBoxLayout;

  m_groupBox = new QGroupBox( tr("Search Airfield"));
  m_groupBox->setLayout( groupLayout );
  mainLayout->addWidget( m_groupBox );

  m_searchInput = new QLineEdit;
  groupLayout->addWidget( m_searchInput );

  Qt::InputMethodHints imh = (m_searchInput->inputMethodHints() | Qt::ImhNoPredictiveText);
  m_searchInput->setInputMethodHints(imh);

#ifndef ANDROID
  m_searchInput->setToolTip( tr("Enter a search string, to navigate to a certain list entry.") );
#endif

  connect( m_searchInput, SIGNAL(returnPressed()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  connect( m_searchInput, SIGNAL(textEdited(const QString&)),
           SLOT(slotTextEdited(const QString&)) );

  QHBoxLayout* clearLayout = new QHBoxLayout;
  clearLayout->setSpacing(0);
  clearLayout->addStretch(5);
  QPushButton* clearButton = new QPushButton(tr("Clear"));

#ifndef ANDROID
  clearButton->setToolTip( tr("Click Clear to remove the search string.") );
#endif

  clearLayout->addWidget( clearButton );
  groupLayout->addLayout( clearLayout );
  groupLayout->addStretch(5);

  connect( clearButton, SIGNAL(clicked()), SLOT(slotClearSearchEntry()));

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

  connect( cancel, SIGNAL(clicked()), SLOT(slotReject()) );

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

  connect( m_ok, SIGNAL(clicked()), SLOT(slotAccept()) );

  QVBoxLayout *buttonBox = new QVBoxLayout;
  buttonBox->setSpacing(0);
  buttonBox->addStretch(2);
  buttonBox->addWidget(cancel, 1);
  buttonBox->addSpacing(30);
  buttonBox->addWidget(m_ok, 1);
  buttonBox->addStretch(2);
  mainLayout->addLayout(buttonBox);
}
示例#22
0
RHistorySelect::RHistorySelect(IoNetClient &src,struct trendinfo *tp,QWidget *p /*=NULL*/) :
        QDialog(p),
        s(src),
        TrendParam(tp),
        m_ui(new Ui::History)
{
    m_ui->setupUi(this);

    connect(m_ui->trend1_reg101,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg102,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg103,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg104,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg105,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg106,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg107,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg108,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg109,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg110,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg111,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_reg112,SIGNAL(clicked()),this,SLOT(slotAccept()));

    connect(m_ui->trend1_flow11,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_flow12,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_level11,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_presh11,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend1_ph11,SIGNAL(clicked()),this,SLOT(slotAccept()));


    connect(m_ui->trend2_reg201,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_reg202,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_reg203,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_reg204,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_reg205,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_reg206,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_reg207,SIGNAL(clicked()),this,SLOT(slotAccept()));

    connect(m_ui->trend2_bleding,SIGNAL(clicked()),this,SLOT(slotAccept()));


    connect(m_ui->trend2_flow21,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_level21,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_other21,SIGNAL(clicked()),this,SLOT(slotAccept()));
    connect(m_ui->trend2_term21,SIGNAL(clicked()),this,SLOT(slotAccept()));

}
BrushProperties::BrushProperties( QWidget *parent ) : QDialog( parent, "Brush Properties", true )
{
    Q_CHECK_PTR( parent );

    //Initializations
    setCaption( tr( "Brush Properties" ) );
    setFont( QFont( "helvetica", 10 ) );
    parent_widget = parent;
    resize( 235, 155 );
    setMinimumSize( 235, 155 );
    setMaximumSize( 235, 155 );
    drawing_area = ( DrawingArea * )parent_widget;

    //------------- Operations on the static texts ----------

    text_origin = new QLabel( tr( "Origin Point" ) + QString( ":" ), this );
    text_origin -> resize( 100, 20 );
    text_origin -> move( 10, 10 );

    text_origin_x = new QLabel( "X", this );
    text_origin_x -> resize( 15, 20 );
    text_origin_x -> move( text_origin -> x() + text_origin -> width() + 5, text_origin -> y() );

    text_origin_y = new QLabel( "Y", this );
    text_origin_y -> resize( 15, 20 );
    text_origin_y -> move( text_origin_x -> x() + text_origin_x -> width() + 45, text_origin_x -> y() );

    text_pattern = new QLabel( tr( "Border Style" ) + QString( ":" ), this );
    text_pattern -> resize( 100, 20 );
    text_pattern -> move( text_origin -> x(), text_origin -> y() + text_origin -> height() + 5 );

    text_factor = new QLabel( tr( "Stipple Factor" ) + QString( ":" ), this );
    text_factor -> resize( 100, 20 );
    text_factor -> move( text_pattern -> x(), text_pattern -> y() + text_pattern -> height() + 5 );

    text_angle = new QLabel( tr( "Rotation Angle" ) + QString( ":" ), this );
    text_angle -> resize( 100, 20 );
    text_angle -> move( text_factor -> x(), text_factor -> y() + text_factor -> height() + 5 );

    //------------- Operations on the Textfields -------------

    value_origin_x = new QLineEdit( this );
    value_origin_x -> resize( 30, 20 );
    value_origin_x -> move( text_origin_x -> x() + text_origin_x -> width() + 5, text_origin_x -> y() );

    value_origin_y = new QLineEdit( this );
    value_origin_y -> resize( 30, 20 );
    value_origin_y -> move( text_origin_y -> x() + text_origin_y -> width() + 5, text_origin_y -> y() );

    value_factor = new QLineEdit( this );
    value_factor -> resize( 110, 20 );
    value_factor -> move( text_factor -> x() + text_factor -> width() + 5, text_factor -> y() );

    value_angle = new QLineEdit( this );
    value_angle -> resize( 110, 20 );
    value_angle -> move( text_angle -> x() + text_angle -> width() + 5, text_angle -> y() );

    //------------- Operations on other components -------------

    QStringList p_str;
    p_str << "___________" << "_ _ _ _ _ _ _" << "_  _  _  _  _" << ". . . . . . . . ." << ". _ . _ . _ . _"
     	  << "___ ___ ___" << "___ _ ___ _" << "___  _  ___";
    value_pattern = new QComboBox( this );
    value_pattern -> insertStringList( p_str );
    value_pattern -> resize( 110, 20 );
    value_pattern -> move( text_pattern -> x() + text_pattern -> width() + 5, text_pattern -> y() );

    //------------- Operations on the buttons -----------------

    accept = new QPushButton( tr( "Accept" ), this );
    accept -> resize( 60, 30 );
    accept -> move( text_angle -> x() + 45, text_angle -> y() + text_angle -> height() + 10 );
    connect( accept, SIGNAL( clicked() ), SLOT( slotAccept() ) );

    cancel = new QPushButton( tr( "Cancel" ), this );
    cancel -> resize( 60, 30 );
    cancel -> move( accept -> x() + accept -> width() + 5, accept -> y() );
    connect( cancel, SIGNAL( clicked() ), SLOT( slotCancel() ) );
}
示例#24
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();
}
示例#25
0
/**
 * Called, if an item is pressed in the tree view.
 */
void PreFlightWidget::slotPageClicked( QTreeWidgetItem* item, int column )
{
  Q_UNUSED( column );

  QString itemText = item->data( 0, Qt::UserRole ).toString();

  if( itemText == COMMON )
    {
      PreFlightMiscPage* pfmp = new PreFlightMiscPage( this );

      connect( pfmp, SIGNAL( settingsChanged() ),
               IgcLogger::instance(), SLOT( slotReadConfig() ) );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfmp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfmp->show();
    }
  else if( itemText == CHECKLIST )
    {
      PreFlightCheckListPage* pfclp = new PreFlightCheckListPage( this );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfclp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfclp->show();
    }
  else if( itemText == GLIDER )
    {
      PreFlightGliderPage* pfgp = new PreFlightGliderPage( this );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfgp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfgp->show();
    }
  else if( itemText == TASKS )
    {
      PreFlightTaskPage* pftp = new PreFlightTaskPage( this );

      connect( pftp, SIGNAL( newTaskSelected() ),
               IgcLogger::instance(), SLOT( slotNewTaskSelected() ) );

      connect( pftp, SIGNAL( newTaskSelected() ),
               MainWindow::mainWindow(), SLOT( slotPreFlightDataChanged() ) );

      connect( pftp, SIGNAL( newWaypoint( Waypoint*, bool ) ),
               calculator, SLOT( slot_WaypointChange( Waypoint*, bool ) ) );

      connect( pftp, SIGNAL(manualWindStateChange(bool)),
               calculator, SLOT(slot_ManualWindChanged(bool)) );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pftp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pftp->show();
    }
  else if( itemText == WAYPOINTS )
    {
      PreFlightWaypointPage* pfwp = new PreFlightWaypointPage( this );

      connect( pfwp, SIGNAL(waypointsAdded()),
               Map::getInstance(), SLOT(slotRedraw()) );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfwp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfwp->show();
    }
  else if( itemText == LOGBOOKS )
    {
      PreFlightLogBooksPage* pflp = new PreFlightLogBooksPage( this );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pflp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pflp->show();
    }
  else if( itemText == WIND )
    {
      PreFlightWindPage* pfwp = new PreFlightWindPage( this );

      connect( pfwp, SIGNAL(manualWindStateChange(bool)),
               calculator, SLOT(slot_ManualWindChanged(bool)) );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfwp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfwp->show();
    }

#ifdef FLARM

  else if( itemText == FLARMIGC )
    {
      PreFlightFlarmPage* pffp = new PreFlightFlarmPage( this );

      connect( pffp, SIGNAL( newTaskSelected() ),
               IgcLogger::instance(), SLOT( slotNewTaskSelected() ) );

      connect( pffp, SIGNAL( newTaskSelected() ),
               MainWindow::mainWindow(), SLOT( slotPreFlightDataChanged() ) );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pffp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pffp->show();
    }

#endif

#ifdef INTERNET

  else if( itemText == LIVETRACK )
    {
      PreFlightLiveTrack24Page* pflt24p = new PreFlightLiveTrack24Page( this );

      connect( pflt24p, SIGNAL( onOffStateChanged(bool) ),
               MainWindow::mainWindow()->getLiveTrack24Logger(),
               SLOT( slotNewSwitchState(bool) ) );

      connect( pflt24p, SIGNAL( liveTrackingServerChanged() ),
               MainWindow::mainWindow()->getLiveTrack24Logger(),
               SLOT( slotConfigChanged() ) );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pflt24p, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pflt24p->show();
    }
  else if( itemText == WEATHER )
    {
      PreFlightWeatherPage* pfwp = new PreFlightWeatherPage( this );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfwp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfwp->show();
    }

#endif

#ifdef ANDROID

  else if( itemText == RETRIEVE )
    {
      PreFlightRetrievePage* pfrp = new PreFlightRetrievePage( this );

      if( m_menuCb->checkState() == Qt::Checked )
        {
          connect( pfrp, SIGNAL( closingWidget() ), this, SLOT( slotAccept() ) );
        }

      pfrp->show();
    }

#endif

}
示例#26
0
SettingsPageTask::SettingsPageTask( QWidget *parent) :
  QWidget( parent ),
  m_selectedSwitchScheme(0),
  m_distUnit(Distance::getUnit()),
  m_startLineValue(0),
  m_startRingValue(0),
  m_startSectorInnerRadiusValue(0),
  m_startSectorOuterRadiusValue(0),
  m_startSectorAngleValue(0),
  m_finishLineValue(0),
  m_finishRingValue(0),
  m_finishSectorInnerRadiusValue(0),
  m_finishSectorOuterRadiusValue(0),
  m_finishSectorAngleValue(0),
  m_obsCircleRadiusValue(0),
  m_obsSectorInnerRadiusValue(0),
  m_obsSectorOuterRadiusValue(0),
  m_obsSectorAngleValue(0)
{
  setObjectName("SettingsPageTask");
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);
  setWindowTitle( tr("Settings - Task") );

  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 ANDROID
  QScrollBar* lvsb = sa->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#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 );

  GeneralConfig *conf = GeneralConfig::instance();
  int row = 0;

  QGridLayout *topLayout = new QGridLayout(sw);
  //contentLayout->addLayout(topLayout);

  topLayout->setMargin(10);
  topLayout->setSpacing(20);
  topLayout->setColumnStretch( 3, 5 );

  //---------------------------------------------------------------
  QGroupBox *ssBox = new QGroupBox( tr("Switch Scheme"), this );
  topLayout->addWidget( ssBox, row, 0 );

  ntScheme = new QButtonGroup(this);
  QRadioButton* nearest  = new QRadioButton( tr("Minimum"), this );
  QRadioButton* touched  = new QRadioButton( tr("Touched"), this );

  ntScheme->addButton( nearest, 0 );
  ntScheme->addButton( touched, 1 );

  m_reportSwitch = new QCheckBox( tr("Report"), this );

  QVBoxLayout* vbox = new QVBoxLayout;
  vbox->addWidget( nearest );
  vbox->addWidget( touched );
  vbox->addWidget( m_reportSwitch );
  vbox->addStretch(1);
  ssBox->setLayout(vbox);

  nearest->setEnabled(true);
  touched->setEnabled(true);
  touched->setChecked(true);

  // set active button as selected
  m_selectedSwitchScheme = (int) conf->getActiveTaskSwitchScheme();

  if( ntScheme->button(m_selectedSwitchScheme) )
    {
      ntScheme->button(m_selectedSwitchScheme)->setChecked(true);
    }

  connect( ntScheme, SIGNAL(buttonClicked(int)),
           this, SLOT(slot_buttonPressedNT(int)) );

  //--------------------------------------------------------------
  // as next shape group is added
  QGroupBox* shapeGroup = new QGroupBox( tr("Shape"), this );
  topLayout->addWidget( shapeGroup, row, 1 );

  QGridLayout *gBox = new QGridLayout;
  shapeGroup->setLayout(gBox);

  m_drawShape = new QCheckBox( tr("Draw"), this );
  gBox->addWidget(m_drawShape, 0, 0 );
  m_fillShape = new QCheckBox( tr("Fill"), this );
  gBox->addWidget(m_fillShape, 1, 0 );
  gBox->setColumnStretch( 2, 5 );

  connect( m_fillShape, SIGNAL(stateChanged(int)),
           SLOT(slot_fillShapeStateChanged(int)) );

  m_transShape = new NumberEditor( this );
  m_transShape->setDecimalVisible( false );
  m_transShape->setPmVisible( false );
  m_transShape->setMaxLength(3);
  m_transShape->setSuffix( " %" );
  m_transShape->setRange( 0, 100 );
  m_transShape->setTip(tr("Opacity ") + "0...100");
  m_transShape->setValue( 0 );
  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "(0|[1-9][0-9]{0,2})" ), this );
  m_transShape->setValidator( eValidator );

  // Sets a minimum width for the widget
  int mw1 = QFontMetrics(font()).width("100 %") + 10;
  m_transShape->setMinimumWidth( mw1 );
  gBox->addWidget(m_transShape, 1, 1 );

  m_drawShape->setChecked( conf->getTaskDrawShape() );
  m_fillShape->setChecked( conf->getTaskFillShape() );

  //--------------------------------------------------------------
  // as next auto zoom group is added
  QGroupBox* zoomGroup = new QGroupBox( tr("Zoom"), this );
  topLayout->addWidget( zoomGroup, row, 2 );

  QVBoxLayout *zBox = new QVBoxLayout;
  zoomGroup->setLayout(zBox);

  m_autoZoom = new QCheckBox( tr("Auto"), this );
  zBox->addWidget(m_autoZoom);
  zBox->addStretch(10);

  m_autoZoom->setChecked( conf->getTaskPointAutoZoom() );

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next start group is added
  QGroupBox* startGroup1 = new QGroupBox( tr("Start"), this );
  topLayout->addWidget( startGroup1, row, 0 );
  QFormLayout *formLayout = new QFormLayout;
  startGroup1->setLayout(formLayout);

  m_startLine = createDNE( this );
  m_startLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_startLine);

  m_startRing = createDNE( this );
  m_startRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_startRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* startGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( startGroup2, row, 1 );
  formLayout = new QFormLayout;
  startGroup2->setLayout(formLayout);

  m_startSectorInnerRadius = createDNE( this );
  m_startSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_startSectorInnerRadius);

  m_startSectorOuterRadius = createDNE( this );
  m_startSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_startSectorOuterRadius);

  m_startSectorAngle = createNE( this );
  m_startSectorAngle->setTip(tr("Angle 1...360"));

  formLayout->addRow(tr("Angle:"), m_startSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* startGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( startGroup3, row, 2 );
  formLayout = new QFormLayout;
  startGroup3->setLayout(formLayout);

  QRadioButton* circle  = new QRadioButton( tr("Circle"), this );
  QRadioButton* sector  = new QRadioButton( tr("Sector"), this );
  QRadioButton* keyhole = new QRadioButton( tr("Keyhole"), this );
  QRadioButton* line    = new QRadioButton( tr("Line"), this );

  startScheme = new QButtonGroup(this);
  startScheme->addButton( circle, GeneralConfig::Circle );
  startScheme->addButton( sector, GeneralConfig::Sector );
  startScheme->addButton( keyhole, GeneralConfig::Keyhole );
  startScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedStartScheme = (int) conf->getActiveTaskStartScheme();

  if( startScheme->button(m_selectedStartScheme) )
    {
      startScheme->button(m_selectedStartScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next finish group is added
  QGroupBox* finishGroup1 = new QGroupBox( tr("Finish"), this );
  topLayout->addWidget( finishGroup1, row, 0 );
  formLayout = new QFormLayout;
  finishGroup1->setLayout(formLayout);

  m_finishLine = createDNE( this );
  m_finishLine->setTip(tr("Line Length"));
  formLayout->addRow(tr("Line:"), m_finishLine);

  m_finishRing = createDNE( this );
  m_finishRing->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle"), m_finishRing);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* finishGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( finishGroup2, row, 1 );
  formLayout = new QFormLayout;
  finishGroup2->setLayout(formLayout);

  m_finishSectorInnerRadius = createDNE( this );
  m_finishSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_finishSectorInnerRadius);

  m_finishSectorOuterRadius = createDNE( this );
  m_finishSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_finishSectorOuterRadius);

  m_finishSectorAngle = createNE( this );
  m_finishSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_finishSectorAngle);

  //--------------------------------------------------------------
  // as next inner scheme group is added
  QGroupBox* finishGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( finishGroup3, row, 2 );
  formLayout = new QFormLayout;
  finishGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  line    = new QRadioButton( tr("Line"), this );

  finishScheme = new QButtonGroup(this);
  finishScheme->addButton( circle, GeneralConfig::Circle );
  finishScheme->addButton( sector, GeneralConfig::Sector );
  finishScheme->addButton( keyhole, GeneralConfig::Keyhole );
  finishScheme->addButton( line, GeneralConfig::Line );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );
  formLayout->addWidget( line );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);
  line->setEnabled(true);
  line->setChecked(false);

  // set active button as selected
  m_selectedFinishScheme = (int) conf->getActiveTaskFinishScheme();

  if( finishScheme->button(m_selectedFinishScheme) )
    {
      finishScheme->button(m_selectedFinishScheme)->setChecked(true);
    }

#ifdef ANDROID
  topLayout->setRowMinimumHeight( ++row, 30 );
#endif

  row++;

  //--------------------------------------------------------------
  // as next observation zone is added
  QGroupBox* obZoneGroup1 = new QGroupBox( tr("Observation"), this );
  topLayout->addWidget( obZoneGroup1, row, 0 );
  formLayout = new QFormLayout;
  obZoneGroup1->setLayout(formLayout);

  m_obsCircleRadius = createDNE( this );
  m_obsCircleRadius->setTip(tr("Circle Radius"));
  formLayout->addRow(tr("Circle:"), m_obsCircleRadius);

  //--------------------------------------------------------------
  // as next inner sector group is added
  QGroupBox* obZoneGroup2 = new QGroupBox( tr("Sectors"), this );
  topLayout->addWidget( obZoneGroup2, row, 1 );
  formLayout = new QFormLayout;
  obZoneGroup2->setLayout(formLayout);

  m_obsSectorInnerRadius = createDNE( this );
  m_obsSectorInnerRadius->setTip(tr("Inner Radius"));
  formLayout->addRow(tr("Radius 1:"), m_obsSectorInnerRadius);

  m_obsSectorOuterRadius = createDNE( this );
  m_obsSectorOuterRadius->setTip(tr("Outer Radius"));
  formLayout->addRow(tr("Radius 2:"), m_obsSectorOuterRadius);

  m_obsSectorAngle = createNE( this );
  m_obsSectorAngle->setTip(tr("Angle 1...360"));
  formLayout->addRow(tr("Angle:"), m_obsSectorAngle);

  //--------------------------------------------------------------
  // as next inner observer scheme group is added
  QGroupBox* obZoneGroup3 = new QGroupBox( tr("Scheme"), this );
  topLayout->addWidget( obZoneGroup3, row, 2 );
  formLayout = new QFormLayout;
  obZoneGroup3->setLayout(formLayout);

  circle  = new QRadioButton( tr("Circle"), this );
  sector  = new QRadioButton( tr("Sector"), this );
  keyhole = new QRadioButton( tr("Keyhole"), this );
  // no line for observer area

  obsScheme = new QButtonGroup(this);
  obsScheme->addButton( circle, GeneralConfig::Circle );
  obsScheme->addButton( sector, GeneralConfig::Sector );
  obsScheme->addButton( keyhole, GeneralConfig::Keyhole );

  formLayout->addWidget( circle );
  formLayout->addWidget( sector );
  formLayout->addWidget( keyhole );

  circle->setEnabled(true);
  circle->setChecked(false);
  sector->setEnabled(true);
  sector->setChecked(false);
  keyhole->setEnabled(true);
  keyhole->setChecked(false);

  // set active button as selected
  m_selectedObsScheme = (int) conf->getActiveTaskObsScheme();

  if( obsScheme->button(m_selectedObsScheme) )
    {
      obsScheme->button(m_selectedObsScheme)->setChecked(true);
    }

  //--------------------------------------------------------------
  // Connect sector check controls.
  connect( m_startSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorStartChanged(const QString&)) );
  connect( m_finishSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorFinishChanged(const QString&)) );
  connect( m_obsSectorOuterRadius, SIGNAL(numberEdited(const QString&)),
           this, SLOT(slot_outerSectorObsChanged(const QString&)) );
  connect( startScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedSS(int)) );
  connect( finishScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedFS(int)) );
  connect( obsScheme, SIGNAL(buttonClicked(int)), this, SLOT(slot_buttonPressedOS(int)) );

  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(GeneralConfig::instance()->loadPixmap("setup.png"));

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

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

  load();
}
示例#27
0
        dsb[i++]->setValue(src.getValueFloat(str));
    }
    i=0;
    foreach(QString str,sb_tag)
    {
        sb[i++]->setValue(src.getValue16(str));
    }
    m_ui->Imp->setCurrentIndex(src.getValue16("Imp")-1);
    m_ui->Rej_sir->setChecked(src.getValue16("Rej_sir"));
    m_ui->Rej_fug->setCurrentIndex(src.getValue16("Rej_fug")?1:0);
    m_ui->rej_sync->setChecked(src.getValue16("rej_sync"));
    m_ui->T_motor->setValue(src.getValue32("T_motor")/1000);

    m_ui->rej_tvod->setCurrentIndex(src.getValue16("Rej_tvod")?1:0);

    connect(m_ui->buttonBox,SIGNAL(accepted()),this,SLOT(slotAccept()));

}

CfParam::~CfParam()
{
    delete m_ui;
}

void CfParam::changeEvent(QEvent *e)
{
    QWidget::changeEvent(e);
    switch (e->type()) {
    case QEvent::LanguageChange:
        m_ui->retranslateUi(this);
        break;