Esempio n. 1
0
int main( int argc, char ** argv )
{
  QSettings settings;

  QgsApplication a( argc, argv, true );
  // update any saved setting for older themes to new default 'gis' theme (2013-04-15)
  QString theme = settings.value( "/Themes", "default" ).toString();
  if ( theme == QString( "gis" )
       || theme == QString( "classic" )
       || theme == QString( "nkids" ) )
  {
    theme = QString( "default" );
  }
  a.setThemeName( theme );
  a.initQgis();

  // Set up the QSettings environment must be done after qapp is created
  QCoreApplication::setOrganizationName( "QGIS" );
  QCoreApplication::setOrganizationDomain( "qgis.org" );
  QCoreApplication::setApplicationName( "QGIS2" );

  QgsBrowser w;

  a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );
  w.restoreWindowState();

  w.show();

  a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );

  return a.exec();
}
Esempio n. 2
0
Window::~Window()
{
    logger->log("Window::~Window(\"%s\")", getCaption().c_str());

    saveWindowState();

    destroy(mLayout);
    destroy(mClose);

    while (!mWidgets.empty())
    {
        if (mWidgets.front() == mPreviousFocus)
            mPreviousFocus = NULL;
        destroy(mWidgets.front());
    }

    windowContainer->remove(this);

    removeWidgetListener(this);

    instances--;

    mSkin->instances--;

    if (instances == 0)
        destroy(skinLoader);
}
Esempio n. 3
0
void SyntroReview::closeEvent(QCloseEvent *)
{
	killTimer(m_statusTimer);
	killTimer(m_directoryTimer);
	saveWindowState();
	m_client->exitThread();
	SyntroUtils::syntroAppExit();
}
void RTAutomationManager::closeEvent(QCloseEvent *)
{
    onDisconnect();
    if (m_client) {
        m_client->exitThread();
        m_client = NULL;
    }
    saveWindowState();
}
Esempio n. 5
0
void ViewSingleCamera::closeEvent(QCloseEvent *)
{
	saveWindowState();

	killTimer(m_timer);
	m_timer = 0;

	emit closed();
}
Esempio n. 6
0
void NpcListDialog::close()
{
    ListDialog::close();
    saveWindowState();

    if (!current_npc)
        return;

    MessageOut outMsg(CMSG_NPC_LIST_CHOICE);
    outMsg.writeInt32(current_npc);
    outMsg.writeInt8(mChoice);

    current_npc = 0;
}
Esempio n. 7
0
void SyntroZigbeeGateway::closeEvent(QCloseEvent *)
{
	onDisconnect();

	if (m_syntroStatusTimer) {
		killTimer(m_syntroStatusTimer);
		m_syntroStatusTimer = 0;
	}

	if (m_client) {
		m_client->exitThread();
		delete m_client;
		m_client = NULL;
	}

	saveWindowState();
}
Esempio n. 8
0
Window::~Window()
{
    logger->log("Window::~Window(\"%s\")", getCaption().c_str());

    saveWindowState();

    delete mLayout;

    while (!mWidgets.empty())
        delete mWidgets.front();

    removeWidgetListener(this);

    instances--;

    mSkin->instances--;
}
Esempio n. 9
0
/** Overloaded QWidget::setVisible(). If this window is already visible and
 * <b>visible</b> is true, this window will be brought to the top and given 
 * focus. If <b>visible</b> is false, then the window state will be saved and
 * this window will be hidden. */
