Esempio n. 1
0
void KDatePickerPopup::buildMenu()
{
  if ( isVisible() ) return;
  clear();

  if ( mItems & DatePicker ) {
    insertItem( mDatePicker );

    if ( ( mItems & NoDate ) || ( mItems & Words ) )
      insertSeparator();
  }

  if ( mItems & Words ) {
    insertItem( i18n("&Today"), this, SLOT( slotToday() ) );
    insertItem( i18n("To&morrow"), this, SLOT( slotTomorrow() ) );
    insertItem( i18n("&Friday"), this, SLOT( slotFriday() ) );
    insertItem( i18n("&Sunday"), this, SLOT( slotSunday() ) );
    insertItem( i18n("Next &Week"), this, SLOT( slotNextWeek() ) );
    insertItem( i18n("Next M&onth"), this, SLOT( slotNextMonth() ) );

    if ( mItems & NoDate )
      insertSeparator();
  }

  if ( mItems & NoDate )
    insertItem( i18n("No Date"), this, SLOT( slotNoDate() ) );
}
Esempio n. 2
0
void KDatePickerPopup::buildMenu()
{
  if ( isVisible() ) {
    return;
  }
  clear();

  if ( mItems & DatePicker ) {
    addAction( new KDatePickerAction( mDatePicker, this ) );

    if ( ( mItems & NoDate ) || ( mItems & Words ) ) {
      addSeparator();
    }
  }

  if ( mItems & Words ) {
    addAction( i18nc( "@option today", "&Today" ), this, SLOT( slotToday() ) );
    addAction( i18nc( "@option tomorrow", "To&morrow" ), this, SLOT( slotTomorrow() ) );
    addAction( i18nc( "@option next week", "Next &Week" ), this, SLOT( slotNextWeek() ) );
    addAction( i18nc( "@option next month", "Next M&onth" ), this, SLOT( slotNextMonth() ) );

    if ( mItems & NoDate ) {
      addSeparator();
    }
  }

  if ( mItems & NoDate ) {
    addAction( i18nc( "@option do not specify a date", "No Date" ), this, SLOT( slotNoDate() ) );
  }
}
Esempio n. 3
0
PlanetViewer::PlanetViewer(QWidget *parent, const char *name)
    : KDialogBase( KDialogBase::Plain, i18n("Solar System Viewer"), Close, Close, parent, name ), PCat( ((KStars*)parent)->data() ), scale(1.0), isClockRunning(false), tmr(this)
{
    QFrame *page = plainPage();
    QVBoxLayout *vlay = new QVBoxLayout( page, 0, spacingHint() );
    pw = new PlanetViewerUI( page );
    pw->map->setLimits( -48.0, 48.0, -48.0, 48.0 );
    pw->map->setXAxisLabel( i18n( "axis label for x-coordinate of solar system viewer.  AU means astronomical unit.", "X-position (AU)" ) );
    pw->map->setYAxisLabel( i18n( "axis label for y-coordinate of solar system viewer.  AU means astronomical unit.", "Y-position (AU)" ) );

    pw->timeStep->setDaysOnly( true );
    pw->timeStep->tsbox()->setValue( 1 ); //start with 1-day timestep

    pw->RunButton->setPixmap( KGlobal::iconLoader()->loadIcon( "1rightarrow", KIcon::Toolbar ) );
    pw->dateBox->setDate( ((KStars*)parent)->data()->lt().date() );

    vlay->addWidget( pw );
    resize( 500, 500 );
    pw->map->QWidget::setFocus(); //give keyboard focus to the plot widget for key and mouse events

    pName[0] = "Mercury";
    pColor[0] = "SlateBlue1";
    pName[1] = "Venus";
    pColor[1] = "LightGreen";
    pName[2] = "Earth";
    pColor[2] = "Blue";
    pName[3] = "Mars";
    pColor[3] = "Red";
    pName[4] = "Jupiter";
    pColor[4] = "Goldenrod";
    pName[5] = "Saturn";
    pColor[5] = "LightYellow2";
    pName[6] = "Uranus";
    pColor[6] = "LightSeaGreen";
    pName[7] = "Neptune";
    pColor[7] = "SkyBlue";
    pName[8] = "Pluto";
    pColor[8] = "gray";

    setCenterPlanet("");

    PCat.initialize();
    ut = ((KStars*)parent)->data()->ut();
    KSNumbers num( ut.djd() );
    PCat.findPosition( &num, 0, 0 ); //NULL args: don't need geocent. coords.

    for ( uint i=0; i<9; ++i )
        LastUpdate[i] = int( ut.date().jd() );

    //The planets' update intervals are 0.25% of one period:
    UpdateInterval[0] = 0;
    UpdateInterval[1] = 0;
    UpdateInterval[2] = 0;
    UpdateInterval[3] = 1;
    UpdateInterval[4] = 5;
    UpdateInterval[5] = 13;
    UpdateInterval[6] = 38;
    UpdateInterval[7] = 75;
    UpdateInterval[8] = 113;

    QTimer::singleShot( 0, this, SLOT( initPlotObjects() ) );

    connect( &tmr, SIGNAL( timeout() ), SLOT( tick() ) );
    connect( pw->timeStep, SIGNAL( scaleChanged(float) ), SLOT( setTimeScale(float) ) );
    connect( pw->RunButton, SIGNAL( clicked() ), SLOT( slotRunClock() ) );
    connect( pw->dateBox, SIGNAL( valueChanged( const ExtDate & ) ), SLOT( slotChangeDate( const ExtDate & ) ) );
    connect( pw->TodayButton, SIGNAL( clicked() ), SLOT( slotToday() ) );
}