diff options
Diffstat (limited to 'kstars/kstars/kstarsdcop.cpp')
-rw-r--r-- | kstars/kstars/kstarsdcop.cpp | 276 |
1 files changed, 138 insertions, 138 deletions
diff --git a/kstars/kstars/kstarsdcop.cpp b/kstars/kstars/kstarsdcop.cpp index 7a4af85e..bc1f4ff4 100644 --- a/kstars/kstars/kstarsdcop.cpp +++ b/kstars/kstars/kstarsdcop.cpp @@ -30,7 +30,7 @@ #include <tdelistview.h> #include <kpushbutton.h> #include <klineedit.h> -#include <knuminput.h> +#include <knuminput.h> #include "kstars.h" #include "kstarsdata.h" @@ -157,7 +157,7 @@ void KStars::setGeoLocation( TQString city, TQString province, TQString country //make sure planets, etc. are updated immediately data()->setFullTimeUpdate(); - // If the sky is inQt::Horizontal mode and not tracking, reset focus such that + // If the sky is in Horizontal mode and not tracking, reset focus such that // Alt/Az remain constant. if ( ! Options::isTracking() && Options::useAltAz() ) { map()->focus()->HorizontalToEquatorial( LST(), geo()->lat() ); @@ -205,7 +205,7 @@ void KStars::writeConfig() { } TQString KStars::getOption( const TQString &name ) { - //Some config items are not stored in the Options object while + //Some config items are not stored in the Options object while //the program is running; catch these here and returntheir current value. if ( name == "FocusRA" ) { return TQString::number( map()->focus()->ra()->Hours(), 'f', 6 ); } if ( name == "FocusDec" ) { return TQString::number( map()->focus()->dec()->Degrees(), 'f', 6 ); } @@ -344,12 +344,12 @@ void KStars::loadColorScheme( const TQString _name ) { TQString name( _name ); TQString filename = name.lower().stripWhiteSpace(); bool ok( false ); - + //Parse default names which don't follow the regular file-naming scheme if ( name == i18n("use default color scheme", "Default Colors") ) filename = "default.colors"; - if ( name == i18n("use 'star chart' color scheme", "Star Chart") ) filename = "chart.colors"; - if ( name == i18n("use 'night vision' color scheme", "Night Vision") ) filename = "night.colors"; - + if ( name == i18n("use 'star chart' color scheme", "Star Chart") ) filename = "chart.colors"; + if ( name == i18n("use 'night vision' color scheme", "Night Vision") ) filename = "night.colors"; + //Try the filename if it ends with ".colors" if ( filename.endsWith( ".colors" ) ) ok = data()->colorScheme()->load( filename ); @@ -360,36 +360,36 @@ void KStars::loadColorScheme( const TQString _name ) { if ( !filename.isEmpty() ) { for( unsigned int i=0; i<filename.length(); ++i) if ( filename.at(i)==' ' ) filename.replace( i, 1, "-" ); - + filename = filename.append( ".colors" ); ok = data()->colorScheme()->load( filename ); } - - if ( ! ok ) kdDebug() << i18n( "Unable to load color scheme named %1. Also tried %2." ).arg( name ).arg( filename ); + + if ( ! ok ) kdDebug() << i18n( "Unable to load color scheme named %1. Also tried %2." ).arg( name ).arg( filename ); } - + if ( ok ) { map()->setStarColorMode( data()->colorScheme()->starColorMode() ); map()->setStarColorIntensity( data()->colorScheme()->starColorIntensity() ); - + //set the application colors for the Night Vision scheme if ( Options::darkAppColors() == false && filename == "night.colors" ) { Options::setDarkAppColors( true ); OriginalPalette = TQApplication::palette(); TQApplication::setPalette( DarkPalette, true ); } - + if ( Options::darkAppColors() && filename != "night.colors" ) { Options::setDarkAppColors( false ); TQApplication::setPalette( OriginalPalette, true ); } - + map()->forceUpdate(); } } void KStars::exportImage( const TQString url, int w, int h ) { - //If the filename string contains no "/" separators, assume the + //If the filename string contains no "/" separators, assume the //user wanted to place a file in their home directory. KURL fileURL; if ( ! url.contains( "/" ) ) fileURL = TQDir::homeDirPath() + "/" + url; @@ -398,11 +398,11 @@ void KStars::exportImage( const TQString url, int w, int h ) { KTempFile tmpfile; TQString fname; tmpfile.setAutoDelete(true); - + TQPixmap skyimage( map()->width(), map()->height() ); TQPixmap outimage( w, h ); outimage.fill(); - + if ( fileURL.isValid() ) { if ( fileURL.isLocalFile() ) { fname = fileURL.path(); @@ -424,7 +424,7 @@ void KStars::exportImage( const TQString url, int w, int h ) { kapp->processEvents(10000); //skyImage is the size of the sky map. The requested image size is w x h. - //If w x h is smaller than the skymap, then we simply crop the image. + //If w x h is smaller than the skymap, then we simply crop the image. //If w x h is larger than the skymap, pad the skymap image with a white border. if ( w == map()->width() && h == map()->height() ) { outimage = skyimage; @@ -433,20 +433,20 @@ void KStars::exportImage( const TQString url, int w, int h ) { int sw(map()->width()), sh(map()->height()); if ( w > map()->width() ) { dx = (w - map()->width())/2; - } else { - sx = (map()->width() - w)/2; - sw = w; + } else { + sx = (map()->width() - w)/2; + sw = w; } if ( h > map()->height() ) { dy = (h - map()->height())/2; - } else { - sy = (map()->height() - h)/2; - sh = h; + } else { + sy = (map()->height() - h)/2; + sh = h; } - + bitBlt( &outimage, dx, dy, &skyimage, sx, sy, sw, sh ); } - + if ( ! outimage.save( fname, format ) ) kdDebug() << i18n( "Error: Unable to save image: %1 " ).arg( fname ) << endl; else kdDebug() << i18n( "Image saved to file: %1" ).arg( fname ) << endl; @@ -462,15 +462,15 @@ void KStars::exportImage( const TQString url, int w, int h ) { void KStars::printImage( bool usePrintDialog, bool useChartColors ) { KPrinter printer( true, TQPrinter::HighResolution ); printer.setFullPage( false ); - - //Set up the printer (either with the Print Dialog, + + //Set up the printer (either with the Print Dialog, //or using the default settings) bool ok( false ); if ( usePrintDialog ) ok = printer.setup( this, i18n("Print Sky") ); - else + else ok = printer.autoConfigure(); - + if( ok ) { kapp->setOverrideCursor( waitCursor ); @@ -489,13 +489,13 @@ void KStars::printImage( bool usePrintDialog, bool useChartColors ) { //(if printing was aborted, the colorscheme is still restored) if ( useChartColors ) { data()->colorScheme()->copy( cs ); - + // restore colormode and colorintensity in skymap map()->setStarColorMode( cs.starColorMode() ); map()->setStarColorIntensity( cs.starColorIntensity() ); map()->forceUpdate(); } - + kapp->restoreOverrideCursor(); } } @@ -504,13 +504,13 @@ void KStars::startINDI (TQString deviceName, bool useLocal) { establishINDI(); - + if (!indidriver || !indimenu) { kdDebug() << "establishINDI() failed." << endl; return; } - + TQListViewItem *driverItem = NULL; driverItem = indidriver->localListView->findItem(deviceName, 0); if (driverItem == NULL) @@ -525,18 +525,18 @@ void KStars::startINDI (TQString deviceName, bool useLocal) indidriver->localListView->setSelected(driverItem, true); indidriver->processDeviceStatus(1); } - + // Set custome label for device indimenu->setCustomLabel(deviceName); // Select it indidriver->localListView->setSelected(driverItem, true); - + // Start it either locally or as series if (useLocal) indidriver->localR->setChecked(true); else indidriver->serverR->setChecked(true); - + // Run it indidriver->processDeviceStatus(0); @@ -549,7 +549,7 @@ void KStars::shutdownINDI (TQString deviceName) kdDebug() << "establishINDI() failed." << endl; return; } - + TQListViewItem *driverItem = NULL; driverItem = indidriver->localListView->findItem(deviceName, 0); if (driverItem == NULL) @@ -567,13 +567,13 @@ void KStars::switchINDI(TQString deviceName, bool turnOn) { INDI_D *dev; INDI_P *prop; - + if (!indidriver || !indimenu) { kdDebug() << "switchINDI: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -582,33 +582,33 @@ void KStars::switchINDI(TQString deviceName, bool turnOn) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + if (turnOn && dev->isOn() || (!turnOn && !dev->isOn())) return; - + prop = dev->findProp("CONNECTION"); if (!prop) return; - + if (turnOn) prop->newSwitch(0); else prop->newSwitch(1); - + } - + void KStars::setINDIPort(TQString deviceName, TQString port) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDIPort: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -617,34 +617,34 @@ void KStars::setINDIPort(TQString deviceName, TQString port) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("DEVICE_PORT"); if (!prop) return; - + el = prop->findElement("PORT"); - + if (!el->write_w) return; - + el->write_w->setText(port); - + prop->newText(); } - + void KStars::setINDITargetCoord(TQString deviceName, double RA, double DEC) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDITarget: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -653,33 +653,33 @@ void KStars::setINDITargetCoord(TQString deviceName, double RA, double DEC) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("EQUATORIAL_EOD_COORD"); if (!prop) return; - + el = prop->findElement("RA"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(RA)); - + el = prop->findElement("DEC"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(DEC)); - + prop->newText(); - + } - + void KStars::setINDITargetName(TQString deviceName, TQString objectName) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDITarget: establishINDI() failed." << endl; @@ -688,7 +688,7 @@ void KStars::setINDITargetName(TQString deviceName, TQString objectName) SkyObject *target = data()->objectNamed( objectName ); if (!target) return; - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -697,38 +697,38 @@ void KStars::setINDITargetName(TQString deviceName, TQString objectName) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("EQUATORIAL_EOD_COORD"); if (!prop) return; - + el = prop->findElement("RA"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(target->ra()->Hours())); - + el = prop->findElement("DEC"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(target->dec()->Degrees())); - + prop->newText(); } - + void KStars::setINDIAction(TQString deviceName, TQString action) { INDI_D *dev; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDIAction: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -737,28 +737,28 @@ void KStars::setINDIAction(TQString deviceName, TQString action) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + el = dev->findElem(action); if (!el) return; - + el->pp->activateSwitch(action); - + } - + void KStars::waitForINDIAction(TQString deviceName, TQString action) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "waitForINDIAction: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -767,24 +767,24 @@ void KStars::waitForINDIAction(TQString deviceName, TQString action) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp(action); - + if (prop == NULL) { el = dev->findElem(action); if (!el) return; - + TQObject::connect(el->pp, TQT_SIGNAL(okState()), this, TQT_SLOT(resumeDCOP(void ))); } else TQObject::connect(prop, TQT_SIGNAL(okState()), this, TQT_SLOT(resumeDCOP(void ))); - + kapp->dcopClient()->suspend(); - + } - + void KStars::setINDIFocusSpeed(TQString deviceName, unsigned int speed) { INDI_D *dev; @@ -805,21 +805,21 @@ void KStars::setINDIFocusSpeed(TQString deviceName, unsigned int speed) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("FOCUS_SPEED"); if (!prop) return; - + el = prop->findElement("SPEED"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(speed)); prop->newText(); } - + void KStars::startINDIFocus(TQString deviceName, int focusDir) { if (!indidriver || !indimenu) @@ -835,20 +835,20 @@ void KStars::startINDIFocus(TQString deviceName, int focusDir) } - + void KStars::setINDIGeoLocation(TQString deviceName, double longitude, double latitude) { - + INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDIGeoLocation: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -857,33 +857,33 @@ void KStars::setINDIGeoLocation(TQString deviceName, double longitude, double la kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("GEOGRAPHICAL_COORD"); if (!prop) return; - + el = prop->findElement("LONG"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(longitude)); - + el = prop->findElement("LAT"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(TQString("%1").arg(latitude)); - + prop->newText(); } - + void KStars::setINDIFocusTimeout(TQString deviceName, int timeout) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "startINDIFocus: establishINDI() failed." << endl; @@ -898,36 +898,36 @@ void KStars::setINDIFocusTimeout(TQString deviceName, int timeout) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("FOCUS_TIMEOUT"); if (!prop) return; - + el = prop->findElement("TIMEOUT"); if (!el) return; - + if (el->write_w) el->write_w->setText(TQString("%1").arg(timeout)); else if (el->spin_w) el->spin_w->setValue(timeout); - + prop->newText(); } - + void KStars::startINDIExposure(TQString deviceName, int timeout) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "startINDIExposure: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -936,21 +936,21 @@ void KStars::startINDIExposure(TQString deviceName, int timeout) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("CCD_EXPOSE_DURATION"); if (!prop) return; - + el = prop->findElement("EXPOSE_DURATION"); if (!el) return; - + if (el->write_w) el->write_w->setText(TQString("%1").arg(timeout)); else if (el->spin_w) el->spin_w->setValue(timeout); - - + + prop->newText(); - + } void KStars::setINDIFilterNum(TQString deviceName, int filter_num) @@ -958,13 +958,13 @@ void KStars::setINDIFilterNum(TQString deviceName, int filter_num) INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDIFilterNum: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -973,34 +973,34 @@ void KStars::setINDIFilterNum(TQString deviceName, int filter_num) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("FILTER_SLOT"); if (!prop) return; - + el = prop->findElement("SLOT"); if (!el) return; - + if (el->write_w) el->write_w->setText(TQString("%1").arg(filter_num)); else if (el->spin_w) el->spin_w->setValue(filter_num); - + prop->newText(); - + } - + void KStars::setINDIUTC(TQString deviceName, TQString UTCDateTime) { INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "startINDIUTC: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -1009,16 +1009,16 @@ void KStars::setINDIUTC(TQString deviceName, TQString UTCDateTime) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("TIME"); if (!prop) return; - + el = prop->findElement("UTC"); if (!el) return; if (!el->write_w) return; - + el->write_w->setText(UTCDateTime); - + prop->newText(); } @@ -1027,7 +1027,7 @@ void KStars::setINDIScopeAction(TQString deviceName, TQString action) { setINDIAction(deviceName, action); } - + void KStars::setINDIFrameType(TQString deviceName, TQString type) { setINDIAction(deviceName, type); @@ -1038,13 +1038,13 @@ void KStars::setINDICCDTemp(TQString deviceName, int temp) INDI_D *dev; INDI_P *prop; INDI_E *el; - + if (!indidriver || !indimenu) { kdDebug() << "setINDICCDTemp: establishINDI() failed." << endl; return; } - + dev = indimenu->findDevice(deviceName); if (!dev) dev = indimenu->findDeviceByLabel(deviceName); @@ -1053,19 +1053,19 @@ void KStars::setINDICCDTemp(TQString deviceName, int temp) kdDebug() << "Device " << deviceName << " not found!" << endl; return; } - + prop = dev->findProp("CCD_TEMPERATURE"); if (!prop) return; - + el = prop->findElement("TEMPERATURE"); if (!el) return; - + if (el->write_w) el->write_w->setText(TQString("%1").arg(temp)); else if (el->spin_w) el->spin_w->setValue(temp); - - + + prop->newText(); - + } |