void KTimerDialog::slotInternalTimeout()
{
    emit timerTimeout();
    switch(buttonOnTimeout)
    {
        case Help:
            slotHelp();
            break;
        case Default:
            slotDefault();
            break;
        case Ok:
            slotOk();
            break;
        case Apply:
            applyPressed();
            break;
        case Try:
            slotTry();
            break;
        case Cancel:
            slotCancel();
            break;
        case Close:
            slotClose();
            break;
        /*case User1:
            slotUser1();
            break;
        case User2:
            slotUser2();
            break;*/
        case User3:
            slotUser3();
            break;
        case No:
            slotNo();
            break;
        case Yes:
            slotCancel();
            break;
        case Details:
            slotDetails();
            break;
        case Filler:
        case Stretch:
            kdDebug() << "Cannot execute button code " << buttonOnTimeout << endl;
            break;
    }
}
Exemple #2
0
EvaQunListView::EvaQunListView( TQWidget * parent, const char * name, WFlags f )
	: TQListView(parent, name, f)
{
	//mToolTip = new EvaToolTip(this);
	
	popupMenu = new TQPopupMenu(0, "QunPopup");
	popupMenu->insertItem(TQIconSet(*(EvaMain::images->getIcon("TQUN_CARD"))), i18n( "Qun Card" ), this, SLOT( slotQunCard()));
	popupMenu->insertItem(TQIconSet(*(EvaMain::images->getIcon("DETAILS"))), i18n( "Details"), this, SLOT(slotDetails()), -1, 1);
	popupMenu->insertSeparator(-1);
	popupMenu->insertItem(TQIconSet(*(EvaMain::images->getIcon("REFRESH_BUDDIES"))), i18n("Refresh Qun Members"), this,SLOT(slotDoRefreshMembers()));
	
	TQObject::connect(this, SIGNAL(contextMenuRequested(TQListViewItem *, const TQPoint & , int)), this, 
		SLOT(slotContextMenu(TQListViewItem *, const TQPoint & , int)));
		
	TQObject::connect(this, SIGNAL(doubleClicked(TQListViewItem *, const TQPoint & , int)),
									 SLOT(slotBuddyDoubleClick(TQListViewItem *, const TQPoint & , int)));
}
/* METAR examples
Berlin-Schoenefeld, Germany (EDDB) 52-23N 013-31E 50M
Sep 26, 2013 - 03:50 AM EDT / 2013.09.26 0750 UTC
Wind: from the NNE (020 degrees) at 13 MPH (11 KT):0
Visibility: 3 mile(s):0
Sky conditions: mostly cloudy
Weather: light drizzle
Temperature: 46 F (8 C)
Dew Point: 46 F (8 C)
Relative Humidity: 100%
Pressure (altimeter): 29.83 in. Hg (1010 hPa)
ob: EDDB 260750Z 02011KT 6000 -DZ SCT003 BKN006 08/08 Q1010 TEMPO BKN010
cycle: 8

Station name not available
Aug 18, 2013 - 09:30 PM EDT / 2013.08.19 0130 UTC
Sky conditions: partly cloudy
Temperature: 59 F (15 C)
Dew Point: 57 F (14 C)
Relative Humidity: 93%
Pressure (altimeter): 30.39 in. Hg (1029 hPa)
ob: OPSD 190130Z CALM 09KM P/CLOUDY FEW015ST SCT035 Q1029/30.41 15/14C RH 95 PERCENT A/V OH CLEAR
cycle: 1
*/
void PreFlightWeatherPage::slotNewWeaterReport( QString& file )
{
  QFile report(file);

  QString station = QFileInfo(file).baseName();

  if( file.contains("/weather/METAR/") )
    {
      if ( ! report.open( QIODevice::ReadOnly ) )
        {
          // could not open file ...
          qWarning() << "Cannot open file: " << report.fileName();
          return;
        }

      // METAR report received
      QTextStream stream( &report );
      QString line;

      QHash<QString, QString> reportItems;
      reportItems.insert( "icao", station );

      int lineNo = 0;

      int tempUnit = GeneralConfig::instance()->getUnitTemperature();
      int pressureUnit = GeneralConfig::instance()->getUnitAirPressure();

      while( !stream.atEnd() )
        {
          line = stream.readLine();
          lineNo++;

          // qDebug() << "line=" << line;

          if( line.trimmed().isEmpty() )
            {
              // ignore comment and empty lines
              continue;
            }

          if( lineNo == 1 )
            {
              // Line 1: station name
              // Berlin-Schoenefeld, Germany (EDDB) 52-23N 013-31E 50M
              // Station name not available
              if( line.startsWith( "Station name not available" ) )
                {
                  reportItems.insert( "station", tr("Station name not available") );
                  continue;
                }

              int idx = line.indexOf( "(" + station + ")" );

              if( idx > 0 )
                {
                  reportItems.insert( "station", line.left(idx - 1) );
                  continue;
                }

              reportItems.insert( "station", line );
              continue;
            }

          if( lineNo == 2 )
            {
              // Line 2: Date and time
              // Sep 26, 2013 - 11:50 AM EDT / 2013.09.26 1550 UTC
              if( line.endsWith(" UTC") )
                {
                  int idx = line.indexOf( " / " );

                  if( idx > 0 && line.size() > (idx + 3) )
                    {
                      QString date = line.mid(idx + 3, 13) + ":" +
                                     line.mid(idx + 3 + 13);

                      reportItems.insert( "date", date );
                      continue;
                    }
                }

              reportItems.insert( "date", line );
              continue;
            }

          if( line.startsWith( "Wind: ") )
            {
              // Wind: from the NW (310 degrees) at 5 MPH (4 KT):0
              // Wind: from the W (280 degrees) at 5 MPH (4 KT) (direction variable):0
              // Wind: from the ESE (120 degrees) at 20 MPH (17 KT) gusting to 32 MPH (28 KT) (direction variable):0
              line.replace( " degrees", QChar(Qt::Key_degree) );

              if( line.endsWith( ":0") )
                {
                  line.chop(2);
                }

              // Remove the line beginning.
              line = line.mid(6);
              int loop = 6;

              while( loop-- )
                {
                  QRegExp re = QRegExp("[0-9]+ MPH \\([0-9]+ KT\\)");

                  int idx1 = line.indexOf(re, 0);

                  if( idx1 == -1 )
                    {
                      // No speed value found.
                      break;
                    }

                  int idx2 = line.indexOf( "(", idx1 + 1 );
                  int idx3 = line.indexOf( " KT)", idx1 + 1 );

                  if( idx2 > 0 && idx2 < idx3 )
                    {
                      bool ok;
                      double ws = line.mid(idx2 + 1, idx3 - idx2 -1).toDouble(&ok);

                      if( ok )
                        {
                          Speed speed(0);
                          speed.setKnot( ws );

                          QString wsText = speed.getWindText( true, 0 );

                          line = line.left(idx1) + wsText + line.mid(idx3 + 4);
                        }
                    }
                }

              reportItems.insert( "wind", line );
              continue;
            }

          if( line.startsWith( "Visibility: ") )
            {
              // Visibility: greater than 7 mile(s):0
              // Visibility: less than 1 mile:0
              // Visibility: 3/4 mile(s):0
              if( line.contains( " mile") )
                {
                  int idx2  = line.lastIndexOf( " mile" );
                  int idx1  = line.lastIndexOf( " ", idx2 - 1 );

                  if( idx1 > 0 && idx1 < idx2 )
                    {
                      bool ok = false;
                      double visiDouble = 0.0;

                      QString visiText = line.mid(idx1 + 1, idx2 - idx1 -1);

                      if( visiText.contains("/") )
                        {
                          QStringList visiList = visiText.split("/");

                          if( visiList.size() == 2 )
                            {
                              double arg1 = visiList.at(0).toDouble(&ok);

                              if( ok )
                                {
                                  double arg2 = visiList.at(1).toDouble(&ok);

                                  if( ok && arg2 > 0.0 )
                                    {
                                      visiDouble = arg1 / arg2;
                                    }
                                }
                            }
                        }
                      else
                        {
                          visiDouble = visiText.toDouble( &ok );
                        }

                      if( ok )
                        {
                          Distance distance(0);
                          distance.setMiles( visiDouble );

                          QString visibility = line.mid( 12, idx1 - 11 );

                          if( distance.getKilometers() > 5 )
                            {
                              visibility += distance.getText( true, 0 );
                            }
                          else
                            {
                              visibility += distance.getText( true, 1 );
                            }

                          if( line.contains("mile(s)") )
                            {
                              // This must be tested as first to prevent wrong handling!
                              if( ! line.endsWith( "mile(s):0") )
                                {
                                  line.replace( ":0", "" );
                                  visibility += line.mid( line.indexOf( "mile(s)" ) + 7 );
                                }
                            }
                          else if( line.contains("mile") && ! line.endsWith( "mile:0") )
                            {
                              if( ! line.endsWith( "mile:0") )
                                {
                                  line.replace( ":0", "" );
                                  visibility += line.mid( line.indexOf( "mile" ) + 4 );
                                }
                            }

                          reportItems.insert( "visibility", visibility );
                          continue;
                        }
                    }
                }

              reportItems.insert( "visibility", line.mid(12) );
              continue;
            }

          if( line.startsWith( "Sky conditions: ") )
            {
              // Sky conditions: partly cloudy or mostly cloudy
              reportItems.insert( "sky", line.mid(16) );
              continue;
            }

          if( line.startsWith( "Weather: ") )
            {
              reportItems.insert( "weather", line.mid(9) );
              continue;
            }

          if( line.startsWith( "Temperature: ") )
            {
              // Temperature: 51 F (11 C)
              if( tempUnit == GeneralConfig::Fahrenheit )
                {
                  // Temperature in F
                  int idx = line.indexOf( " F (" );

                  if( idx > 0 )
                    {
                      reportItems.insert("temperature", line.mid(13, idx-13 ) + QChar(Qt::Key_degree) + "F");
                      continue;
                    }
                }
              else
                {
                  // Temperature in C
                  int idx2 = line.lastIndexOf( " C)" );
                  int idx1 = line.lastIndexOf( "(", idx2 -1 );

                  if( idx1 > 0 && idx1+1 < idx2 )
                    {
                      reportItems.insert("temperature", line.mid( idx1+1, idx2-idx1-1 ) + QChar(Qt::Key_degree) + "C");
                      continue;
                    }
                }

              reportItems.insert("temperature", line.mid( 13 ) );
              continue;
            }

          if( line.startsWith( "Dew Point: ") )
            {
              // Dew Point: 42 F (6 C)
              if( tempUnit == GeneralConfig::Fahrenheit )
                {
                  // Dew point in F
                  int idx = line.indexOf( " F (" );

                  if( idx > 0 )
                    {
                      reportItems.insert("dewPoint", line.mid(11, idx-11) + QChar(Qt::Key_degree) + "F");
                      continue;
                    }
                }
              else
                {
                  // Dew point in C
                  int idx2 = line.lastIndexOf( " C)" );
                  int idx1 = line.lastIndexOf( "(", idx2 - 1 );

                  if( idx1 > 0 && idx1+1 < idx2 )
                    {
                      reportItems.insert("dewPoint", line.mid( idx1+1, idx2-idx1-1 ) + QChar(Qt::Key_degree) + "C");
                      continue;
                    }
                }

              reportItems.insert("dewPoint", line.mid( 11 ) );
              continue;
            }

          if( line.startsWith( "Relative Humidity: ") )
            {
              // Relative Humidity: 71%
              reportItems.insert( "humidity", line.mid(19) );
              continue;
            }

          if( line.startsWith( "Pressure (altimeter): ") )
            {
              // Pressure (altimeter): 30.00 in. Hg (1016 hPa)
              if( pressureUnit == GeneralConfig::inHg )
                {
                  // QNH in inch Hg
                  int idx = line.lastIndexOf( " (" );

                  if( idx > 22 )
                    {
                      reportItems.insert("qnh", line.mid(22, idx - 22 ));
                      continue;
                    }
                }
              else
                {
                  // QHN in hPa
                  int idx2 = line.lastIndexOf( " hPa)" );
                  int idx1 = line.lastIndexOf( "(", idx2 - 1 );

                  if( idx1 > 0 && idx1+2 < idx2 )
                    {
                      reportItems.insert("qnh", line.mid( idx1 + 1, idx2 - idx1 + 3 ));
                      continue;
                    }
                }

              reportItems.insert("qnh", line.mid( 22 ));
              continue;
            }

          if( line.startsWith( "ob: ") )
            {
              // Extract the observation line from the report.
              // ob: EDDB 261550Z 31004KT 9999 FEW030 SCT056 11/06 Q1016 NOSIG
              reportItems.insert( "observation", line.mid(4) );
              continue;
            }
        }

      report.close();

      // qDebug() << "ReportItems:" << reportItems;

      m_metarReports.insert( station, reportItems );
      updateIcaoItem( station );
    }
  else if( file.contains("/weather/TAF/") )
    {
      /* TAF Example
      2013/09/26 12:29
      TAF EDDF 261100Z 2612/2718 32008KT 9999 SCT035
            BECMG 2617/2619 04005KT
      */

      // TAF report received. The whole report is stored in the hash as one string.
      if ( ! report.open( QIODevice::ReadOnly ) )
        {
          // could not open file ...
          qWarning() << "Cannot open file: " << report.fileName();
          return;
        }

      // TAF report received
      QTextStream stream( &report );
      QString line;
      QString tafReport;

      int lineNo = 0;

      while( !stream.atEnd() )
        {
          line = stream.readLine();
          lineNo++;

          if( line.trimmed().isEmpty() || lineNo == 1 )
            {
              // ignore comment and empty lines
              // ignore line 1, it contains the date and time
              continue;
            }

          if( tafReport.isEmpty() )
            {
              tafReport = line;
            }
          else
            {
              tafReport += "\n" + line;
            }
        }

      report.close();

      m_tafReports.insert( station, tafReport );

      // qDebug() << "TAFs:" << m_tafReports;
    }

  if( m_displayWidget->isVisible() )
    {
      if( m_list->topLevelItemCount() == 0 )
        {
          return;
        }

      IcaoItem *item = dynamic_cast<IcaoItem *>( m_list->currentItem() );

      if( item == 0 )
        {
          return;
        }

      if( item->getIcao() == station )
        {
          // The display widget is visible and must be updated too, if new
          // station data are available.
          slotDetails();
        }
    }
}
PreFlightWeatherPage::PreFlightWeatherPage( QWidget *parent ) :
  QWidget(parent),
  m_downloadManger(0),
  m_updateIsRunning(false),
  NoMetar(tr("No METAR available")),
  NoTaf(tr("No TAF available"))
{
  setObjectName("PreFlightWeatherPage");
  setWindowTitle(tr("METAR and TAF"));
  setWindowFlags( Qt::Tool );
  setWindowModality( Qt::WindowModal );
  setAttribute(Qt::WA_DeleteOnClose);

  if( MainWindow::mainWindow() )
    {
      // Resize the window to the same size as the main window has. That will
      // completely hide the parent window.
      resize( MainWindow::mainWindow()->size() );

#ifdef ANDROID
      // On Galaxy S3 there are size problems observed
      setMinimumSize( MainWindow::mainWindow()->size() );
      setMaximumSize( MainWindow::mainWindow()->size() );
#endif
    }

  QVBoxLayout *mainLayout  = new QVBoxLayout( this );
  m_listWidget             = new QWidget( this );
  m_displayWidget          = new QWidget( this );
  m_editorWidget           = new QWidget( this );

  mainLayout->addWidget( m_listWidget );
  mainLayout->addWidget( m_displayWidget );
  mainLayout->addWidget( m_editorWidget );

  m_displayWidget->hide();
  m_editorWidget->hide();

  //----------------------------------------------------------------------------
  // List widget
  //----------------------------------------------------------------------------
  QVBoxLayout *listLayout = new QVBoxLayout( m_listWidget );

  m_list = new QTreeWidget;
  m_list->setRootIsDecorated( false );
  m_list->setItemsExpandable( false );
  m_list->setSortingEnabled( true );
  m_list->setSelectionMode( QAbstractItemView::SingleSelection );
  m_list->setSelectionBehavior( QAbstractItemView::SelectRows );
  m_list->setAlternatingRowColors(true);
  m_list->setColumnCount( 1 );
  m_list->setFocusPolicy( Qt::StrongFocus );
  m_list->setUniformRowHeights(true);
  m_list->setHeaderLabel( tr( "METAR and TAF" ) );

  m_list->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
  m_list->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );

