GeoDialog::GeoDialog( QWidget *parent ) : KDialog( parent ), mUpdateSexagesimalInput( true ) { setCaption( i18nc( "@title:window", "Geo Data Input" ) ); setButtons( Ok | Cancel ); setDefaultButton( Ok ); showButtonSeparator( true ); setModal( true ); QFrame *page = new QFrame(this); setMainWidget( page ); QGridLayout *topLayout = new QGridLayout( page ); topLayout->setSpacing( spacingHint() ); topLayout->setMargin( 0 ); topLayout->setRowStretch( 1, 1 ); mMapWidget = new GeoMapWidget( page ); topLayout->addWidget( mMapWidget, 0, 0, 2, 1); mCityCombo = new KComboBox( page ); topLayout->addWidget( mCityCombo, 0, 1 ); QGroupBox *sexagesimalGroup = new QGroupBox( i18nc( "@title:group", "Sexagesimal" ), page ); QGridLayout *sexagesimalLayout = new QGridLayout(); sexagesimalGroup->setLayout( sexagesimalLayout ); sexagesimalLayout->setSpacing( spacingHint() ); QLabel *label = new QLabel( i18nc( "@label:spinbox", "Latitude:" ), sexagesimalGroup ); sexagesimalLayout->addWidget( label, 0, 0 ); mLatDegrees = new QSpinBox( sexagesimalGroup ); mLatDegrees->setMinimum( 0 ); mLatDegrees->setMaximum( 90 ); mLatDegrees->setValue( 1 ); mLatDegrees->setSuffix( QString::fromUtf8( "°" ) ); mLatDegrees->setWrapping( false ); label->setBuddy( mLatDegrees ); sexagesimalLayout->addWidget( mLatDegrees, 0, 1 ); mLatMinutes = new QSpinBox( sexagesimalGroup ); mLatMinutes->setMinimum( 0 ); mLatMinutes->setMaximum( 59 ); mLatMinutes->setValue( 1 ); mLatMinutes->setSuffix( "'" ); sexagesimalLayout->addWidget( mLatMinutes, 0, 2 ); mLatSeconds = new QSpinBox( sexagesimalGroup ); mLatSeconds->setMinimum( 0 ); mLatSeconds->setMaximum( 59 ); mLatSeconds->setValue( 1 ); mLatSeconds->setSuffix( "\"" ); sexagesimalLayout->addWidget( mLatSeconds, 0, 3 ); mLatDirection = new KComboBox( sexagesimalGroup ); mLatDirection->addItem( i18nc( "@item:inlistbox Latitude direction", "North" ) ); mLatDirection->addItem( i18nc( "@item:inlistbox Latitude direction", "South" ) ); sexagesimalLayout->addWidget( mLatDirection, 0, 4 ); label = new QLabel( i18nc( "@label:spinbox", "Longitude:" ), sexagesimalGroup ); sexagesimalLayout->addWidget( label, 1, 0 ); mLongDegrees = new QSpinBox( sexagesimalGroup ); mLongDegrees->setMinimum( 0 ); mLongDegrees->setMaximum( 180 ); mLongDegrees->setValue( 1 ); mLongDegrees->setSuffix( QString::fromUtf8( "°" ) ); label->setBuddy( mLongDegrees ); sexagesimalLayout->addWidget( mLongDegrees, 1, 1 ); mLongMinutes = new QSpinBox( sexagesimalGroup ); mLongMinutes->setMinimum( 0 ); mLongMinutes->setMaximum( 59 ); mLongMinutes->setValue( 1 ); mLongMinutes->setSuffix( "'" ); sexagesimalLayout->addWidget( mLongMinutes, 1, 2 ); mLongSeconds = new QSpinBox( sexagesimalGroup ); mLongSeconds->setMinimum( 0 ); mLongSeconds->setMaximum( 59 ); mLongSeconds->setValue( 1 ); mLongSeconds->setSuffix( "\"" ); sexagesimalLayout->addWidget( mLongSeconds, 1, 3 ); mLongDirection = new KComboBox( sexagesimalGroup ); mLongDirection->addItem( i18nc( "@item:inlistbox Longtitude direction", "East" ) ); mLongDirection->addItem( i18nc( "@item:inlistbox Longtitude direction", "West" ) ); sexagesimalLayout->addWidget( mLongDirection, 1, 4 ); topLayout->addWidget( sexagesimalGroup, 1, 1 ); loadCityList(); connect( mMapWidget, SIGNAL( changed() ), SLOT( geoMapChanged() ) ); connect( mCityCombo, SIGNAL( activated( int ) ), SLOT( cityInputChanged() ) ); connect( mLatDegrees, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLatMinutes, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLatSeconds, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLatDirection, SIGNAL( activated( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongDegrees, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongMinutes, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongSeconds, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongDirection, SIGNAL( activated( int ) ), SLOT( sexagesimalInputChanged() ) ); KAcceleratorManager::manage( this ); }
GeoDialog::GeoDialog( QWidget *parent, const char *name ) : KDialogBase( Plain, i18n( "Geo Data Input" ), Ok | Cancel, Ok, parent, name, true, true ), mUpdateSexagesimalInput( true ) { QFrame *page = plainPage(); QGridLayout *topLayout = new QGridLayout( page, 2, 2, marginHint(), spacingHint() ); topLayout->setRowStretch( 1, 1 ); mMapWidget = new GeoMapWidget( page ); topLayout->addMultiCellWidget( mMapWidget, 0, 1, 0, 0 ); mCityCombo = new KComboBox( page ); topLayout->addWidget( mCityCombo, 0, 1 ); QGroupBox *sexagesimalGroup = new QGroupBox( 0, Vertical, i18n( "Sexagesimal" ), page ); QGridLayout *sexagesimalLayout = new QGridLayout( sexagesimalGroup->layout(), 2, 5, spacingHint() ); QLabel *label = new QLabel( i18n( "Latitude:" ), sexagesimalGroup ); sexagesimalLayout->addWidget( label, 0, 0 ); mLatDegrees = new QSpinBox( 0, 90, 1, sexagesimalGroup ); mLatDegrees->setSuffix( "°" ); mLatDegrees->setWrapping( false ); label->setBuddy( mLatDegrees ); sexagesimalLayout->addWidget( mLatDegrees, 0, 1 ); mLatMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup ); mLatMinutes->setSuffix( "'" ); sexagesimalLayout->addWidget( mLatMinutes, 0, 2 ); mLatSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup ); mLatSeconds->setSuffix( "\"" ); sexagesimalLayout->addWidget( mLatSeconds, 0, 3 ); mLatDirection = new KComboBox( sexagesimalGroup ); mLatDirection->insertItem( i18n( "North" ) ); mLatDirection->insertItem( i18n( "South" ) ); sexagesimalLayout->addWidget( mLatDirection, 0, 4 ); label = new QLabel( i18n( "Longitude:" ), sexagesimalGroup ); sexagesimalLayout->addWidget( label, 1, 0 ); mLongDegrees = new QSpinBox( 0, 180, 1, sexagesimalGroup ); mLongDegrees->setSuffix( "°" ); label->setBuddy( mLongDegrees ); sexagesimalLayout->addWidget( mLongDegrees, 1, 1 ); mLongMinutes = new QSpinBox( 0, 59, 1, sexagesimalGroup ); mLongMinutes->setSuffix( "'" ); sexagesimalLayout->addWidget( mLongMinutes, 1, 2 ); mLongSeconds = new QSpinBox( 0, 59, 1, sexagesimalGroup ); mLongSeconds->setSuffix( "\"" ); sexagesimalLayout->addWidget( mLongSeconds, 1, 3 ); mLongDirection = new KComboBox( sexagesimalGroup ); mLongDirection->insertItem( i18n( "East" ) ); mLongDirection->insertItem( i18n( "West" ) ); sexagesimalLayout->addWidget( mLongDirection, 1, 4 ); topLayout->addWidget( sexagesimalGroup, 1, 1 ); loadCityList(); connect( mMapWidget, SIGNAL( changed() ), SLOT( geoMapChanged() ) ); connect( mCityCombo, SIGNAL( activated( int ) ), SLOT( cityInputChanged() ) ); connect( mLatDegrees, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLatMinutes, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLatSeconds, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLatDirection, SIGNAL( activated( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongDegrees, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongMinutes, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongSeconds, SIGNAL( valueChanged( int ) ), SLOT( sexagesimalInputChanged() ) ); connect( mLongDirection, SIGNAL( activated( int ) ), SLOT( sexagesimalInputChanged() ) ); KAcceleratorManager::manage( this ); }