Example #1
0
  CancelAction::CancelAction( QWidget* parent )
    : rviz::Panel( parent )
  {
    layout = new QVBoxLayout;

    //Text Box and Add Button to add new topic
    QHBoxLayout* topic_layout = new QHBoxLayout;
    output_topic_editor_ = new QLineEdit;
    //topic_layout->addWidget( output_topic_editor_ );

    add_topic_box_ = new QComboBox;
    initComboBox();
    topic_layout->addWidget( add_topic_box_ );

    QPushButton* add_topic_button_ = new QPushButton("Add Action");
    topic_layout->addWidget( add_topic_button_ );

    layout->addLayout( topic_layout );
    //End of Text Box and Add Button

    m_sigmap = new QSignalMapper(this);

    connect(m_sigmap, SIGNAL(mapped(int)),this, SLOT(OnClickDeleteButton(int)));

    //Button to send cancel topic
    QPushButton* send_topic_button_ = new QPushButton("Cancel Action");
    layout->addWidget( send_topic_button_ );

    setLayout( layout );

    connect( send_topic_button_, SIGNAL( clicked() ), this, SLOT( sendTopic ()));
    connect( add_topic_button_, SIGNAL( clicked() ), this, SLOT( addTopic() ));
  }
Example #2
0
ConnectDlg::ConnectDlg(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::ConnectDlg)
{
    ui->setupUi(this);

    marketDataAddrList = DataManager::GetInstance()->getMarketDataAddrList();
    tradingAddrList = DataManager::GetInstance()->getTradingAddrList();

#ifdef TEST
    ui->brokerName->setText(tr("sim"));
    ui->brokerID->setText("2030");
    // ui->userName->setText("000000002855");
    //ui->password->setText("123456");
    //ui->userName->setText("354315");
    ui->userName->setText("352032");
    ui->password->setText("888888");
#endif

    initComboBox();

    connect(ui->okBtn, SIGNAL(clicked()), this, SLOT(accept()));
    connect(ui->cancelBtn, SIGNAL(clicked()), this, SLOT(onCancel()));
    connect(ui->tradingAddressCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(currentIndexChangedSlot(int)));
}
Example #3
0
PrimaNotaWindow::PrimaNotaWindow(QWidget *parent) :
    CustomWindow(parent),
    ui(new Ui::PrimaNotaWindow)
{
    ui->setupUi(this);
    initModel();
    initComboBox();
}
Example #4
0
AnagraficaAddDialog::AnagraficaAddDialog(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::AnagraficaAddDialog)
{
    qDebug() << "AnagraficaAddDialog()";
    ui->setupUi(this); 

    initModel();
    initComboBox();

    ui->lb_agente->hide();
    ui->pb_agenti_dlg->hide();
}
Example #5
0
AnagraficaAddDialog::AnagraficaAddDialog(QWidget *parent) :
    CustomInsertDialog(parent),
    ui(new Ui::AnagraficaAddDialog)
{
    qDebug() << "AnagraficaAddDialog()";
    ui->setupUi(this); 

    initForm();
    initComboBox();

    toggleAgente(false);
    ui->aziendaRB->setChecked(true);
    checkAzienda();
}
// Much of the initialization is performed here to reduce the memory usage
// of the dialog when it is constructed, and is only allocated when the
// dialog is displayed.
void BuildVarSettingsDialog::beforeRun()
    {
    mFilterNames.clear();
    mFilterNames.push_back(StringIdItem("Build Configuration", FT_BuildConfig));
    mFilterNames.push_back(StringIdItem("Build Mode", FT_BuildMode));
    mFilterNames.push_back(StringIdItem("Component", FT_Component));
    mFilterNames.push_back(StringIdItem("Platform", FT_Platform));
    initComboBox("FilterNameComboboxtext", mFilterNames, 0);

    // Initialize things from the build variable string.
    BuildVariable buildVar;
    buildVar.initVarFromString(mVarStr);

    initVarTypes(mVarTypes);
    int index = mVarTypes.getIndex(getVarTypeFromStr(buildVar.getVarName()));
    initComboBox("BuildVarTypeComboboxtext", mVarTypes, index);

    mFunctions.clear();
    mFunctions.push_back(StringIdItem("Append", BuildVariable::F_Append));
    mFunctions.push_back(StringIdItem("Assign", BuildVariable::F_Assign));
    mFunctions.push_back(StringIdItem("Insert", BuildVariable::F_Insert));
    index = mFunctions.getIndex(buildVar.getFunction());
    initComboBox("BuildVarFunctionComboboxtext", mFunctions, index);

    mFiltersTreeView.clear();
    GuiTreeItem parent;
    for(auto const &filter : buildVar.getVarFilterList())
        {
        mFiltersTreeView.appendText(parent, filter.getFilterAsString());
        }

    Gui::setText(
        GTK_ENTRY(Builder::getBuilder()->getWidget("BuildVarValueEntry")),
        buildVar.getVarValue());

    updateSettingText();
    }