#ifdef ANDROID
  QScrollBar* lvsb = m_list->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture(m_list->viewport(), QScroller::LeftMouseButtonGesture);
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture(m_list->viewport(), QtScroller::LeftMouseButtonGesture);
#endif

  listLayout->addWidget( m_list );

  QHBoxLayout* hbbox1 = new QHBoxLayout;
  listLayout->addLayout( hbbox1 );

  QPushButton* cmd = new QPushButton(tr("Add"), this);
  hbbox1->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotShowAirportEditor()));

  hbbox1->addSpacing( 10 );

  m_listUpdateButton = new QPushButton(tr("Update"), this);
  hbbox1->addWidget(m_listUpdateButton);
  connect (m_listUpdateButton, SIGNAL(clicked()), SLOT(slotRequestWeatherData()));

  hbbox1->addSpacing( 10 );

  cmd = new QPushButton(tr("Details"), this);
  hbbox1->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotDetails()));

  QHBoxLayout* hbbox2 = new QHBoxLayout;
  listLayout->addLayout( hbbox2 );

  cmd = new QPushButton(tr("Delete"), this);
  hbbox2->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotDeleteAirport()));

  hbbox2->addSpacing( 10 );

  cmd = new QPushButton(tr("Close"), this);
  hbbox2->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotClose()));

  //----------------------------------------------------------------------------
  // Display widget for report details
  //----------------------------------------------------------------------------
  QVBoxLayout *displayLayout = new QVBoxLayout( m_displayWidget );
  m_display = new QTextEdit;
  m_display->setReadOnly( true );

