kdepreferencesdialog.cpp

来自「celestia源代码」· C++ 代码 · 共 746 行 · 第 1/3 页

CPP
746
字号
    QSlider* ambientLightSlider = new QSlider(0, 25, 1, savedAmbientLightLevel, Qt::Horizontal, ambientLightGroup);    connect(ambientLightSlider, SIGNAL(valueChanged(int)), SLOT(slotAmbientLightLevel(int)));    ambientLabel = new QLabel(ambientLightGroup);    ambientLabel->setMinimumWidth(40);    ambientLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);    char buff[20];    sprintf(buff, "%.2f", savedAmbientLightLevel / 100.);    ambientLabel->setText(buff);    savedFaintestVisible = int(appCore->getSimulation()->getFaintestVisible() * 100);    QGroupBox* faintestVisibleGroup = new QGroupBox(1, Qt::Vertical, i18n("Limiting Magnitude"), vbox1);    QSlider* faintestVisibleSlider = new QSlider(1, 1200, 1, savedFaintestVisible, Qt::Horizontal, faintestVisibleGroup);    connect(faintestVisibleSlider, SIGNAL(valueChanged(int)), SLOT(slotFaintestVisible(int)));    faintestLabel = new QLabel(faintestVisibleGroup);    faintestLabel->setMinimumWidth(40);    faintestLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);    sprintf(buff, "%.2f", savedFaintestVisible / 100.);    faintestLabel->setText(buff);    QGroupBox* infoTextGroup = new QGroupBox(1, Qt::Vertical, i18n("Info Text"), vbox1);    new QLabel(i18n("Level: "), infoTextGroup);    QComboBox* infoTextCombo = new QComboBox(infoTextGroup);    infoTextCombo->insertItem(i18n("None"));    infoTextCombo->insertItem(i18n("Terse"));    infoTextCombo->insertItem(i18n("Verbose"));    savedHudDetail = appCore->getHudDetail();    infoTextCombo->setCurrentItem(savedHudDetail);    ((KdeApp*)parent)->connect(infoTextCombo, SIGNAL(activated(int)), SLOT(slotHudDetail(int)));    QGroupBox* fovGroup = new QGroupBox(2, Qt::Horizontal, i18n("Automatic FOV"), vbox1);    new QLabel(i18n("Screen DPI: "), fovGroup);    new QLabel(QString::number(appCore->getScreenDpi(), 10), fovGroup);    new QLabel(i18n("Viewing Distance (cm): "), fovGroup);    dtsSpin = new QSpinBox(10, 300, 1, fovGroup);    savedDistanceToScreen = appCore->getDistanceToScreen();    dtsSpin->setValue(savedDistanceToScreen / 10);    connect(dtsSpin, SIGNAL(valueChanged(int)), SLOT(slotDistanceToScreen(int)));    // Locations page    Observer* obs = appCore->getSimulation()->getActiveObserver();    savedLocationFilter = obs->getLocationFilter();    QFrame* locationsFrame = addPage(i18n("Locations"), i18n("Locations"),       KGlobal::iconLoader()->loadIcon("package_network", KIcon::NoGroup));    QVBoxLayout* locationsLayout = new QVBoxLayout( locationsFrame );    locationsLayout->setAutoAdd(TRUE);    locationsLayout->setAlignment(Qt::AlignTop);    QCheckBox* showCityLocationsCheck = new QCheckBox(i18n("Cities"), locationsFrame);    actionColl->action("showCityLocations")->connect(showCityLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showCityLocationsCheck->setChecked(savedLocationFilter & Location::City);    QCheckBox* showObservatoryLocationsCheck = new QCheckBox(i18n("Observatories"), locationsFrame);    actionColl->action("showObservatoryLocations")->connect(showObservatoryLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showObservatoryLocationsCheck->setChecked(savedLocationFilter & Location::Observatory);    QCheckBox* showLandingSiteLocationsCheck = new QCheckBox(i18n("Landing Sites"), locationsFrame);    actionColl->action("showLandingSiteLocations")->connect(showLandingSiteLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showLandingSiteLocationsCheck->setChecked(savedLocationFilter & Location::LandingSite);    QCheckBox* showCraterLocationsCheck = new QCheckBox(i18n("Craters"), locationsFrame);    actionColl->action("showCraterLocations")->connect(showCraterLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showCraterLocationsCheck->setChecked(savedLocationFilter & Location::Crater);    QCheckBox* showMonsLocationsCheck = new QCheckBox(i18n("Mons"), locationsFrame);    actionColl->action("showMonsLocations")->connect(showMonsLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showMonsLocationsCheck->setChecked(savedLocationFilter & Location::Mons);    QCheckBox* showTerraLocationsCheck = new QCheckBox(i18n("Terra"), locationsFrame);    actionColl->action("showTerraLocations")->connect(showTerraLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showTerraLocationsCheck->setChecked(savedLocationFilter & Location::Terra);    QCheckBox* showVallisLocationsCheck = new QCheckBox(i18n("Vallis"), locationsFrame);    actionColl->action("showVallisLocations")->connect(showVallisLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showVallisLocationsCheck->setChecked(savedLocationFilter & Location::Vallis);    QCheckBox* showMareLocationsCheck = new QCheckBox(i18n("Mare"), locationsFrame);    actionColl->action("showMareLocations")->connect(showMareLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showMareLocationsCheck->setChecked(savedLocationFilter & Location::Mare);    QCheckBox* showOtherLocationsCheck = new QCheckBox(i18n("Other"), locationsFrame);    actionColl->action("showOtherLocations")->connect(showOtherLocationsCheck, SIGNAL(clicked()), SLOT(activate()));    showOtherLocationsCheck->setChecked(savedLocationFilter & FilterOtherLocations);    QGroupBox* minFeatureSizeGroup = new QGroupBox(1, Qt::Vertical, i18n("Minimum Feature Size"), locationsFrame);    minFeatureSizeGroup->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum));    savedMinFeatureSize = (int)appCore->getRenderer()->getMinimumFeatureSize();    QSlider* minFeatureSizeSlider = new QSlider(1, 1000, 1, savedMinFeatureSize, Qt::Horizontal, minFeatureSizeGroup);    connect(minFeatureSizeSlider, SIGNAL(valueChanged(int)), SLOT(slotMinFeatureSize(int)));    minFeatureSizeLabel = new QLabel(minFeatureSizeGroup);    minFeatureSizeLabel->setMinimumWidth(40);    minFeatureSizeLabel->setAlignment(Qt::AlignRight | Qt::AlignVCenter);    sprintf(buff, "%d", savedMinFeatureSize);    minFeatureSizeLabel->setText(buff);    // Time page    timeHasChanged = false;    QVBox* timeFrame = addVBoxPage(i18n("Date/Time"), i18n("Date/Time"),        KGlobal::iconLoader()->loadIcon("clock", KIcon::NoGroup));    savedDisplayLocalTime = appCore->getTimeZoneBias();    QGroupBox* displayTimezoneGroup = new QGroupBox(1, Qt::Vertical, i18n("Display"), timeFrame);    new QLabel(i18n("Timezone: "), displayTimezoneGroup);    displayTimezoneCombo = new QComboBox(displayTimezoneGroup);    displayTimezoneCombo->insertItem(i18n("UTC"));    displayTimezoneCombo->insertItem(i18n("Local Time"));    displayTimezoneCombo->setCurrentItem((appCore->getTimeZoneBias()==0)?0:1);    ((KdeApp*)parent)->connect(displayTimezoneCombo, SIGNAL(activated(int)), SLOT(slotDisplayLocalTime()));    displayTimezoneGroup->addSpace(0);    QGroupBox* setTimezoneGroup = new QGroupBox(1, Qt::Horizontal, i18n("Set"), timeFrame);    new QLabel(i18n("Local Time is only supported for dates between 1902 and 2037.\n"), setTimezoneGroup);       QHBox *hbox2 = new QHBox(setTimezoneGroup);    new QLabel(i18n("Timezone: "), hbox2);    setTimezoneCombo = new QComboBox(hbox2);    setTimezoneCombo->insertItem(i18n("UTC"));    setTimezoneCombo->insertItem(i18n("Local Time"));//    setTimezoneCombo->setCurrentItem((appCore->getTimeZoneBias()==0)?0:1);    KGlobal::config()->setGroup("ConfigureDialog");    if (KGlobal::config()->hasKey("SetTimeTimeZoneLocal"))        setTimezoneCombo->setCurrentItem(KGlobal::config()->readNumEntry("SetTimeTimeZoneLocal"));    KGlobal::config()->setGroup(0);    connect(setTimezoneCombo, SIGNAL(activated(int)), SLOT(slotTimeHasChanged()));            QHBox *hboxdate = new QHBox(setTimezoneGroup);    QLabel* spacerdate1 = new QLabel(" ", hboxdate);    timeFrame->setStretchFactor(spacerdate1, 2);    YSpin = new QSpinBox(-1000000000, 1000000000, 1, hboxdate);    YSpin->setWrapping(true);    MSpin = new QSpinBox(1, 12, 1, hboxdate);    MSpin->setWrapping(true);    DSpin = new QSpinBox(1, 31, 1, hboxdate);    DSpin->setWrapping(true);    QLabel* spacerdate2 = new QLabel(" ", hboxdate);    timeFrame->setStretchFactor(spacerdate2, 2);      QVBox *vbox3 = new QVBox(setTimezoneGroup);    QHBox *hbox3 = new QHBox(vbox3);    QLabel* spacer1 = new QLabel(" ", hbox3);    hbox3->setStretchFactor(spacer1, 10);    hSpin = new QSpinBox(0, 23, 1, hbox3);    hSpin->setWrapping(true);    new QLabel(":", hbox3);    mSpin = new QSpinBox(0, 59, 1, hbox3);    mSpin->setWrapping(true);    new QLabel(":", hbox3);    sSpin = new QSpinBox(0, 59, 1, hbox3);    sSpin->setWrapping(true);    QLabel* spacer2 = new QLabel(" ", hbox3);    hbox3->setStretchFactor(spacer2, 10);    QLabel* spacer3 = new QLabel(" ", timeFrame);    timeFrame->setStretchFactor(spacer3, 2);    setTime(appCore->getSimulation()->getTime());    connect(YSpin, SIGNAL(valueChanged(int)), SLOT(slotTimeHasChanged()));    connect(MSpin, SIGNAL(valueChanged(int)), SLOT(slotTimeHasChanged()));    connect(DSpin, SIGNAL(valueChanged(int)), SLOT(slotTimeHasChanged()));    connect(hSpin, SIGNAL(valueChanged(int)), SLOT(slotTimeHasChanged()));    connect(mSpin, SIGNAL(valueChanged(int)), SLOT(slotTimeHasChanged()));    connect(sSpin, SIGNAL(valueChanged(int)), SLOT(slotTimeHasChanged()));    KPushButton *nowButton = new KPushButton(setTimezoneGroup);    nowButton->setText(i18n("Now"));    QSizePolicy nowButtonSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);    nowButton->setSizePolicy(nowButtonSizePolicy);    connect(nowButton, SIGNAL(clicked()), SLOT(setNow()));    Selection selection = appCore->getSimulation()->getSelection();    std::string sel_name;    if (selection.body() != 0) {        QHBox* ltBox = new QHBox(setTimezoneGroup);        char time[50];        sel_name = selection.body()->getName();        Vec3d v = selection.getPosition(appCore->getSimulation()->getTime()) -                   appCore->getSimulation()->getObserver().getPosition();        double dist = astro::lightYearsToKilometers(v.length()*1e-6);        double lt = dist / astro::speedOfLight;        long lt_h = (long)(lt / 3600);        int lt_m = (int)((lt - lt_h * 3600) / 60);        double lt_s = (lt - lt_h * 3600 - lt_m * 60);        if (lt_h == 0) snprintf(time, 50, "%d min %02.1f s", lt_m, lt_s);        else snprintf(time, 50, "%ld h %02d min %02.1f s", lt_h, lt_m, lt_s);                new QLabel(i18n("\nSelection: " + QString(sel_name.c_str())         + QString("\nLight Travel Time: %2").arg(time)), ltBox);                KPushButton *ltButton = new KPushButton(ltBox);        ltButton->setToggleButton(true);                if (!appCore->getLightDelayActive())            ltButton->setText(i18n("Include Light Travel Time"));        else            ltButton->setText(i18n("Ignore Light Travel Time "));        ltButton->setSizePolicy(nowButtonSizePolicy);        connect(ltButton, SIGNAL(clicked()), SLOT(ltSubstract()));    }    // OpenGL Page    QVBox* openGL = addVBoxPage(i18n("OpenGL"), i18n("OpenGL"),        KGlobal::iconLoader()->loadIcon("misc", KIcon::NoGroup));    renderPathCombo = new QComboBox(openGL);    savedRenderPath = (int)appCore->getRenderer()->getGLContext()->getRenderPath();    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_Basic))        renderPathCombo->insertItem(i18n("Basic"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_Multitexture))        renderPathCombo->insertItem(i18n("Multitexture"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NvCombiner))        renderPathCombo->insertItem(i18n("NvCombiners"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_DOT3_ARBVP))        renderPathCombo->insertItem(i18n("DOT3 ARBVP"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NvCombiner_NvVP))        renderPathCombo->insertItem(i18n("NvCombiner NvVP"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NvCombiner_ARBVP))        renderPathCombo->insertItem(i18n("NvCombiner ARBVP"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_ARBFP_ARBVP))        renderPathCombo->insertItem(i18n("ARBFP ARBVP"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_NV30))        renderPathCombo->insertItem(i18n("NV30"));    if (appCore->getRenderer()->getGLContext()->renderPathSupported(GLContext::GLPath_GLSL))        renderPathCombo->insertItem(i18n("OpenGL 2.0"));    connect(renderPathCombo, SIGNAL(activated(int)), SLOT(slotRenderPath(int)));    {        int path=0, ipathIdx=0;        while (path != appCore->getRenderer()->getGLContext()->getRenderPath()) {            ipathIdx++;            do {                path++;            } while (!appCore->getRenderer()->getGLContext()->renderPathSupported((GLContext::GLRenderPath)path));        }        renderPathCombo->setCurrentItem(ipathIdx);    }    renderPathLabel = new QLabel(openGL);    renderPathLabel->setTextFormat(Qt::RichText);    setRenderPathLabel();    QTextEdit* edit = new QTextEdit(openGL);    edit->append(((KdeApp*)parent)->getOpenGLInfo());    edit->setFocusPolicy(QWidget::NoFocus);    // Key bindings page

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?