BibItemEditWidget::BibItemEditWidget(QWidget *parent) : QWidget(parent)
{
	initComboBox();

	m_layout = new QFormLayout(this);
	m_layout->addRow("Type", m_typeComboBox);


	this->setLayout(m_layout);

	rebuild(m_typeComboBox->currentText());


	connect(m_typeComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(rebuild(QString)));
}
Example #8
0
void LoadShapeDlg::OnUserPKey(wxCommandEvent & WXUNUSED(event))
{
//
// the mode of user defined Primary Key Column changed
//

  if (mColumnRadio->GetSelection() == 0)
    {
      // automatic
      mColumnSelect->Clear();
      mColumnSelect->Enable(false);
  }
  else {
      // user specified
        initComboBox(mColumnSelect, this->dbFields);
    }
}
Example #9
0
void LoadShapeDlg::OnUserGType(wxCommandEvent & WXUNUSED(event))
{
//
// the mode of user defined Geometry Type changed
//

  if (mGeomRadio->GetSelection() == 0)
  {
      // automatic
      mGeomSelect->Clear();
      mGeomSelect->Enable(false);
  }
  else {
      // user specified
      initComboBox(mGeomSelect, this->geomTypes);
  }
}
Example #10
0
int TKBaseSelectAction::plug(QWidget* widget, int index)
{
  if ( widget->inherits("KToolBar") )
  {
    KToolBar* bar = static_cast<KToolBar*>( widget );
    int id_ = KAction::getToolButtonID();

    TKComboBox* cb = new TKComboBox(m_editable,bar);
    initComboBox(cb);
    cb->setMinimumWidth( cb->sizeHint().width() );
    QWidget* base = createLayout(bar,cb);

    bar->insertWidget( id_, 100, base, index );
    addContainer( bar, id_ );

    connect( bar, SIGNAL( destroyed() ), this, SLOT( slotDestroyed() ) );

    setCurrentItem(currentItem());

    return containerCount() - 1;
  }
  return -1;
}
void QG_DlgOptionsGeneral::init() {
#ifdef QC_PREDEFINED_LOCALE
    bgLanguage->hide();
    Widget9Layout->addMultiCellWidget( bgGraphicView, 0, 2, 0, 0 ); //use empty space as well
#endif
    // Fill combobox with languages:
    QStringList languageList = RS_SYSTEM->getLanguageList();
    languageList.sort();
    languageList.prepend("en");
    for (QStringList::Iterator it = languageList.begin();
         it!=languageList.end();
         it++) {

        RS_DEBUG->print("QG_DlgOptionsGeneral::init: adding %s to combobox",
                        (*it).toLatin1().data());

        QString l = RS_SYSTEM->symbolToLanguage(*it);
        if (l.isEmpty()==false && cbLanguage->findData(*it)==-1) {
            RS_DEBUG->print("QG_DlgOptionsGeneral::init: %s", l.toLatin1().data());
            cbLanguage->addItem(l,*it);
            cbLanguageCmd->addItem(l,*it);
        }
    }

    RS_SETTINGS->beginGroup("/Appearance");

    // set current language:
    QString def_lang = "en";
#ifdef QC_PREDEFINED_LOCALE
    def_lang = QC_PREDEFINED_LOCALE;
#endif
    QString lang = RS_SETTINGS->readEntry("/Language", def_lang);
    cbLanguage->setCurrentIndex( cbLanguage->findText(RS_SYSTEM->symbolToLanguage(lang)) );

    QString langCmd = RS_SETTINGS->readEntry("/LanguageCmd", def_lang);
    cbLanguageCmd->setCurrentIndex( cbLanguageCmd->findText(RS_SYSTEM->symbolToLanguage(langCmd)) );

    // graphic view:
    // crosshairs:
    QString showCrosshairs = RS_SETTINGS->readEntry("/ShowCrosshairs", "1");
    cbShowCrosshairs->setChecked(showCrosshairs=="1");
    
    // scale grid:
    QString scaleGrid = RS_SETTINGS->readEntry("/ScaleGrid", "1");
    cbScaleGrid->setChecked(scaleGrid=="1");
    QString minGridSpacing = RS_SETTINGS->readEntry("/MinGridSpacing", "10");
    cbMinGridSpacing->setCurrentIndex( cbMinGridSpacing->findText(minGridSpacing) );

    // preview:
	initComboBox(cbMaxPreview, RS_SETTINGS->readEntry("/MaxPreview", "100"));

    // colors:
	initComboBox(cbBackgroundColor, RS_SETTINGS->readEntry("/BackgroundColor", "Black"));
	initComboBox(cbGridColor, RS_SETTINGS->readEntry("/GridColor", "Gray"));
	initComboBox(cbMetaGridColor, RS_SETTINGS->readEntry("/MetaGridColor", "#404040"));
	initComboBox(cbSelectedColor, RS_SETTINGS->readEntry("/SelectedColor", "#a54747"));
	initComboBox(cbHighlightedColor, RS_SETTINGS->readEntry("/HighlightedColor", "#739373"));
	initComboBox(cbStartHandleColor, RS_SETTINGS->readEntry("/StartHandleColor", "#00FFFF"));
	initComboBox(cbHandleColor, RS_SETTINGS->readEntry("/HandleColor", "#0000FF"));
	initComboBox(cbEndHandleColor, RS_SETTINGS->readEntry("/EndHandleColor", "#0000FF"));

    // font size:
    QString sizeStatus = RS_SETTINGS->readEntry("/StatusBarFontSize", "9");
    cbSizeStatus->setCurrentIndex( cbSizeStatus->findText(sizeStatus) );

    RS_SETTINGS->endGroup();

    RS_SETTINGS->beginGroup("/Paths");

    lePathTranslations->setText(RS_SETTINGS->readEntry("/Translations", ""));
    lePathHatch->setText(RS_SETTINGS->readEntry("/Patterns", ""));
    lePathFonts->setText(RS_SETTINGS->readEntry("/Fonts", ""));
    lePathScripts->setText(RS_SETTINGS->readEntry("/Scripts", ""));
    lePathLibrary->setText(RS_SETTINGS->readEntry("/Library", "").trimmed());
    leTemplate->setText(RS_SETTINGS->readEntry("/Template", "").trimmed());

    RS_SETTINGS->endGroup();

    // units:
    for (int i=RS2::None; i<RS2::LastUnit; i++) {
        if (i!=(int)RS2::None)
            cbUnit->addItem(RS_Units::unitToString((RS2::Unit)i));
    }
    // RVT_PORT cbUnit->listBox()->sort();
    cbUnit->insertItem( 0, RS_Units::unitToString(RS2::None) );

    QString def_unit = "Millimeter";
#ifdef QC_PREDEFINED_UNIT
    def_unit = QC_PREDEFINED_UNIT;
#endif
    RS_SETTINGS->beginGroup("/Defaults");
//    cbUnit->setCurrentIndex( cbUnit->findText(QObject::tr( RS_SETTINGS->readEntry("/Unit", def_unit) )) );
    cbUnit->setCurrentIndex( cbUnit->findText(QObject::tr( RS_SETTINGS->readEntry("/Unit", def_unit).toUtf8().data() )) );
    // Auto save timer
    cbAutoSaveTime->setValue(RS_SETTINGS->readNumEntry("/AutoSaveTime", 5));
    cbAutoBackup->setChecked(RS_SETTINGS->readNumEntry("/AutoBackupDocument", 1)?true:false);
    RS_SETTINGS->endGroup();

    restartNeeded = false;
}
Example #12
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow),
    ui2(new Ui::Dialog),
    m_aboutDialog(nullptr),
    m_baiduTranslater(new CBaiduTranslater(this)),
    m_from("auto"),
    m_to("auto"),
    m_statusInfo(new QLabel(this)),
    m_pinWindow(new QToolButton(this)),
    //m_updateStyle(new QToolButton(this)),
    m_about(new QToolButton(this))
{
    ui->setupUi(this);

    /* Stay on top tool button */
//    m_pinWindow = new QToolButton(this);
    m_pinWindow->setObjectName(tr("pinWindow"));
    m_pinWindow->setText("置顶");
    m_pinWindow->setToolTip(tr("stay on top"));
    m_pinWindow->setToolButtonStyle(Qt::ToolButtonTextOnly);
    ui->statusBar->addWidget(m_pinWindow, 0);
    connect(m_pinWindow, &QToolButton::clicked, this, &MainWindow::togglePinWindow);

    /* Update style tool button */
//    m_updateStyle = new QToolButton(this);
    //m_updateStyle->setObjectName(tr("updateStyle"));
    //m_updateStyle->setToolTip(tr("update style"));
    //ui->statusBar->addWidget(m_updateStyle, 0);
    //connect(m_updateStyle, &QToolButton::clicked, this, &MainWindow::updateStyle);

    /* status display label */
//    m_statusInfo = new QLabel(this);
    m_statusInfo->setAlignment(Qt::AlignRight);
    ui->statusBar->addWidget(m_statusInfo, 1);

    /* About button */
//    m_about = new QToolButton(this);
    m_about->setObjectName(tr("about"));
    m_about->setToolTip(tr("关于 LBTrans"));
    m_about->setText("关于 LBTrans");
    m_about->setToolButtonStyle(Qt::ToolButtonTextOnly);
    ui->statusBar->insertWidget(2, m_about);
    connect(m_about, &QToolButton::clicked, this, &MainWindow::showAboutDialog);


    /* initialize translation direction */
    initComboBox(ui->comboBox, 0);
    initComboBox(ui->comboBoxObject, 1);

    // Set baidu translate seveice API key
    m_baiduTranslater->setAPI_Key("YaGqITH4r1i95Xp8izAhrxwT");

    /* translate */
    connect(ui->btnTranslate, SIGNAL(clicked()), this, SLOT(translate()));
    connect(m_baiduTranslater, &CBaiduTranslater::finished, this, &MainWindow::showResult);

    /* initialize waiting label */
    ui->label_statusPicture->setFileName(":/res/loading.gif");
    ui->label_statusPicture->hide();
    ui->label_translationStatus->setText(tr("正在翻译..."));
    ui->label_translationStatus->hide();

    /* Set MainWindow title */
    setWindowTitle(tr("LBTrans"));
    setWindowIcon(QIcon(":/res/windowIcon.ico"));
    /* Show in screen center */
    QSize screenSize = qApp->desktop()->availableGeometry().size();
    QSize mainWindowSize = size();
    QPoint destPos;
    destPos.setX((screenSize.width() - mainWindowSize.width()) / 2);
    destPos.setY((screenSize.height() - mainWindowSize.height()) / 2);
    this->move(destPos);

    /* contriant window size */
    setMaximumSize(size());
    setMinimumSize(size());
}
Example #13
0
void QG_DlgOptionsGeneral::init() {
#ifdef QC_PREDEFINED_LOCALE
    bgLanguage->hide();
    Widget9Layout->addMultiCellWidget( bgGraphicView, 0, 2, 0, 0 ); //use empty space as well
#endif
    // Fill combobox with languages:
    QStringList languageList = RS_SYSTEM->getLanguageList();
    languageList.sort();
    languageList.prepend("en");
	for(auto const& lang: languageList){

        RS_DEBUG->print("QG_DlgOptionsGeneral::init: adding %s to combobox",
						lang.toLatin1().data());

		QString l = RS_SYSTEM->symbolToLanguage(lang);
		if (l.isEmpty()==false && cbLanguage->findData(lang)==-1) {
            RS_DEBUG->print("QG_DlgOptionsGeneral::init: %s", l.toLatin1().data());
			cbLanguage->addItem(l,lang);
			cbLanguageCmd->addItem(l, lang);
        }
    }

    RS_SETTINGS->beginGroup("/Appearance");

    // set current language:
    QString def_lang = "en";
#ifdef QC_PREDEFINED_LOCALE
    def_lang = QC_PREDEFINED_LOCALE;
#endif
    QString lang = RS_SETTINGS->readEntry("/Language", def_lang);
    cbLanguage->setCurrentIndex( cbLanguage->findText(RS_SYSTEM->symbolToLanguage(lang)) );

    QString langCmd = RS_SETTINGS->readEntry("/LanguageCmd", def_lang);
    cbLanguageCmd->setCurrentIndex( cbLanguageCmd->findText(RS_SYSTEM->symbolToLanguage(langCmd)) );

    // graphic view:
    // crosshairs:
    QString showCrosshairs = RS_SETTINGS->readEntry("/ShowCrosshairs", "1");
    cbShowCrosshairs->setChecked(showCrosshairs=="1");
    
    // scale grid:
    QString scaleGrid = RS_SETTINGS->readEntry("/ScaleGrid", "1");
    cbScaleGrid->setChecked(scaleGrid=="1");
    QString minGridSpacing = RS_SETTINGS->readEntry("/MinGridSpacing", "10");
    cbMinGridSpacing->setCurrentIndex( cbMinGridSpacing->findText(minGridSpacing) );

    // preview:
	initComboBox(cbMaxPreview, RS_SETTINGS->readEntry("/MaxPreview", "100"));

    // colors:
    initComboBox( cbBackgroundColor,  RS_SETTINGS->readGraphicColor( RS_Settings::BackgroundColor));
    initComboBox( cbGridColor,        RS_SETTINGS->readGraphicColor( RS_Settings::GridColor));
    initComboBox( cbMetaGridColor,    RS_SETTINGS->readGraphicColor( RS_Settings::MetaGridColor));
    initComboBox( cbSelectedColor,    RS_SETTINGS->readGraphicColor( RS_Settings::SelectedColor));
    initComboBox( cbHighlightedColor, RS_SETTINGS->readGraphicColor( RS_Settings::HighlightedColor));
    initComboBox( cbStartHandleColor, RS_SETTINGS->readGraphicColor( RS_Settings::StartHandleColor));
    initComboBox( cbHandleColor,      RS_SETTINGS->readGraphicColor( RS_Settings::HandleColor));
    initComboBox( cbEndHandleColor,   RS_SETTINGS->readGraphicColor( RS_Settings::EndHandleColor));
    initComboBox(cb_layerselection, RS_SETTINGS->readEntry("/LayerSelectColor", "#CCFFCC"));

    // font size:
    QString sizeStatus = RS_SETTINGS->readEntry("/StatusBarFontSize", "9");
    cbSizeStatus->setCurrentIndex( cbSizeStatus->findText(sizeStatus) );
    cbSplash->setChecked(RS_SETTINGS->readNumEntry("/ShowSplash",1)==1);

    sb_icon_size->setValue(RS_SETTINGS->readNumEntry("/IconSize", 24));
    cb_icon_size->setChecked(RS_SETTINGS->readNumEntry("/SetIconSize", 1)?true:false);

    RS_SETTINGS->endGroup();

    RS_SETTINGS->beginGroup("/Paths");

    lePathTranslations->setText(RS_SETTINGS->readEntry("/Translations", ""));
    lePathHatch->setText(RS_SETTINGS->readEntry("/Patterns", ""));
    lePathFonts->setText(RS_SETTINGS->readEntry("/Fonts", ""));
    lePathScripts->setText(RS_SETTINGS->readEntry("/Scripts", ""));
    lePathLibrary->setText(RS_SETTINGS->readEntry("/Library", "").trimmed());
    leTemplate->setText(RS_SETTINGS->readEntry("/Template", "").trimmed());
    le_custom_toolbar->setText(RS_SETTINGS->readEntry("/CustomToolbar", "").trimmed());
    RS_SETTINGS->endGroup();

    // units:
    for (int i=RS2::None; i<RS2::LastUnit; i++) {
        if (i!=(int)RS2::None)
            cbUnit->addItem(RS_Units::unitToString((RS2::Unit)i));
    }
    // RVT_PORT cbUnit->listBox()->sort();
    cbUnit->insertItem( 0, RS_Units::unitToString(RS2::None) );

    QString def_unit = "Millimeter";
#ifdef QC_PREDEFINED_UNIT
    def_unit = QC_PREDEFINED_UNIT;
#endif
    RS_SETTINGS->beginGroup("/Defaults");
//    cbUnit->setCurrentIndex( cbUnit->findText(QObject::tr( RS_SETTINGS->readEntry("/Unit", def_unit) )) );
    cbUnit->setCurrentIndex( cbUnit->findText(QObject::tr( RS_SETTINGS->readEntry("/Unit", def_unit).toUtf8().data() )) );
    // Auto save timer
    cbAutoSaveTime->setValue(RS_SETTINGS->readNumEntry("/AutoSaveTime", 5));
    cbAutoBackup->setChecked(RS_SETTINGS->readNumEntry("/AutoBackupDocument", 1)?true:false);
    RS_SETTINGS->endGroup();

	//update entities to selected entities to the current active layer
	RS_SETTINGS->beginGroup("/Modify");
	auto toActive=RS_SETTINGS->readNumEntry("/ModifyEntitiesToActiveLayer", 0);
	cbToActiveLayer->setChecked(toActive==1);
	RS_SETTINGS->writeEntry("/ModifyEntitiesToActiveLayer", cbToActiveLayer->isChecked()?1:0);
	RS_SETTINGS->endGroup();

    restartNeeded = false;
}
Example #14
0
//
// Initialization
//
BOOL CFinancedemoDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

    // *** code automatically generated by VC++ MFC AppWizard ***
    // Set the icon for this dialog.  The framework does this automatically
    //  when the application's main window is not a dialog
    SetIcon(m_hIcon, TRUE);         // Set big icon
    SetIcon(m_hIcon, FALSE);        // Set small icon
    
    //
    // Intialialize the controls
    //
    initComboBox(m_TickerSymbol, tickerSymbols, 
        sizeof(tickerSymbols) / sizeof(*tickerSymbols), _T("Random Data 1"));
    initComboBox(m_TimeRange, timeRanges, 
        sizeof(timeRanges) / sizeof(*timeRanges), _T("6 months"));
    initComboBox(m_ChartSize, chartSizes, 
        sizeof(chartSizes) / sizeof(*chartSizes), _T("Large"));
    initComboBox(m_ChartType, chartTypes, 
        sizeof(chartTypes) / sizeof(*chartTypes), _T("CandleStick"));
    initComboBox(m_Band, bandTypes, 
        sizeof(bandTypes) / sizeof(*bandTypes), _T("Bollinger Band"));
    initComboBox(m_AvgType1, avgTypes, sizeof(avgTypes) / sizeof(*avgTypes), _T("Simple"));
    initComboBox(m_AvgType2, avgTypes, sizeof(avgTypes) / sizeof(*avgTypes), _T("Simple"));
    initComboBox(m_Indicator1, indicatorTypes, 
        sizeof(indicatorTypes) / sizeof(*indicatorTypes), _T("RSI"));
    initComboBox(m_Indicator2, indicatorTypes, 
        sizeof(indicatorTypes) / sizeof(*indicatorTypes), _T("MACD"));
    initComboBox(m_Indicator3, indicatorTypes, 
        sizeof(indicatorTypes) / sizeof(*indicatorTypes), _T("None"));
    initComboBox(m_Indicator4, indicatorTypes, 
        sizeof(indicatorTypes) / sizeof(*indicatorTypes), _T("None"));

    m_Volume.SetCheck(1);
    m_VGrid.SetCheck(1);
    m_HGrid.SetCheck(1);

    m_MovAvg1.SetWindowText(_T("5"));
    m_MovAvg2.SetWindowText(_T("20"));

    // Display the chart
    drawChart(&m_ChartViewer);
    return TRUE;
}
// Much of the initialization is performed here to reduce the memory usage
// of the dialog when it is constructed, and is only allocated when the
// dialog is displayed.
void BuildVariablesDialog::beforeRun()
    {
    initVarTypes(mVarTypes);
    initComboBox("VariableTypeComboboxtext", mVarTypes, 0);
    updateVarList();
    }