void
VidaliaWindow::setVisible(bool visible)
{
  if (visible) {
    /* Bring the window to the top, if it's already open. Otherwise, make the
     * window visible. */
    if (isVisible()) {
      activateWindow();
      setWindowState(windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
      raise();
    } else {
      restoreWindowState();
    }
  } else {
    /* Save the last size and position of this window. */
    saveWindowState();
  }
  QMainWindow::setVisible(visible);
}
Esempio n. 10
0
void SyntroDB::closeEvent(QCloseEvent *)
{
	killTimer(m_timerId);

	if (m_storeClient) {
		m_storeClient->exitThread();
	}

	if (m_CFSClient) {
		m_CFSClient->exitThread();
	}

	if (m_controlServer) {
		m_controlServer->exitThread();
		m_controlServer = NULL;
	}

	saveWindowState();
	SyntroUtils::syntroAppExit();
}
Esempio n. 11
0
void SyntroStore::closeEvent(QCloseEvent *)
{
	killTimer(m_timerId);

	if (m_client) {
		m_client->exitThread();
	}

	m_settings->beginWriteArray(SYNTROSTORE_PARAMS_STREAM_SOURCES);
	for (int index = 0; index < SYNTROSTORE_MAX_STREAMS; index++) {
		m_settings->setArrayIndex(index);

		if (m_useBox[index]->checkState() == Qt::Checked)
			m_settings->setValue(SYNTROSTORE_PARAMS_INUSE, SYNTRO_PARAMS_TRUE);
		else
			m_settings->setValue(SYNTROSTORE_PARAMS_INUSE, SYNTRO_PARAMS_FALSE);
	}
	m_settings->endArray();

	saveWindowState();
	SyntroUtils::syntroAppExit();
}
Esempio n. 12
0
int main( int argc, char ** argv )
{
  QSettings settings;

  QgsApplication a( argc, argv, true );
  a.setThemeName( settings.value( "/Themes", "default" ).toString() );
  a.initQgis();

  // Set up the QSettings environment must be done after qapp is created
  QCoreApplication::setOrganizationName( "QuantumGIS" );
  QCoreApplication::setOrganizationDomain( "qgis.org" );
  QCoreApplication::setApplicationName( "QGIS" );

  QgsBrowser w;

  a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );
  w.restoreWindowState();

  w.show();

  a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );

  return a.exec();
}
Esempio n. 13
0
void Window::resetToDefaultSize()
{
    setSize(mDefaultWidth, mDefaultHeight);
    setLocationRelativeTo(mDefaultPosition, mDefaultOffsetX, mDefaultOffsetY);
    saveWindowState();
}
Esempio n. 14
0
int main( int argc, char ** argv )
{
  QSettings settings;

  QgsApplication a( argc, argv, true );
  a.setThemeName( settings.value( "/Themes", "default" ).toString() );

  // load providers
#if defined(Q_WS_WIN)
  QString prefixPath = QApplication::applicationDirPath();
#else
  QString prefixPath = QApplication::applicationDirPath() + "/..";
#endif
  a.setPrefixPath( prefixPath, true );
  a.initQgis();

  // Set up the QSettings environment must be done after qapp is created
  QCoreApplication::setOrganizationName( "QuantumGIS" );
  QCoreApplication::setOrganizationDomain( "qgis.org" );
  QCoreApplication::setApplicationName( "QGIS" );

#if 0
  QString myTranslationCode = "";

  // This is mostly copy from Help viewer - not sure if important
#if defined(Q_WS_MACX)
  // If we're on Mac, we have the resource library way above us...
  a.setPkgDataPath( QgsApplication::prefixPath() + "/../../../../" + QString( QGIS_DATA_SUBDIR ) );
#elif defined(Q_WS_WIN)
  a.setPkgDataPath( QgsApplication::prefixPath() + "/" QGIS_DATA_SUBDIR );
#else
  a.setPkgDataPath( QgsApplication::prefixPath() + "/../" QGIS_DATA_SUBDIR );
#endif

  QString i18nPath = QgsApplication::i18nPath();
  if ( myTranslationCode.isEmpty() )
  {
    myTranslationCode = QLocale::system().name();

    QSettings settings;
    if ( settings.value( "locale/overrideFlag", false ).toBool() )
    {
      myTranslationCode = settings.value( "locale/userLocale", "en_US" ).toString();
    }
  }
  QgsDebugMsg( QString( "Setting translation to %1/qgis_%2" ).arg( i18nPath ).arg( myTranslationCode ) );

  /* Translation file for Qt.
   * The strings from the QMenuBar context section are used by Qt/Mac to shift
   * the About, Preferences and Quit items to the Mac Application menu.
   * These items must be translated identically in both qt_ and qgis_ files.
   */

  QTranslator qttor( 0 );
  if ( qttor.load( QString( "qt_" ) + myTranslationCode, i18nPath ) )
  {
    a.installTranslator( &qttor );
  }

  /* Translation file for QGIS.
   */

  QTranslator qgistor( 0 );
  if ( qgistor.load( QString( "qgis_" ) + myTranslationCode, i18nPath ) )
  {
    a.installTranslator( &qgistor );
  }
#endif

  QgsBrowser w;

  a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );
  w.restoreWindowState();

  w.show();

  a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );

  return a.exec();
}
Esempio n. 15
0
/** Destructor. */
VidaliaWindow::~VidaliaWindow()
{
  saveWindowState();
  delete _settings;
}
Esempio n. 16
0
void Window::resetToDefaultSize()
{
    setPosition(mDefaultX, mDefaultY);
    setSize(mDefaultWidth, mDefaultHeight);
    saveWindowState();
}
Esempio n. 17
0
  {
    QStringList gdalShares;
    QString appResources( QDir::cleanPath( QgsApplication::pkgDataPath() ) );
    gdalShares << QCoreApplication::applicationDirPath().append( "/share/gdal" )
    << appResources.append( "/share/gdal" )
    << appResources.append( "/gdal" );
    Q_FOREACH ( const QString& gdalShare, gdalShares )
    {
      if ( QFile::exists( gdalShare ) )
      {
        setenv( "GDAL_DATA", gdalShare.toUtf8().constData(), 1 );
        break;
      }
    }
  }
#endif

  QgsBrowser w;

  a.connect( &a, SIGNAL( aboutToQuit() ), &w, SLOT( saveWindowState() ) );
  w.restoreWindowState();

  w.show();

  a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );

  QgsEditorWidgetRegistry::initEditors();

  return a.exec();
}
Esempio n. 18
0
void MainWindow::closeEvent(QCloseEvent * event)
{
  saveWindowState();
  QMainWindow::closeEvent(event);
}