Exemplo n.º 1
0
	void CSTP::SetupToolbar ()
	{
		Toolbar_.reset (new QToolBar);
		Toolbar_->setWindowTitle ("CSTP");

		QAction *remove = Toolbar_->addAction (tr ("Remove"));
		connect (remove,
				SIGNAL (triggered ()),
				&Core::Instance (),
				SLOT (removeTriggered ()));
		remove->setProperty ("ActionIcon", "list-remove");

		QAction *removeAll = Toolbar_->addAction (tr ("Remove all"));
		connect (removeAll,
				SIGNAL (triggered ()),
				&Core::Instance (),
				SLOT (removeAllTriggered ()));
		removeAll->setProperty ("ActionIcon", "edit-clear-list");

		Toolbar_->addSeparator ();

		QAction *start = Toolbar_->addAction (tr ("Start"));
		connect (start,
				SIGNAL (triggered ()),
				&Core::Instance (),
				SLOT (startTriggered ()));
		start->setProperty ("ActionIcon", "media-playback-start");

		QAction *stop = Toolbar_->addAction (tr ("Stop"));
		connect (stop,
				SIGNAL (triggered ()),
				&Core::Instance (),
				SLOT (stopTriggered ()));
		stop->setProperty ("ActionIcon", "media-playback-stop");

		QAction *startAll = Toolbar_->addAction (tr ("Start all"));
		connect (startAll,
				SIGNAL (triggered ()),
				&Core::Instance (),
				SLOT (startAllTriggered ()));
		startAll->setProperty ("ActionIcon", "media-seek-forward");

		QAction *stopAll = Toolbar_->addAction (tr ("Stop all"));
		connect (stopAll,
				SIGNAL (triggered ()),
				&Core::Instance (),
				SLOT (stopAllTriggered ()));
		stopAll->setProperty ("ActionIcon", "media-record");
	}
Exemplo n.º 2
0
/*!
 * This is our default constructor, which creates a new menu bar populated with
 * the actions for our application.
 *
 * \param p The menu bar's parent widget.
 */
CSMainMenuBar::CSMainMenuBar(QWidget *p)
	: QMenuBar(p)
{
	// Initialize our dialog.

	aboutDialog = new CSAboutDialog(this);

	// Initialize the file menu.

	fileMenu = addMenu(tr("&File"));

	newCollectionAction = fileMenu->addAction(tr("&New Collection..."));
	newCollectionAction->setIcon(CSGUIUtils::getIconFromTheme("list-add"));
	newCollectionAction->setShortcut(Qt::CTRL + Qt::Key_N);
	newCollectionAction->setStatusTip(tr("Create a new collection"));

	syncAction = fileMenu->addAction(tr("&Sync..."));
	syncAction->setIcon(
		CSGUIUtils::getIconFromTheme("sync-synchronizing"));
	syncAction->setShortcut(Qt::CTRL + Qt::Key_S);
	syncAction->setStatusTip(tr("Sync two collections"));

	removeCollectionAction = fileMenu->addAction(
		tr("&Remove Collection..."));
	removeCollectionAction->setIcon(
		CSGUIUtils::getIconFromTheme("list-remove"));
	removeCollectionAction->setStatusTip(
		tr("Remove the current collection"));

	fileMenu->addSeparator();

	exitAction = fileMenu->addAction(tr("E&xit"));
	exitAction->setIcon(CSGUIUtils::getIconFromTheme("application-exit"));
	exitAction->setStatusTip(tr("Exit CuteSync"));

	// Initialize the settings menu.

	settingsMenu = addMenu(tr("&Settings"));

	resetSettingsAction = settingsMenu->addAction(tr("Reset Settings"));
	resetSettingsAction->setStatusTip(
		tr("Reset all saved data to its default state"));

	// Initialize the tools menu.

	toolsMenu = addMenu(tr("&Tools"));

	checkIPodAction = toolsMenu->addAction(tr("Check iPod Filesystem"));
	checkIPodAction->setStatusTip(
		tr("Check an iPod's filesystem for errors."));

	#ifdef CUTESYNC_DEBUG
		createIPodAction = toolsMenu->addAction(
			tr("Create Testing iPod"));
		createIPodAction->setStatusTip(
			tr("Create a false iPod for testing purposes."));
	#endif

	// Initialize the help menu.

	helpMenu = addMenu(tr("&Help"));

	aboutCuteSyncAction = helpMenu->addAction(tr("&About CuteSync..."));
	aboutCuteSyncAction->setIcon(
		CSGUIUtils::getIconFromTheme("help-about"));
	aboutCuteSyncAction->setStatusTip(
		tr("Display CuteSync's about dialog"));

	aboutQtAction = helpMenu->addAction(tr("About &Qt..."));
	aboutQtAction->setIcon(CSGUIUtils::getIconFromTheme("help-about"));
	aboutQtAction->setStatusTip(
		tr("Display the Qt library's about dialog"));

	// Connect actions.

	QObject::connect(newCollectionAction, SIGNAL(triggered()),
		this, SIGNAL(newTriggered()));
	QObject::connect(syncAction, SIGNAL(triggered()),
		this, SIGNAL(syncTriggered()));
	QObject::connect(removeCollectionAction, SIGNAL(triggered()),
		this, SIGNAL(removeTriggered()));
	QObject::connect(exitAction, SIGNAL(triggered()),
		this, SIGNAL(exitTriggered()));
	QObject::connect(resetSettingsAction, SIGNAL(triggered()),
		this, SIGNAL(resetSettingsTriggered()));
	QObject::connect(checkIPodAction, SIGNAL(triggered()),
		this, SIGNAL(checkIPodTriggered()));

	#ifdef CUTESYNC_DEBUG
		QObject::connect(createIPodAction, SIGNAL(triggered()),
			this, SIGNAL(createIPodTriggered()));
	#endif

	QObject::connect(aboutCuteSyncAction, SIGNAL(triggered()),
		this, SLOT(doAboutCuteSync()));
	QObject::connect(aboutQtAction, SIGNAL(triggered()),
		qApp, SLOT(aboutQt()));
}