void QG_DlgOptionsGeneral::init()
{
    // Fill combobox with languages:
    QStringList languageList = RS_SYSTEM->getLanguageList();
    languageList.sort();
    languageList.prepend("en");
	for(auto const& lang: languageList){

        RS_DEBUG->print("QG_DlgOptionsGeneral::init: adding %s to combobox",
						lang.toLatin1().data());

		QString l = RS_SYSTEM->symbolToLanguage(lang);
		if (!l.isEmpty() && cbLanguage->findData(lang)==-1) {
            RS_DEBUG->print("QG_DlgOptionsGeneral::init: %s", l.toLatin1().data());
			cbLanguage->addItem(l,lang);
			cbLanguageCmd->addItem(l, lang);
        }
    }

    RS_SETTINGS->beginGroup("/Appearance");

    // set current language:
    QString def_lang = "en";

    QString lang = RS_SETTINGS->readEntry("/Language", def_lang);
    cbLanguage->setCurrentIndex( cbLanguage->findText(RS_SYSTEM->symbolToLanguage(lang)) );

    QString langCmd = RS_SETTINGS->readEntry("/LanguageCmd", def_lang);
    cbLanguageCmd->setCurrentIndex( cbLanguageCmd->findText(RS_SYSTEM->symbolToLanguage(langCmd)) );

    // graphic view:

    // Snap Indicators
    bool indicator_lines_state = RS_SETTINGS->readNumEntry("/indicator_lines_state", 1);
    indicator_lines_checkbox->setChecked(indicator_lines_state);

    QString indicator_lines_type = RS_SETTINGS->readEntry("/indicator_lines_type", "Crosshair");
    int index = indicator_lines_combobox->findText(indicator_lines_type);
    indicator_lines_combobox->setCurrentIndex(index);

    bool indicator_shape_state = RS_SETTINGS->readNumEntry("/indicator_shape_state", 1);
    indicator_shape_checkbox->setChecked(indicator_shape_state);

    QString indicator_shape_type = RS_SETTINGS->readEntry("/indicator_shape_type", "Circle");
    index = indicator_shape_combobox->findText(indicator_shape_type);
    indicator_shape_combobox->setCurrentIndex(index);

    bool cursor_hiding = RS_SETTINGS->readNumEntry("/cursor_hiding", 0);
    cursor_hiding_checkbox->setChecked(cursor_hiding);
    
    // scale grid:
    QString scaleGrid = RS_SETTINGS->readEntry("/ScaleGrid", "1");
    cbScaleGrid->setChecked(scaleGrid=="1");
    QString minGridSpacing = RS_SETTINGS->readEntry("/MinGridSpacing", "10");
    cbMinGridSpacing->setCurrentIndex( cbMinGridSpacing->findText(minGridSpacing) );

    int checked = RS_SETTINGS->readNumEntry("/Antialiasing");
    cb_antialiasing->setChecked(checked?true:false);

    checked = RS_SETTINGS->readNumEntry("/ScrollBars");
    scrollbars_check_box->setChecked(checked?true:false);

    // preview:
	initComboBox(cbMaxPreview, RS_SETTINGS->readEntry("/MaxPreview", "100"));

    RS_SETTINGS->endGroup();

    RS_SETTINGS->beginGroup("Colors");
    initComboBox(cbBackgroundColor, RS_SETTINGS->readEntry("/background", Colors::background));
    initComboBox(cbGridColor, RS_SETTINGS->readEntry("/grid", Colors::grid));
    initComboBox(cbMetaGridColor, RS_SETTINGS->readEntry("/meta_grid", Colors::meta_grid));
    initComboBox(cbSelectedColor, RS_SETTINGS->readEntry("/select", Colors::select));
    initComboBox(cbHighlightedColor, RS_SETTINGS->readEntry("/highlight", Colors::highlight));
    initComboBox(cbStartHandleColor, RS_SETTINGS->readEntry("/start_handle", Colors::start_handle));
    initComboBox(cbHandleColor, RS_SETTINGS->readEntry("/handle", Colors::handle));
    initComboBox(cbEndHandleColor, RS_SETTINGS->readEntry("/end_handle", Colors::end_handle));
    initComboBox(cb_snap_color, RS_SETTINGS->readEntry("/snap_indicator", Colors::snap_indicator));
    RS_SETTINGS->endGroup();

    RS_SETTINGS->beginGroup("/Paths");

    lePathTranslations->setText(RS_SETTINGS->readEntry("/Translations", ""));
    lePathHatch->setText(RS_SETTINGS->readEntry("/Patterns", ""));
    lePathFonts->setText(RS_SETTINGS->readEntry("/Fonts", ""));
    lePathLibrary->setText(RS_SETTINGS->readEntry("/Library", "").trimmed());
    leTemplate->setText(RS_SETTINGS->readEntry("/Template", "").trimmed());
    RS_SETTINGS->endGroup();

    // units:
    for (int i=RS2::None; i<RS2::LastUnit; i++) {
        if (i!=(int)RS2::None)
            cbUnit->addItem(RS_Units::unitToString((RS2::Unit)i));
    }
    // RVT_PORT cbUnit->listBox()->sort();
    cbUnit->insertItem( 0, RS_Units::unitToString(RS2::None) );

    QString def_unit = "Millimeter";

    RS_SETTINGS->beginGroup("/Defaults");
//    cbUnit->setCurrentIndex( cbUnit->findText(QObject::tr( RS_SETTINGS->readEntry("/Unit", def_unit) )) );
    cbUnit->setCurrentIndex( cbUnit->findText(QObject::tr( RS_SETTINGS->readEntry("/Unit", def_unit).toUtf8().data() )) );
    // Auto save timer
    cbAutoSaveTime->setValue(RS_SETTINGS->readNumEntry("/AutoSaveTime", 5));
    cbAutoBackup->setChecked(RS_SETTINGS->readNumEntry("/AutoBackupDocument", 1));
    RS_SETTINGS->endGroup();

	//update entities to selected entities to the current active layer
	RS_SETTINGS->beginGroup("/Modify");
	auto toActive=RS_SETTINGS->readNumEntry("/ModifyEntitiesToActiveLayer", 0);
	cbToActiveLayer->setChecked(toActive==1);
	RS_SETTINGS->writeEntry("/ModifyEntitiesToActiveLayer", cbToActiveLayer->isChecked()?1:0);
	RS_SETTINGS->endGroup();

    RS_SETTINGS->beginGroup("Startup");
    cbSplash->setChecked(RS_SETTINGS->readNumEntry("/ShowSplash",1)==1);
    tab_mode_check_box->setChecked(RS_SETTINGS->readNumEntry("/TabMode", 0));
    maximize_checkbox->setChecked(RS_SETTINGS->readNumEntry("/Maximize", 0));
    left_sidebar_checkbox->setChecked(RS_SETTINGS->readNumEntry("/EnableLeftSidebar", 1));
    cad_toolbars_checkbox->setChecked(RS_SETTINGS->readNumEntry("/EnableCADToolbars", 1));
    keycode_checkbox->setChecked(RS_SETTINGS->readNumEntry("/KeycodeMode", 0));
    RS_SETTINGS->endGroup();

    restartNeeded = false;
}