コード例 #1
0
ファイル: MainWindow.cpp プロジェクト: Jokymon/qtnavigator
void MainWindow::create_actions()
{
	action_exit = new action::ExitApplication(this);
	connect(action_exit, SIGNAL(triggered()), this, SLOT(close()));

	action_toggle_fullscreen = new action::Fullscreen(this);
	connect(action_toggle_fullscreen, SIGNAL(showFullScreen()), this, SLOT(showFullScreen()));
	connect(action_toggle_fullscreen, SIGNAL(showNormal()), this, SLOT(showNormal()));

	action_about = new action::About(this);
	connect(action_about, SIGNAL(triggered()), this, SLOT(on_about()));

	action_about_qt = new action::AboutQt(this);
	connect(action_about_qt, SIGNAL(triggered()), this, SLOT(on_about_qt()));

	action_zoom_in = new action::ZoomIn(this);
	connect(action_zoom_in, SIGNAL(triggered()), map_widget, SLOT(zoom_in()));

	action_zoom_out = new action::ZoomOut(this);
	connect(action_zoom_out, SIGNAL(triggered()), map_widget, SLOT(zoom_out()));
}
コード例 #2
0
ファイル: mainobject.cpp プロジェクト: fg-hams/fgx
MainObject::MainObject(QObject *parent) :
	QObject(parent)
{

	//TODO Geoff to change this to object even static
	//= init the LOG file
	util_setStdLogFile();

	//= Preferences Object
	settings = new XSettings();
	debug_mode = settings->value("DEBUG_MODE","0").toBool();

	//= Settings Model
	X = new XSettingsModel(this);
	connect(X, SIGNAL(upx(QString,bool,QString)),
			this, SLOT(on_upx(QString,bool,QString))
	);


	//================================================================
	//= Processes - the nub..
	//================================================================
	processFgFs  = new XProcess(this, "fgfs");
	processTerraSync  = new XProcess(this, "terrasync");
	processFgCom  = new XProcess(this, "fgcom");



	//====================================
	//= Set GLobal style
	QApplication::setStyle( QStyleFactory::create(settings->style_current()) );
	//QApplication::setQuitOnLastWindowClosed(false);



	//=====================================================================================
	//== Tray Icon
	trayIcon = new QSystemTrayIcon(QIcon(":/icon/favicon"), this);
	trayIcon->setToolTip("FlightGear Launcher");
	trayIcon->setVisible(true);
	connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)),
			this, SLOT(on_tray_icon(QSystemTrayIcon::ActivationReason)));


	//== Tray Menu and actions
	popupMenu = new QMenu();
	trayIcon->setContextMenu(popupMenu);

	//== Callsign - label in a widget..
	actionCallsign = new QWidgetAction(this);
	lblCallsign = new QLabel();
	lblCallsign->setText("(your callsign)");
	lblCallsign->setStyleSheet("color: #000099; padding: 4px; font-weight: bold; background-color: white; border: 1px outset #cccccc;");
	actionCallsign->setDefaultWidget(lblCallsign);
	popupMenu->addAction(actionCallsign);

	//= Launcher Action
	actionLauncher = popupMenu->addAction(QIcon(":icon/favicon"), tr("Open Launcher..."));
	actionLauncher->setIconVisibleInMenu(true);
	connect(actionLauncher, SIGNAL(triggered()), this, SLOT(on_launcher()) );

	//= Browser MpMap action
	actionBrowserMap = popupMenu->addAction(QIcon(":icon/mpmap"), tr("Open Browser Map ..."));
	actionBrowserMap->setIconVisibleInMenu(true);
	connect(actionBrowserMap, SIGNAL(triggered()), this, SLOT(on_browsermap()));


	//== Properties browseer
	actionPropsBrowser = new QAction(this);
	actionPropsBrowser->setIcon(QIcon(":/icon/props"));
	actionPropsBrowser->setText(tr("Properties Browser..."));
	actionPropsBrowser->setIconVisibleInMenu(true);
	popupMenu->addAction(actionPropsBrowser);
	connect(actionPropsBrowser, SIGNAL(triggered()),
			this, SLOT(on_properties_browser())
	);

	popupMenu->addSeparator();


	//== View Logs
	actionViewLogs = new QAction(this);
	actionViewLogs->setIcon(QIcon(":/icon/log"));
	actionViewLogs->setText(tr("View Logs"));
	actionViewLogs->setIconVisibleInMenu(true);
	popupMenu->addAction(actionViewLogs);
	connect(actionViewLogs, SIGNAL(triggered()),
			this, SLOT(on_view_logs())
	);

	//== Fgx Debug Logs
	actionViewFgxDebug = new QAction(this);
	actionViewFgxDebug->setIcon(QIcon(":/icon/log"));
	actionViewFgxDebug->setText(tr("FGx Debug"));
	actionViewFgxDebug->setIconVisibleInMenu(true);
	popupMenu->addAction(actionViewFgxDebug);
	connect(actionViewFgxDebug, SIGNAL(triggered()),
			this, SLOT(on_view_fgx_debug())
	);

	//== Debug Enabled
	/*actionDebugMode = new QAction(this);
	actionDebugMode->setText(tr("Debug Mode"));
	actionDebugMode->setCheckable(true);
	actionDebugMode->setChecked(debug_mode);
	popupMenu->addAction(actionDebugMode);
	connect(actionDebugMode, SIGNAL(triggered()),
			this, SLOT(set_debug_mode())
	);*/


	popupMenu->addSeparator();


	//== Web Links
	QMenu *menuHelp = new QMenu(tr("Help"));
	popupMenu->addMenu(menuHelp);

	QActionGroup *actionGroupUrls = new QActionGroup(this);
	connect(actionGroupUrls, SIGNAL(triggered(QAction*)), this, SLOT(on_action_open_url(QAction*)));

	QAction *act = menuHelp->addAction(tr("Project Page"));
	act->setProperty("url", "http://code.google.com/p/fgx");
	actionGroupUrls->addAction(act);

	act = menuHelp->addAction(tr("Bugs and Issues"));
	act->setProperty("url", "http://code.google.com/p/fgx/issues/list");
	actionGroupUrls->addAction(act);

	act = menuHelp->addAction(tr("Source Code"));
	act->setProperty("url", "https://gitorious.org/fgx/fgx/");
	actionGroupUrls->addAction(act);

	menuHelp->addSeparator();

	menuHelp->addAction(tr("About FGx"), this, SLOT(on_about_fgx()));
	menuHelp->addAction(tr("About Qt"), this, SLOT(on_about_qt()));


	popupMenu->addSeparator();
	

	//== Quit
	actionQuit = popupMenu->addAction(QIcon(":/icon/quit"), tr("Quit"));
	actionQuit->setIconVisibleInMenu(true);
	connect(actionQuit, SIGNAL(triggered()), this, SLOT(on_quit()));

	//==================
	trayIcon->show();

	//connect(this, SIGNAL(show_settings(int)), this, SLOT(on_settings(int)));

	//== Props tree
	propertiesBrowser = new PropsTreeWidget(this);
	propertiesBrowser->hide();


	//= Log Viewer is hidden
	viewLogsWidget = new ViewLogsWidget(this);
	viewLogsWidget->hide();


	//= FGx Debug Widget
	fgxDebugWidget = new FgxDebugWidget(this);
	if(settings->value("fgx_debug_show_on_startup",0).toBool()){
		fgxDebugWidget->show();
	}
	
	launcherWindow = new LauncherWindow(this);
	//launcherWindow->hide();


	//== initialise after initial show so UI dont look frozen while cache loading etc
	QTimer::singleShot(300, this, SLOT(initialize()));
	

}