Example #1
0
// Quit and save preference.
void quitLast() {
  if ( !noSound ) closeSound();
  savePreference();
  closeBarragemanager();
  closeSDL();
  SDL_Quit();
  exit(1);
}
ViewSwitcherDockWidget::ViewSwitcherDockWidget(const QString & title, QWidget * parent)
    : FDockWidget(title, parent)
{
	m_bitmap = NULL;
	m_viewSwitcher = NULL;
	m_within = true;

	bool floatFlag = true;
	QPoint initial(10,50);

#ifdef Q_WS_MAC
	initial.setY(34);
#else
	#ifdef Q_WS_X11
		floatFlag = false;
		initial.setY(60);
	#else
		#ifdef Q_WS_WIN
			OSVERSIONINFO OSversion;	
			OSversion.dwOSVersionInfoSize=sizeof(OSVERSIONINFO);
			::GetVersionEx(&OSversion);
			//DebugDialog::debug(QString("windows os version %1 %2").arg(OSversion.dwMajorVersion).arg(OSversion.dwMinorVersion));
			if (OSversion.dwMajorVersion > 5) {
				// vista and win 7 major version is 6
                initial.setX(12);
                initial.setY(60);
			}
		#endif
	#endif
#endif

	setFloating(floatFlag);
	m_offsetFromParent.setX(initial.x());
	m_offsetFromParent.setY(initial.y());

	// connect last so they doesn't trigger during construction
	connect(this, SIGNAL(topLevelChanged(bool)), this, SLOT(topLevelChangedSlot(bool)));
	connect(toggleViewAction(), SIGNAL(triggered()), this, SLOT(savePreference()), Qt::DirectConnection);
}
void ViewSwitcherDockWidget::topLevelChangedSlot(bool topLevel) {
	topLevelChangedSlotAux(topLevel);
	savePreference();
}