#ifdef ANDROID
  lvsb = m_display->verticalScrollBar();
  lvsb->setStyleSheet( Layout::getCbSbStyle() );
#endif

#ifdef QSCROLLER
  QScroller::grabGesture(m_display->viewport(), QScroller::LeftMouseButtonGesture);
#endif

#ifdef QTSCROLLER
  QtScroller::grabGesture(m_display->viewport(), QtScroller::LeftMouseButtonGesture);
#endif

  displayLayout->addWidget( m_display );

  QHBoxLayout* hbbox = new QHBoxLayout;
  displayLayout->addLayout( hbbox );

  m_detailsUpdateButton = new QPushButton(tr("Update"));
  hbbox->addWidget(m_detailsUpdateButton);
  connect (m_detailsUpdateButton, SIGNAL(clicked()), SLOT(slotRequestWeatherData()));

  hbbox->addSpacing( 10 );

  cmd = new QPushButton(tr("Close"));
  hbbox->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotShowListWidget()));

  //----------------------------------------------------------------------------
  // Editor widget for station adding.
  //----------------------------------------------------------------------------
  QVBoxLayout *editorLayout = new QVBoxLayout( m_editorWidget );

  editorLayout->addWidget( new QLabel(tr("Airport ICAO Code")), 0, Qt::AlignLeft );

  QHBoxLayout *inputLayout = new QHBoxLayout;
  editorLayout->addLayout( inputLayout );

  QRegExpValidator* eValidator = new QRegExpValidator( QRegExp( "[a-zA-Z0-9]{4}|^$" ), this );

  Qt::InputMethodHints imh;
  m_airportEditor = new QLineEdit;
  m_airportEditor->setInputMethodHints(Qt::ImhUppercaseOnly | Qt::ImhDigitsOnly | Qt::ImhNoPredictiveText);
  m_airportEditor->setValidator( eValidator );

  connect( m_airportEditor, SIGNAL(returnPressed()),
           MainWindow::mainWindow(), SLOT(slotCloseSip()) );

  inputLayout->addWidget( m_airportEditor, 5 );
  inputLayout->addSpacing( 10 );

  cmd = new QPushButton(tr("Cancel"), this);
  inputLayout->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotShowListWidget()));

  inputLayout->addSpacing( 10 );

  cmd = new QPushButton(tr("Ok"), this);
  inputLayout->addWidget(cmd);
  connect (cmd, SIGNAL(clicked()), SLOT(slotAddAirport()));

  editorLayout->addStretch( 10 );

  //----------------------------------------------------------------------------
  loadAirportData( true );
  show();
}
// --------------------------------------------------------------------------------------------
CMapQMAPExport::CMapQMAPExport(const CMapSelectionRaster& mapsel, QWidget * parent)
: QDialog(parent)
, mapsel(mapsel)
, tainted(false)
, has_map2jnx(false)
, totalNumberOfStates(0)
{
    setupUi(this);

    connect(toolPath, SIGNAL(clicked()), this, SLOT(slotOutputPath()));
    connect(pushExport, SIGNAL(clicked()), this, SLOT(slotStart()));
    connect(pushCancel, SIGNAL(clicked()), this, SLOT(slotCancel()));
    connect(pushDetails, SIGNAL(clicked()), this, SLOT(slotDetails()));
    connect(radioQLM, SIGNAL(toggled(bool)), this, SLOT(slotQLMToggled(bool)));
    connect(radioJNX, SIGNAL(toggled(bool)), this, SLOT(slotBirdsEyeToggled(bool)));
    connect(radioGCM, SIGNAL(toggled(bool)), this, SLOT(slotGCMToggled(bool)));
    connect(radioRMAP, SIGNAL(toggled(bool)), this, SLOT(slotRMAPToggled(bool)));
    connect(radioRMP, SIGNAL(toggled(bool)), this, SLOT(slotRMPToggled(bool)));

    connect(&cmd, SIGNAL(readyReadStandardError()), this, SLOT(slotStderr()));
    connect(&cmd, SIGNAL(readyReadStandardOutput()), this, SLOT(slotStdout()));
    connect(&cmd, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(slotFinished(int,QProcess::ExitStatus)));

    connect(toolGeoTiffProjWizard, SIGNAL(clicked()), this, SLOT(slotSetupProj()));
    connect(toolGeoTiffFromMap, SIGNAL(clicked()), this, SLOT(slotSetupProjFromMap()));

    connect(toolMagellanCopyright, SIGNAL(clicked()), this, SLOT(slotSelectCopyright()));

    SETTINGS;
    labelPath->setText(cfg.value("path/export","./").toString());

    CMapDB::map_t mapData = CMapDB::self().getMapData(mapsel.mapkey);
    linePrefix->setText(QString("%1_%2_%3").arg(mapData.description).arg(mapsel.lon1 * RAD_TO_DEG).arg(mapsel.lat1 * RAD_TO_DEG));
    linePrefix->setCursorPosition(0);
    lineDescription->setText(mapData.description);
    lineDescription->setCursorPosition(0);

    radioRMAP->show();
    radioRMAP->setEnabled(true);

    comboRmapProjection->addItem("Mercator(WGS 84)", "+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs");
    comboRmapProjection->addItem("EPSG:4326, LongLat(WGS 84)", "+init=epsg:4326");
    comboRmapProjection->addItem("EPSG:31467, GK3 (DHDN)", "+init=epsg:31467");
    comboRmapProjection->addItem("EPSG:31468, GK4 (DHDN)", "+init=epsg:31468");

#ifdef WIN32
    path_map2jnx        = QCoreApplication::applicationDirPath()+QDir::separator()+"map2jnx.exe";
    QFile file_map2jnx(path_map2jnx);
    has_map2jnx         = file_map2jnx.exists();
    path_map2gcm        = QCoreApplication::applicationDirPath()+QDir::separator()+"map2gcm.exe";
    path_cache2gtiff    = QCoreApplication::applicationDirPath()+QDir::separator()+"cache2gtiff.exe";
    path_map2rmap       = QCoreApplication::applicationDirPath()+QDir::separator()+"map2rmap.exe";
    path_map2rmp        = QCoreApplication::applicationDirPath()+QDir::separator()+"map2rmp.exe";
#else
#if defined(Q_OS_MAC)
    // MacOS X: applications are stored in the bundle folder
    path_map2gcm        = QString("%1/Resources/map2gcm").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), ""));
    path_map2jnx        = QString("%1/Resources/map2jnx").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), ""));
    path_cache2gtiff    = QString("%1/Resources/cache2gtiff").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), ""));
    path_map2rmap       = QString("%1/Resources/map2rmap").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), ""));
    path_map2rmp        = QString("%1/Resources/map2rmp").arg(QCoreApplication::applicationDirPath().replace(QRegExp("MacOS$"), ""));
#else
    path_map2gcm        = "map2gcm";
    path_map2jnx        = MAP2JNX;
    path_cache2gtiff    = "cache2gtiff";
    path_map2rmap       = "map2rmap";
    path_map2rmp        = "map2rmp";
#endif
    QProcess proc1;
    proc1.start(path_map2jnx, QStringList());
    proc1.waitForFinished();
    has_map2jnx = proc1.error() == QProcess::UnknownError;
#endif
    groupBirdsEye->hide();
    groupJPEG->hide();
    groupDevice->hide();
    groupRMAP->hide();
    groupMagellanRmp->hide();

    spinJpegQuality->setValue(cfg.value("map/export/jnx/quality",75).toInt());
    comboJpegSubsampling->setCurrentIndex(comboJpegSubsampling->findText(cfg.value("map/export/jnx/subsampling","411").toString()));
    spinProductId->setValue(cfg.value("map/export/jnx/productid",0).toInt());
    lineProductName->setText(cfg.value("map/export/jnx/productname","BirdsEye").toString());
    lineCopyright->setText(cfg.value("map/export/jnx/copyright","None").toString());

    lineMagellanProvider->setText(cfg.value("map/export/rmp/provider", tr("Please enter a string")).toString());
    lineMagellanProduct->setText(cfg.value("map/export/rmp/product", tr("Please enter a string")).toString());
    copyright = cfg.value("map/export/rmp/copyright", tr("")).toString();
    labelMagellanCopyright->setText(QFileInfo(copyright).fileName());

    radioQLM->setChecked(cfg.value("map/export/qlm", true).toBool());
    radioGCM->setChecked(cfg.value("map/export/gcm", false).toBool());
    radioRMAP->setChecked(cfg.value("map/export/rmap", false).toBool());
    radioRMP->setChecked(cfg.value("map/export/rmp", false).toBool());

    if (has_map2jnx)
    {
        radioJNX->setChecked(cfg.value("map/export/jnx", false).toBool());
    }
    else
    {
        radioJNX->hide();
    }

    checkOverview2x->setChecked(cfg.value("map/export/over2x", true).toBool());
    checkOverview4x->setChecked(cfg.value("map/export/over4x", true).toBool());
    checkOverview8x->setChecked(cfg.value("map/export/over8x", true).toBool());
    checkOverview16x->setChecked(cfg.value("map/export/over16x", true).toBool());

    lineStreamingLevels->setText(cfg.value("map/export/stream/levels", "1 ").toString());
    if(lineStreamingLevels->text().isEmpty())
    {
        lineStreamingLevels->setText("1 ");
    }

    lineGeoTiffProjection->setText(cfg.value("map/export/qlm/proj","+proj=longlat +a=6378137.0000 +b=6356752.3142 +towgs84=0,0,0,0,0,0,0,0 +units=m  +no_defs").toString());
    lineGeoTiffProjection->setCursorPosition(0);

    checkProjection->setChecked(cfg.value("map/export/qlm/proj_enable").toBool());

    progressBar->setMinimum(0);
    progressBar->setMaximum(100);
    progressBar->setValue(0);
    progressBar->resize(300, progressBar->height());

    if(cfg.value("map/export/hidedetails", true).toBool())
    {
        textBrowser->hide();
    }
    else
    {
        textBrowser->show();
    }

    if(mapsel.subtype == IMapSelection::eGDAL)
    {
        labelWarnStream->hide();
        groupStreaming->hide();
    }
    else
    {
        labelWarnStream->show();
        groupStreaming->show();
    }

    QFont f = font();
    f.setFamily("Mono");
    textBrowser->setFont(f);

    adjustSize();

}