SyntroZigbeeGateway::SyntroZigbeeGateway(QSettings *settings, QWidget *parent, Qt::WFlags flags)
	: QMainWindow(parent, flags), m_settings(settings)
{
	ui.setupUi(this);
	initStatusBar();
	initStatTable();

	loadNodeIDList();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionConnect, SIGNAL(triggered()), this, SLOT(onConnect()));
	connect(ui.actionDisconnect, SIGNAL(triggered()), this, SLOT(onDisconnect()));
	connect(ui.actionConfigure, SIGNAL(triggered()), this, SLOT(onConfigure()));

	ui.actionDisconnect->setEnabled(false);

	m_controller = NULL;
	m_refreshTimer = 0;

	m_client = new ZigbeeGWClient(this, settings);
	m_client->resumeThread();

	m_syntroStatusTimer = startTimer(3000);

	restoreWindowState();
}
Beispiel #2
0
  DlgTerminate::DlgTerminate(QWidget *parent) : QDialog(parent)
  {
    QLabel* lblError = new QLabel(tr("A fatal error ocurred during initialization of <b>Impresario</b>. The application needs to be terminated."));
    lblError->setWordWrap(true);
    lblError->setTextFormat(Qt::RichText);
    QVBoxLayout* groupTextLayout = new QVBoxLayout();
    groupTextLayout->addWidget(lblError);
    QGroupBox* groupText = new QGroupBox();
    groupText->setLayout(groupTextLayout);

    QDialogButtonBox* buttonBox = new QDialogButtonBox();
    QPushButton* btnTerminate = new QPushButton(QIcon(":/icons/resources/quit.png"),tr("Quit"));
    QPushButton* btnAbout = new QPushButton(tr("About..."));
    buttonBox->addButton(btnAbout,QDialogButtonBox::HelpRole);
    buttonBox->addButton(btnTerminate,QDialogButtonBox::RejectRole);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(groupText);
    mainLayout->addWidget(new syslog::WndLogger(),1);
    mainLayout->addSpacing(5);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);

    setWindowTitle(tr("Impresario"));
    setWindowIcon(QIcon(":/icons/resources/impresario.png"));

    // set signal handlers
    connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(onAbout()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(close()));
  }
Beispiel #3
0
void MainWindow::createActions()
{
    openAction = new QAction(tr("打开文件"),this);
    connect(openAction,SIGNAL(triggered()),this,SLOT(onOpenFile()));
    openAction->setShortcut(QKeySequence::New);

    rgb2Gray = new QAction(tr("转换成灰度图片"),this);
    connect(rgb2Gray,SIGNAL(triggered()),this,SLOT(onRgb2Gray()));
    rgb2Gray->setEnabled(false);
    exitAction = new QAction(tr("退出"),this);
    exitAction->setShortcut(QKeySequence::Quit);
    connect(exitAction,SIGNAL(triggered()),this,SLOT(close()));

    histogramAction = new QAction(tr("灰度直方图"),this);
    connect(histogramAction,SIGNAL(triggered()),this,SLOT(onHistogramAction()));
    linerTransformAction = new QAction(tr("灰度的线性变换"),this);
    connect(linerTransformAction,SIGNAL(triggered()),this,SLOT(onLinearTransform()));
    extendAction = new QAction(tr("灰度拉伸"),this);
    connect(extendAction,SIGNAL(triggered()),this,SLOT(onGrayExtend()));
    equalAction = new QAction(tr("灰度均衡"),this);
    connect(equalAction,SIGNAL(triggered()),this,SLOT(onEqualAction()));
    thresholdAction = new QAction(tr("阈值变换"),this);
    connect(thresholdAction,SIGNAL(triggered()),this,SLOT(thresholdChangeAction()));

    translationAction = new QAction(tr("图像的平移 "),this);
    connect(translationAction,SIGNAL(triggered()),this,SLOT(onTranslationAction()));
    hMirroredAction = new QAction(tr("图像的水平镜像变换"),this);
    connect(hMirroredAction,SIGNAL(triggered()),this,SLOT(onHMirroredTran()));
    vMirroredAction = new QAction(tr("图像的垂直镜像变换"),this);
    connect(vMirroredAction,SIGNAL(triggered()),this,SLOT(onVMirroredTran()));
    transpositionAction = new QAction(tr("图像转置"),this);
    connect(transpositionAction,SIGNAL(triggered()),this,SLOT(onTranposition()));
    zoomAction = new QAction(tr("图像缩放"),this);
    connect(zoomAction,SIGNAL(triggered()),this,SLOT(onZoomImage()));


    smoothAction = new QAction(tr("图像平滑"),this);
    connect(smoothAction,SIGNAL(triggered()),this,SLOT(onSmoothOperation()));
    middleFilterAction = new QAction(tr("中值滤波"),this);
    connect(middleFilterAction,SIGNAL(triggered()),this,SLOT(onMiddleFilterAction()));
    gradientSharpenAction = new QAction(tr("梯度锐化"),this);
    connect(gradientSharpenAction,SIGNAL(triggered()),this,SLOT(onGradientSharpen()));
    laplaceSharpenAction = new QAction(tr("拉普拉斯锐化"),this);
    connect(laplaceSharpenAction,SIGNAL(triggered()),this,SLOT(onLaplaceSharpen()));

    roberts = new QAction(tr("Roberts算子"),this);
    connect(roberts,SIGNAL(triggered()),this,SLOT(onRobertsEdgeDect()));
    sobel = new QAction(tr("Sobel算子"),this);
    connect(sobel,SIGNAL(triggered()),this,SLOT(onSobelEdgeDect()));
    prewitt = new QAction(tr("prewitt算子"),this);
    connect(prewitt,SIGNAL(triggered()),this,SLOT(onPrewittEdgeDect()));
    krisch = new QAction(tr("krisch算子"),this);
    connect(krisch,SIGNAL(triggered()),this,SLOT(onKrischEdgeDect()));
//    gaslap = new QAction(tr("高斯拉普拉斯算子"),this);
//    connect(gaslap,SIGNAL(triggered()),this,SLOT(onGasLapEdgeDect()));
    aboutAuthorAction = new QAction(tr("作者"),this);
    connect(aboutAuthorAction,SIGNAL(triggered()),this,SLOT(onAbout()));
}
Beispiel #4
0
ToolBar::ToolBar(QWidget *parent) : QWidget(parent), _menu(_st.menu_image), _settings(_st.setting_image), _palette(_st.palette_image), _about(_st.about_image) {
	init();
	setLayout(&_main);

	QObject::connect(&_menu, SIGNAL(clicked()), this, SLOT(onMenu()));
	QObject::connect(&_settings, SIGNAL(clicked()), this, SLOT(onSetting()));
	QObject::connect(&_palette, SIGNAL(clicked()), this, SLOT(onPalette()));
	QObject::connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
}
Beispiel #5
0
TitleWidget::TitleWidget(MainWindow *window) : TWidget(window)
, wnd(window)
, hideLevel(0)
, hider(0)
, _back(this, st::titleBackButton, lang(lng_menu_back))
, _cancel(this, lang(lng_cancel), st::titleTextButton)
, _settings(this, lang(lng_menu_settings), st::titleTextButton)
, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
, _about(this, lang(lng_menu_about), st::titleTextButton)
, _lock(this, window)
, _update(this, window, lang(lng_menu_update))
, _minimize(this, window)
, _maximize(this, window)
, _restore(this, window)
, _close(this, window)
, _a_update(animation(this, &TitleWidget::step_update))
, lastMaximized(!(window->windowState() & Qt::WindowMaximized))
{
	setGeometry(0, 0, wnd->width(), st::titleHeight);
	setAttribute(Qt::WA_OpaquePaintEvent);
	_lock.hide();
	_update.hide();
    _cancel.hide();
    _back.hide();
	if (
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
		Sandbox::updatingState() == Application::UpdatingReady ||
#endif
		cHasPasscode()
	) {
		showUpdateBtn();
	}
	stateChanged();

	connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked()));
	connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings()));
	connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
	connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
	connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));

#ifndef TDESKTOP_DISABLE_AUTOUPDATE
	Sandbox::connect(SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));
#endif

    if (cPlatform() != dbipWindows) {
        _minimize.hide();
        _maximize.hide();
        _restore.hide();
        _close.hide();
    }
}
Beispiel #6
0
WindowMain::WindowMain(QWidget *parent) :
	QMainWindow(parent),
	m_ui(new Ui::WindowMain)
{
	/** Initialize the UI */
	m_ui->setupUi(this);

	/** Set the window title */
	setWindowTitle(PACKAGE_STRING);

	/** Connect the actions */
	connect(m_ui->actionAboutQt, SIGNAL(triggered()),
			qApp, SLOT(aboutQt()));
	connect(m_ui->actionAbout, SIGNAL(triggered()),
			this, SLOT(onAbout()));
	connect(m_ui->actionSettings, SIGNAL(triggered()),
			this, SLOT(onSettings()));
	connect(m_ui->actionQuit, SIGNAL(triggered()),
			this, SLOT(close()));
	connect(this, SIGNAL(next()),
			this, SLOT(onNext()));
	connect(this, SIGNAL(done()),
			this, SLOT(onEnd()));

	/** Initialize the settings */
	m_settings = new Settings(this);

	/** Create and setup the drop area */
	m_dropArea = new DropArea();
	connect(m_dropArea, SIGNAL(dropped(QList<QUrl>)),
			this, SLOT(onStart(QList<QUrl>)));
	setCentralWidget(m_dropArea);

	/** Initialize the status bar */
	m_ui->statusBar->setStyleSheet("QStatusBar::item {border: none;}");
	m_ui->statusBar->showMessage(tr("Ready"));

	/** Create the progress bar */
	m_progress = new QProgressBar();

	/** Create the allocine engine */
	m_allocine = new AllocineEngine();
	connect(m_allocine, SIGNAL(found(QList<AllocineResult*>)),
			this, SLOT(onFound(QList<AllocineResult*>)));
	connect(m_allocine, SIGNAL(fetched(AllocineResult*)),
			this, SLOT(onFetched(AllocineResult*)));
	connect(m_allocine, SIGNAL(error(QString)),
			this, SLOT(onError(QString)));

	/** Initialize the processing flag */
	m_processing = false;
}
Beispiel #7
0
void MainWindow::createActions()
{
	m_saveAction = new QAction(tr("S&ave"), this);
	m_saveAction->setShortcut(tr("CTRL+S"));
	connect(m_saveAction, SIGNAL(triggered()), this, SLOT(onSave()));

	m_exitAction = new QAction(tr("E&xit"), this);
	m_exitAction->setShortcuts(QKeySequence::Quit);
	m_exitAction->setStatusTip(tr("Quit Program"));
	connect(m_exitAction, SIGNAL(triggered()), this, SLOT(close()));

	m_aboutAction = new QAction(tr("A&bout"), this);
	m_aboutAction->setShortcut(tr("CTRL+B"));
	connect(m_aboutAction, SIGNAL(triggered()), this, SLOT(onAbout()));
}
void LteMainWindow::createActions()
{
    exitAction = new QAction(tr("Exit"), this);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));

    enableDebugAction = new QAction(tr("Enable Debug"), this);
    enableDebugAction->setCheckable(true);
    enableDebugAction->setChecked(false);
    connect(enableDebugAction, SIGNAL(triggered(bool)), this, SLOT(onEnableDebug(bool)));

    aboutAction = new QAction(tr("About"), this);
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(onAbout()));

    aboutQtAction = new QAction(tr("About Qt"), this);
    connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
}
Beispiel #9
0
SyntroStore::SyntroStore(QSettings *settings, QWidget *parent)
	: QMainWindow(parent), m_settings(settings)
{
	m_startingUp = true;
	ui.setupUi(this);

	m_storeStreamDlg = NULL;

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));

	initStatusBar();
	initDisplayStats();
	restoreWindowState();

	m_timerId = startTimer(2000);

	SyntroUtils::syntroAppInit(m_settings);
	m_client = new StoreClient(this, m_settings);
	setWindowTitle(QString("%1 - %2")
		.arg(m_settings->value(SYNTRO_PARAMS_APPNAME).toString())
		.arg(m_settings->value(SYNTRO_PARAMS_COMPTYPE).toString()));
	
	connect(this, SIGNAL(refreshStreamSource(int)), m_client, SLOT(refreshStreamSource(int)), Qt::QueuedConnection); 
	m_client->resumeThread();

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

		m_rxStreamTable->item(index, SYNTROSTORE_COL_STREAM)->setText(m_settings->value(SYNTROSTORE_PARAMS_STREAM_SOURCE).toString());
		if (m_settings->value(SYNTROSTORE_PARAMS_INUSE).toString() == SYNTRO_PARAMS_TRUE)
			m_useBox[index]->setCheckState(Qt::Checked);
		else
			m_useBox[index]->setCheckState(Qt::Unchecked);
	}
	m_settings->endArray();

	for (int index = 0; index < SYNTROSTORE_MAX_STREAMS; index++)
		emit refreshStreamSource(index);

	m_startingUp = false;
}
Beispiel #10
0
TitleWidget::TitleWidget(QWidget *parent) : TWidget(parent)
, _cancel(this, lang(lng_cancel), st::titleTextButton)
, _settings(this, lang(lng_menu_settings), st::titleTextButton)
, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
, _about(this, lang(lng_menu_about), st::titleTextButton)
, _lock(this)
, _update(this)
, _minimize(this)
, _maximize(this)
, _restore(this)
, _close(this)
, _a_update(animation(this, &TitleWidget::step_update))
, lastMaximized(!(parent->windowState() & Qt::WindowMaximized)) {
	setGeometry(0, 0, parent->width(), st::titleHeight);
	setAttribute(Qt::WA_OpaquePaintEvent);

	onWindowStateChanged();
	updateControlsVisibility();

	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked()));
	connect(&_settings, SIGNAL(clicked()), parent, SLOT(showSettings()));
	connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
	connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
	connect(parent->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(onWindowStateChanged(Qt::WindowState)));

#ifndef TDESKTOP_DISABLE_AUTOUPDATE
	Sandbox::connect(SIGNAL(updateReady()), this, SLOT(updateControlsVisibility()));
#endif // !TDESKTOP_DISABLE_AUTOUPDATE

	subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
	if (Media::Player::exists()) {
		subscribe(Media::Player::instance()->usePanelPlayer(), [this](bool usePanel) {
			updatePlayerButton(usePanel);
		});
	}

    if (cPlatform() != dbipWindows) {
        _minimize.hide();
        _maximize.hide();
        _restore.hide();
        _close.hide();
    }
}
Beispiel #11
0
TitleWidget::TitleWidget(Window *window)
	: QWidget(window)
	, wnd(window)
    , hideLevel(0)
    , hider(0)
	, _back(this, st::titleBackButton, lang(lng_menu_back))
	, _cancel(this, lang(lng_cancel), st::titleTextButton)
	, _settings(this, lang(lng_menu_settings), st::titleTextButton)
	, _contacts(this, lang(lng_menu_contacts), st::titleTextButton)
	, _about(this, lang(lng_menu_about), st::titleTextButton)
	, _update(this, window, lang(lng_menu_update))
	, _minimize(this, window)
	, _maximize(this, window)
	, _restore(this, window)
	, _close(this, window)
    , lastMaximized(!(window->windowState() & Qt::WindowMaximized))
{
	setGeometry(0, 0, wnd->width(), st::titleHeight);
	_update.hide();
    _cancel.hide();
    _back.hide();
	if (App::app()->updatingState() == Application::UpdatingReady) {
		showUpdateBtn();
	}
	stateChanged();

	connect(&_back, SIGNAL(clicked()), window, SLOT(hideSettings()));
	connect(&_cancel, SIGNAL(clicked()), this, SIGNAL(hiderClicked()));
	connect(&_settings, SIGNAL(clicked()), window, SLOT(showSettings()));
	connect(&_contacts, SIGNAL(clicked()), this, SLOT(onContacts()));
	connect(&_about, SIGNAL(clicked()), this, SLOT(onAbout()));
	connect(wnd->windowHandle(), SIGNAL(windowStateChanged(Qt::WindowState)), this, SLOT(stateChanged(Qt::WindowState)));
	connect(App::app(), SIGNAL(updateReady()), this, SLOT(showUpdateBtn()));

    if (cPlatform() != dbipWindows) {
        _minimize.hide();
        _maximize.hide();
        _restore.hide();
        _close.hide();
    }
}
Beispiel #12
0
void ConvertWindow::createToolbarAndMenu() {
	// action
	exitAction_ = new QAction(tr("E&xit"), this);
	exitAction_->setShortcut(tr("Ctrl+Q"));
	exitAction_->setStatusTip(tr("Exit the application"));
	connect(exitAction_, SIGNAL(triggered()), this, SLOT(close()));

	aboutAction_ = new QAction(tr("&About"), this);
	aboutAction_->setStatusTip(tr("Show the application's About box"));
	connect(aboutAction_, SIGNAL(triggered()), this, SLOT(onAbout()));

	aboutQtAction_ = new QAction(tr("About Qt"), this);
	aboutQtAction_->setStatusTip(tr("Show Qt's About box"));
	connect(aboutQtAction_, SIGNAL(triggered()), this, SLOT(onAboutQt()));

        convertAction_ = new QAction(QIcon(":/save.xml.png"), tr("Convert"), this);
	convertAction_->setShortcut(tr("F5"));
	convertAction_->setStatusTip(tr("Convert to MusicXml file"));
	connect(convertAction_, SIGNAL(triggered()), this, SLOT(onConvert()));

        convertAllAction_ = new QAction(QIcon(":/save.xmls.png"), tr("Convert All"), this);
	convertAllAction_->setShortcut(tr("F6"));
	convertAllAction_->setStatusTip(tr("Convert all to MusicXml file"));
	connect(convertAllAction_, SIGNAL(triggered()), this, SLOT(onConvertAll()));

	// menu
	fileMenu_ = menuBar()->addMenu(tr("&File"));
	fileMenu_->addAction(convertAction_);
	fileMenu_->addAction(convertAllAction_);
	fileMenu_->addAction(exitAction_);

	menuBar()->addSeparator();

	helpMenu = menuBar()->addMenu(tr("&Help"));
	helpMenu->addAction(aboutAction_);

	ui_.toolBar->addAction(convertAction_);
	ui_.toolBar->addAction(convertAllAction_);
}
Beispiel #13
0
void PsMainWindow::psFirstShow() {
	finished = false;

    psUpdateMargins();

	bool showShadows = true;

	show();
    _private.enableShadow(winId());
	if (cWindowPos().maximized) {
		setWindowState(Qt::WindowMaximized);
	}

	if ((cFromAutoStart() && cStartMinimized()) || cStartInTray()) {
		setWindowState(Qt::WindowMinimized);
		if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
			hide();
		} else {
			show();
		}
		showShadows = false;
	} else {
		show();
	}

	posInited = true;

	// init global menu
	QMenu *main = psMainMenu.addMenu(qsl("Telegram"));
	main->addAction(lng_mac_menu_about_telegram(lt_telegram, qsl("Telegram")), App::wnd()->getTitle(), SLOT(onAbout()))->setMenuRole(QAction::AboutQtRole);
	main->addSeparator();
	QAction *prefs = main->addAction(lang(lng_mac_menu_preferences), App::wnd(), SLOT(showSettings()), QKeySequence(Qt::ControlModifier | Qt::Key_Comma));
	prefs->setMenuRole(QAction::PreferencesRole);

	QMenu *file = psMainMenu.addMenu(lang(lng_mac_menu_file));
	psLogout = file->addAction(lang(lng_mac_menu_logout), App::wnd(), SLOT(onLogout()));

	QMenu *edit = psMainMenu.addMenu(lang(lng_mac_menu_edit));
	psUndo = edit->addAction(lang(lng_mac_menu_undo), this, SLOT(psMacUndo()), QKeySequence::Undo);
	psRedo = edit->addAction(lang(lng_mac_menu_redo), this, SLOT(psMacRedo()), QKeySequence::Redo);
	edit->addSeparator();
	psCut = edit->addAction(lang(lng_mac_menu_cut), this, SLOT(psMacCut()), QKeySequence::Cut);
	psCopy = edit->addAction(lang(lng_mac_menu_copy), this, SLOT(psMacCopy()), QKeySequence::Copy);
	psPaste = edit->addAction(lang(lng_mac_menu_paste), this, SLOT(psMacPaste()), QKeySequence::Paste);
	psDelete = edit->addAction(lang(lng_mac_menu_delete), this, SLOT(psMacDelete()), QKeySequence(Qt::ControlModifier | Qt::Key_Backspace));
	edit->addSeparator();
	psSelectAll = edit->addAction(lang(lng_mac_menu_select_all), this, SLOT(psMacSelectAll()), QKeySequence::SelectAll);

	QMenu *window = psMainMenu.addMenu(lang(lng_mac_menu_window));
	psContacts = window->addAction(lang(lng_mac_menu_contacts), App::wnd()->getTitle(), SLOT(onContacts()));
	psAddContact = window->addAction(lang(lng_mac_menu_add_contact), App::wnd(), SLOT(onShowAddContact()));
	window->addSeparator();
	psNewGroup = window->addAction(lang(lng_mac_menu_new_group), App::wnd(), SLOT(onShowNewGroup()));
	psNewChannel = window->addAction(lang(lng_mac_menu_new_channel), App::wnd(), SLOT(onShowNewChannel()));
	window->addSeparator();
	psShowTelegram = window->addAction(lang(lng_mac_menu_show), App::wnd(), SLOT(showFromTray()));

	psMacUpdateMenu();
}
Beispiel #14
0
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
 QmitkCommonWorkbenchWindowAdvisor::PostWindowCreate();
 // very bad hack...
 berry::IWorkbenchWindow::Pointer window =
  this->GetWindowConfigurer()->GetWindow();
 QMainWindow* mainWindow =
  static_cast<QMainWindow*> (window->GetShell()->GetControl());

 if (!windowIcon.empty())
 {
  mainWindow->setWindowIcon(QIcon(QString::fromStdString(windowIcon)));
 }
 mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);

 /*mainWindow->setStyleSheet("color: white;"
 "background-color: #808080;"
 "selection-color: #659EC7;"
 "selection-background-color: #808080;"
 " QMenuBar {"
 "background-color: #808080; }");*/

 // ==== Application menu ============================
 QMenuBar* menuBar = mainWindow->menuBar();
 menuBar->setContextMenuPolicy(Qt::PreventContextMenu);

 QMenu* fileMenu = menuBar->addMenu("&File");
 fileMenu->setObjectName("FileMenu");

 QAction* fileOpenAction = new QmitkExtFileOpenAction(QIcon(":/org.mitk.gui.qt.ext/Load_48.png"), window);
 fileMenu->addAction(fileOpenAction);
 fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
 fileSaveProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"));
 fileMenu->addAction(fileSaveProjectAction);
 closeProjectAction = new QmitkCloseProjectAction(window);
 closeProjectAction->setIcon(QIcon(":/org.mitk.gui.qt.ext/Remove_48.png"));
 fileMenu->addAction(closeProjectAction);
 fileMenu->addSeparator();
 QAction* fileExitAction = new QmitkFileExitAction(window);
 fileExitAction->setObjectName("QmitkFileExitAction");
 fileMenu->addAction(fileExitAction);

 berry::IViewRegistry* viewRegistry =
  berry::PlatformUI::GetWorkbench()->GetViewRegistry();
 const std::vector<berry::IViewDescriptor::Pointer>& viewDescriptors =
  viewRegistry->GetViews();

 // another bad hack to get an edit/undo menu...
 QMenu* editMenu = menuBar->addMenu("&Edit");
 undoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Undo_48.png"),
  "&Undo",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
  QKeySequence("CTRL+Z"));
 undoAction->setToolTip("Undo the last action (not supported by all modules)");
 redoAction = editMenu->addAction(QIcon(":/org.mitk.gui.qt.ext/Redo_48.png")
  , "&Redo",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
  QKeySequence("CTRL+Y"));
 redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");

 imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", NULL);
 bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");
 if (imageNavigatorViewFound)
 {
   QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
   imageNavigatorAction->setCheckable(true);

   // add part listener for image navigator
   imageNavigatorPartListener = new PartListenerForImageNavigator(imageNavigatorAction);
   window->GetPartService()->AddPartListener(imageNavigatorPartListener);
   berry::IViewPart::Pointer imageNavigatorView =
       window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
   imageNavigatorAction->setChecked(false);
   if (imageNavigatorView)
   {
     bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
     if (isImageNavigatorVisible)
       imageNavigatorAction->setChecked(true);
   }
   imageNavigatorAction->setToolTip("Open image navigator for navigating through image");
 }

 // toolbar for showing file open, undo, redo and other main actions
 QToolBar* mainActionsToolBar = new QToolBar;
 mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
 mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif

 mainActionsToolBar->addAction(fileOpenAction);
 mainActionsToolBar->addAction(fileSaveProjectAction);
 mainActionsToolBar->addAction(closeProjectAction);
 mainActionsToolBar->addAction(undoAction);
 mainActionsToolBar->addAction(redoAction);
 if (imageNavigatorViewFound)
 {
   mainActionsToolBar->addAction(imageNavigatorAction);
 }
 mainWindow->addToolBar(mainActionsToolBar);

#ifdef __APPLE__
 mainWindow->setUnifiedTitleAndToolBarOnMac(true);
#endif

 // ==== Window Menu ==========================
 QMenu* windowMenu = menuBar->addMenu("Window");
 if (showNewWindowMenuItem)
 {
   windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
   windowMenu->addSeparator();
 }

 QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");

 QMenu* viewMenu;
 if (showViewMenuItem)
 {
   viewMenu = windowMenu->addMenu("Show &View");
   viewMenu->setObjectName("Show View");
 }
 windowMenu->addSeparator();
 resetPerspAction = windowMenu->addAction("&Reset Perspective",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));

 if(showClosePerspectiveMenuItem)
  closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));

 windowMenu->addSeparator();
 windowMenu->addAction("&Preferences...",
  QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
  QKeySequence("CTRL+P"));

 // fill perspective menu
 berry::IPerspectiveRegistry* perspRegistry =
  window->GetWorkbench()->GetPerspectiveRegistry();
 QActionGroup* perspGroup = new QActionGroup(menuBar);

 std::vector<berry::IPerspectiveDescriptor::Pointer> perspectives(
  perspRegistry->GetPerspectives());

    bool skip = false;
    for (std::vector<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
      perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
    {

      // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
      // should not appear as an menu-entry in the perspective menu
      if (perspectiveExcludeList.size() > 0)
      {
        for (unsigned int i=0; i<perspectiveExcludeList.size(); i++)
        {
          if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
          {
            skip = true;
            break;
          }
        }
        if (skip)
        {
          skip = false;
          continue;
        }
      }

      QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
        *perspIt, perspGroup);
      mapPerspIdToAction.insert(std::make_pair((*perspIt)->GetId(), perspAction));
    }
 perspMenu->addActions(perspGroup->actions());

 // sort elements (converting vector to map...)
 std::vector<berry::IViewDescriptor::Pointer>::const_iterator iter;
 std::map<std::string, berry::IViewDescriptor::Pointer> VDMap;

 skip = false;
 for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
 {

   // if viewExcludeList is set, it contains the id-strings of view, which
   // should not appear as an menu-entry in the menu
   if (viewExcludeList.size() > 0)
   {
     for (unsigned int i=0; i<viewExcludeList.size(); i++)
     {
       if (viewExcludeList.at(i) == (*iter)->GetId())
       {
         skip = true;
         break;
       }
     }
     if (skip)
     {
       skip = false;
       continue;
     }
   }

  if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
   continue;
  if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
   continue;

  std::pair<std::string, berry::IViewDescriptor::Pointer> p(
   (*iter)->GetLabel(), (*iter));
  VDMap.insert(p);
 }
 // ==================================================

  // ==== Perspective Toolbar ==================================
 QToolBar* qPerspectiveToolbar = new QToolBar;

 if (showPerspectiveToolbar)
 {
  qPerspectiveToolbar->addActions(perspGroup->actions());
  mainWindow->addToolBar(qPerspectiveToolbar);
 }
 else
  delete qPerspectiveToolbar;

 // ==== View Toolbar ==================================
 QToolBar* qToolbar = new QToolBar;

 std::map<std::string, berry::IViewDescriptor::Pointer>::const_iterator
  MapIter;
 for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
 {
  berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
   (*MapIter).second);
  viewActions.push_back(viewAction);
  if(showViewMenuItem)
    viewMenu->addAction(viewAction);
  if (showViewToolbar)
  {
   qToolbar->addAction(viewAction);
  }
 }

 if (showViewToolbar)
 {
  mainWindow->addToolBar(qToolbar);
 }
 else
  delete qToolbar;

 QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
 mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());


 // ====================================================

 // ===== Help menu ====================================
 QMenu* helpMenu = menuBar->addMenu("Help");
 helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
  helpMenu->addAction("&Help Contents",this, SLOT(onHelp()),  QKeySequence("F1"));
 helpMenu->addAction("&About",this, SLOT(onAbout()));
 // =====================================================


 QStatusBar* qStatusBar = new QStatusBar();

 //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
 QmitkStatusBar *statusBar = new QmitkStatusBar(qStatusBar);
 //disabling the SizeGrip in the lower right corner
 statusBar->SetSizeGripEnabled(false);



 QmitkProgressBar *progBar = new QmitkProgressBar();

 qStatusBar->addPermanentWidget(progBar, 0);
 progBar->hide();
// progBar->AddStepsToDo(2);
// progBar->Progress(1);

 mainWindow->setStatusBar(qStatusBar);

 QmitkMemoryUsageIndicatorView* memoryIndicator =
  new QmitkMemoryUsageIndicatorView();
 qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
void MainWindow::createHelpMenu()
{
	QMenu* helpMenu = menuBar()->addMenu("&Help");
	QAction* aboutAction = helpMenu->addAction("&About");
	connect(aboutAction, SIGNAL(triggered()), this, SLOT(onAbout()));
}
Beispiel #16
0
SyntroReview::SyntroReview(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);

	layoutWindow();
	restoreWindowState();

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(m_slider, SIGNAL(sliderMoved(int)), this, SLOT(sliderMoved(int)));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));
	connect(ui.actionCFSSelection, SIGNAL(triggered()), this, SLOT(onCFSSelection()));
	connect(ui.actionAudioSetup, SIGNAL(triggered()), this, SLOT(onAudioSetup()));
	ui.actionOpen->setEnabled(false);
	ui.actionClose->setEnabled(false);
	ui.actionCFSSelection->setEnabled(false);

	SyntroUtils::syntroAppInit();

	m_audioSize = -1;
	m_audioRate = -1;
	m_audioChannels = -1;

#if defined(Q_OS_OSX) || defined(Q_OS_WIN32)
		m_audioOut = NULL;
		m_audioOutDevice = NULL;
#else
		m_audioOutIsOpen = false;
#endif

    QSettings *settings = SyntroUtils::getSettings();

    settings->beginGroup(AUDIO_GROUP);

    if (!settings->contains(AUDIO_OUTPUT_DEVICE))

#ifdef Q_OS_OSX
        settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE_MAC);
#else
#ifdef Q_OS_LINUX
        settings->setValue(AUDIO_OUTPUT_DEVICE, 0);

    if (!settings->contains(AUDIO_OUTPUT_CARD))
        settings->setValue(AUDIO_OUTPUT_CARD, 0);
#else
        settings->setValue(AUDIO_OUTPUT_DEVICE, AUDIO_DEFAULT_DEVICE);
#endif
#endif
    if (!settings->contains(AUDIO_ENABLE))
        settings->setValue(AUDIO_ENABLE, true);

	m_audioEnabled = settings->value(AUDIO_ENABLE).toBool();

	settings->endGroup();
	delete settings;
	m_client = new ReviewClient(this);
	connect(ui.actionOpen, SIGNAL(triggered()), this, SLOT(onOpen()));
	connect(ui.actionClose, SIGNAL(triggered()), this, SLOT(onClose()));
	connect(m_client, SIGNAL(newDirectory(QStringList)), this, SLOT(newDirectory(QStringList)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(showImage(QImage, QByteArray, unsigned int, QDateTime)), 
			this, SLOT(showImage(QImage, QByteArray, unsigned int, QDateTime)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newAudio(QByteArray, int, int, int)), this, SLOT(newAudio(QByteArray, int, int, int)));
	connect(m_client, SIGNAL(newCFSState(int)), this, SLOT(newCFSState(int)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newFileLength(unsigned int)), this, SLOT(newFileLength(unsigned int)), Qt::QueuedConnection);
	connect(this, SIGNAL(openFile(QString)), m_client, SLOT(openFile(QString)), Qt::QueuedConnection);
	connect(this, SIGNAL(closeFile()), m_client, SLOT(closeFile()), Qt::QueuedConnection);
	connect(this, SIGNAL(setPlayMode(int, bool)), m_client, SLOT(setPlayMode(int, bool)), Qt::QueuedConnection);
	connect(m_client, SIGNAL(newPlayMode(int)), this, SLOT(newPlayMode(int)), Qt::QueuedConnection);
	connect(this, SIGNAL(setFrameIndex(unsigned int, int, bool)), m_client, SLOT(setFrameIndex(unsigned int, int, bool)), Qt::QueuedConnection);

	connect(m_client, SIGNAL(dirResponse(QStringList)), this, SLOT(dirResponse(QStringList)));
	connect(this, SIGNAL(requestDir()), m_client, SLOT(requestDir()));
	connect(this, SIGNAL(newCFSList()), m_client, SLOT(newCFSList()));

	m_client->resumeThread();

	m_statusTimer = startTimer(2000);
	m_directoryTimer = startTimer(10000);

	setWindowTitle(QString("%1 - %2")
		.arg(SyntroUtils::getAppType())
		.arg(SyntroUtils::getAppName()));

	setDisabledPlayControls();
}
Beispiel #17
0
SyntroDB::SyntroDB()
	: QMainWindow()
{
	m_startingUp = true;
	ui.setupUi(this);

	m_storeStreamDlg = NULL;

	connect(ui.actionExit, SIGNAL(triggered()), this, SLOT(close()));
	connect(ui.actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));
	connect(ui.actionBasicSetup, SIGNAL(triggered()), this, SLOT(onBasicSetup()));
	connect(ui.actionConfiguration, SIGNAL(triggered()), this, SLOT(onConfiguration()));

	initStatusBar();
	initDisplayStats();
	restoreWindowState();

	SyntroUtils::syntroAppInit();
	startControlServer();

	setWindowTitle(QString("%1 - %2")
		.arg(SyntroUtils::getAppType())
		.arg(SyntroUtils::getAppName()));

	m_storeClient = new StoreClient(this);
	
    connect(this, SIGNAL(refreshStreamSource(int)),
        m_storeClient, SLOT(refreshStreamSource(int)), Qt::QueuedConnection);
    connect(m_storeClient, SIGNAL(running()),
        this, SLOT(storeRunning()), Qt::QueuedConnection);
    m_storeClient->resumeThread();

	m_CFSClient = new CFSClient(this);
	m_CFSClient->resumeThread();

	QSettings *settings = SyntroUtils::getSettings();

	settings->beginReadArray(SYNTRODB_PARAMS_STREAM_SOURCES);

	for (int index = 0; index < SYNTRODB_MAX_STREAMS; index++) {
		settings->setArrayIndex(index);

		QString source = settings->value(SYNTRODB_PARAMS_STREAM_SOURCE).toString();

		m_rxStreamTable->item(index, SYNTRODB_COL_STREAM)->setText(source);

		if (source.length() > 0) {
			if (settings->value(SYNTRODB_PARAMS_INUSE, SYNTRO_PARAMS_FALSE).toString() == SYNTRO_PARAMS_TRUE)
				m_useBox[index]->setCheckState(Qt::Checked);
			else
				m_useBox[index]->setCheckState(Qt::Unchecked);
		}
		else {
			m_useBox[index]->setCheckState(Qt::Unchecked);
		}
	}

	settings->endArray();

	m_startingUp = false;

	delete settings;

	m_timerId = startTimer(2000);
}
Beispiel #18
0
bool ViewerWindow::onCommand(WPARAM wParam, LPARAM lParam)
{
	if (HIWORD(wParam) == 1) {
		int transl = translateAccelToTB(LOWORD(wParam));

		if (transl != -1) {
			wParam = transl;
		}
	}
	switch (wParam) {
	case IDS_ABOUT_VIEWER:
		onAbout();
		return true;
	case IDS_TB_CONNOPTIONS:
		dialogConnectionOptions();
		return true;
	case IDS_TB_CONNINFO:
		dialogConnectionInfo();
		return true;
	case IDS_TB_PROCESSINFO:
		dialogProcessInfo();
		return true;
	case IDS_TB_PAUSE:
		commandPause();
		return true;
	case IDS_TB_REFRESH:
		m_viewerCore->refreshFrameBuffer();
		return true;
	case IDS_TB_CTRLALTDEL:
		commandCtrlAltDel();
		return true;
	case IDS_TB_CTRLESC:
		commandCtrlEsc();
		return true;
	case IDS_TB_CTRL:
		commandCtrl();
		return true;
	case IDS_TB_ALT:
		commandAlt();
		return true;
	case IDS_TB_TOOLBAR:
		commandToolBar();
		return true;
	case IDS_TB_TRANSFER:
		showFileTransferDialog();
		return true;
	case IDS_TB_NEWCONNECTION:
		commandNewConnection();
		return true;
	case IDS_TB_SAVESESSION:
		commandSaveSession();
		return true;
	case IDS_TB_SCALEIN:
		commandScaleIn();
		return true;
	case IDS_TB_SCALEOUT:
		commandScaleOut();
		return true;
	case IDS_TB_SCALE100:
		commandScale100();
		return true;
	case IDS_TB_SCALEAUTO:
		commandScaleAuto();
		return true;
	case IDS_TB_FULLSCREEN:
		switchFullScreenMode();
		return true;
	case IDS_TB_CONFIGURATION:
		dialogConfiguration();
		return true;
	}
	return false;
}
/** Constructor
@param parent
*/
QtSpacescapeMainWindow::QtSpacescapeMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::QtSpacescapeUI),
    mFilename(""),
    mLastExportDir(""),
    mLastOpenDir(""),
    mLastSaveDir(""),
    mRefreshing(false)
{
    // setup the ui
    ui->setupUi(this);

    // set the property manager to a variant type (changable/editable - not read only)
    mPropertyManager = new QtVariantPropertyManager();
    QtVariantEditorFactory *variantFactory = new QtVariantEditorFactory();
    ui->layerProperties->setFactoryForManager(mPropertyManager, variantFactory);
    ui->layerProperties->setPropertiesWithoutValueMarked(true);

    // we want the little arrows on root properties to indicate they're expandable
    ui->layerProperties->setRootIsDecorated(true);

    // set us as a progress listener
    ui->ogreWindow->setProgressListener(this);

    // add a signal for when properties are changed
    connect(mPropertyManager, SIGNAL(valueChanged(QtProperty *, const QVariant &)),
                this, SLOT(valueChanged(QtProperty *, const QVariant &)));

    // add a signal to detect when layer items change so we can update status bar
    // with a tip
    connect(ui->layerProperties, SIGNAL(currentItemChanged(QtBrowserItem*)),
            this,SLOT(currentItemChanged(QtBrowserItem*)));

    // add a signal for when the open menu item is selected
    connect(ui->action_Open, SIGNAL(triggered()), this, SLOT(onOpen()));

    // add a signal for when the save menu item is selected
    connect(ui->action_Save, SIGNAL(triggered()), this, SLOT(onSave()));

    // add a signal for when the save menu item is selected
    connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(onSaveAs()));

    // add a signal for when the about menu item is selected
    connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(onAbout()));

    
    mPropertyTitles["destBlendFactor"] = QString("Dest Blend Factor");
    mPropertyTitles["ditherAmount"] = QString("Dither Amount");
    mPropertyTitles["farColor"] = QString("Far Color");
    mPropertyTitles["gain"] = QString("Gain");
    mPropertyTitles["innerColor"] = QString("Inner Color");
    mPropertyTitles["lacunarity"] = QString("Lacunarity");
    mPropertyTitles["maskEnabled"] = QString("Mask Enabled");
    mPropertyTitles["maskGain"] = QString("Mask Gain");
    mPropertyTitles["maskInnerColor"] = QString("Mask Inner Color");
    mPropertyTitles["maskLacunarity"] = QString("Mask Lacunarity");
    mPropertyTitles["maskNoiseType"] = QString("Mask Noise Type");
    mPropertyTitles["maskOffset"] = QString("Mask Offset");
    mPropertyTitles["maskOctaves"] = QString("Mask Octaves");
    mPropertyTitles["maskOuterColor"] = QString("Mask Outer Color");
    mPropertyTitles["maskPower"] = QString("Mask Power");
    mPropertyTitles["maskScale"] = QString("Mask Noise Scale");
    mPropertyTitles["maskSeed"] = QString("Mask Random Seed");
    mPropertyTitles["maskThreshold"] = QString("Mask Threshold");
    mPropertyTitles["maxSize"] = QString("Max Billboard Size");
    mPropertyTitles["minSize"] = QString("Min Billboard Size");
    mPropertyTitles["name"] = QString("Layer Name");
    mPropertyTitles["nearColor"] = QString("Near Color");
    mPropertyTitles["noiseType"] = QString("Noise Type");
    mPropertyTitles["numBillboards"] = QString("Number of Billboards");
    mPropertyTitles["numPoints"] = QString("Number of Points");
    mPropertyTitles["octaves"] = QString("Octaves");
    mPropertyTitles["offset"] = QString("Noise Offset");
    mPropertyTitles["outerColor"] = QString("Outer Color");
    mPropertyTitles["pointSize"] = QString("Point Size");
    mPropertyTitles["powerAmount"] = QString("Power");
    mPropertyTitles["previewTextureSize"] = QString("Preview Texture Size");
    mPropertyTitles["texture"] = QString("Billboard Texture");
    mPropertyTitles["type"] = QString("Layer Type");
    mPropertyTitles["scale"] = QString("Noise Scale");
    mPropertyTitles["seed"] = QString("Random Seed");
    mPropertyTitles["shelfAmount"] = QString("Threshold");
    mPropertyTitles["sourceBlendFactor"] = QString("Source Blend Factor");
    mPropertyTitles["visible"] = QString("Layer Visible");
}
Beispiel #20
0
void SystemMenu::rebuildMenu(bool dockHiding)
{
	if (menu()) {
		menu()->clear();
	}
	
	QMenu *menu = new QMenu(this);

	about = new QAction("About this computer", this);
	menu->addAction(about);
	connect(about, SIGNAL(triggered()), this, SLOT(onAbout()));

/* TODO: Removed for now until I found clear way for managing software on different distros 
	QAction *software = new QAction("Software management ...", this);
	menu->addAction(software);
*/
	menu->addSeparator();

	QAction *pref = new QAction("System preferences ...", this);
	menu->addAction(pref);
	connect(pref, SIGNAL(triggered()), this, SLOT(onPreferences()));

	menu->addSeparator();

	if (dockHiding) {
		adock_on = new QAction("Turn Hiding Off", this);
	} else {
		int s = app->dock->dockState;
		if (s == Dockbar::Normal || s == Dockbar::Showing || s == Dockbar::AboutToShow) {
			adock_on = new QAction("Turn Hiding On", this);
		} else if (s == Dockbar::Hidden || s == Dockbar::Hiding) {
			adock_on = new QAction("Turn Hiding Off", this);
		}
	}
	//QAction *adock_magn = new QAction("Turn Magnification On", this);
	adock_pref = new QAction("Dock Preferences ...", this);
	QMenu *dock_menu = menu->addMenu("Dock");
	dock_menu->addAction(adock_on);
	connect(adock_on, SIGNAL(triggered()), this, SLOT(onShowHideDock()));
	connect(adock_pref, SIGNAL(triggered()), this, SLOT(onDockPref()));
	
	//dock_menu->addAction(adock_magn);
	dock_menu->addSeparator();
	dock_menu->addAction(adock_pref);

	menu->addSeparator();
	
/* TODO: Removed for now until I implement the features

	QAction *force_quit = new QAction("Force Quit ...", this);
	menu->addAction(force_quit);
	menu->addSeparator();
*/
	sleep = new QAction("Sleep", this);
	menu->addAction(sleep);
	connect(sleep, SIGNAL(triggered()), this, SLOT(onSleep()));

	restart = new QAction("Restart ...", this);
	menu->addAction(restart);
	connect(restart, SIGNAL(triggered()), this, SLOT(onRestart()));

	shutdown = new QAction("Shutdown ...", this);
	menu->addAction(shutdown);
	connect(shutdown, SIGNAL(triggered()), this, SLOT(onShutdown()));

	menu->addSeparator();
	logout = new QAction("Logout ...", this);
	menu->addAction(logout);
	connect(logout, SIGNAL(triggered()), this, SLOT(onLogout()));

	setMenu(menu);
	
	connect(this, SIGNAL(clicked()), this, SLOT(showMenu()));
}
BOOL LoginDialog::onCommand(UINT controlID, UINT notificationID)
{
  switch (controlID) {
  case IDC_CSERVER:
    switch (notificationID) {
    case CBN_DROPDOWN:
      updateHistory();
      break;

    // select item in ComboBox with list of history
    case CBN_SELENDOK:
      {
        int selectedItemIndex = m_server.getSelectedItemIndex();
        if (selectedItemIndex < 0) {
          return FALSE;
        }
        StringStorage server;
        m_server.getItemText(selectedItemIndex, &server);
        ConnectionConfigSM ccsm(RegistryPaths::VIEWER_PATH,
                                server.getString());
        m_connectionConfig.loadFromStorage(&ccsm);
        break;
      }
    }

    enableConnect();
    break;

  // click "Connect"
  case IDOK:
    onConnect();
    kill(0);
    break;

  // cancel connection
  case IDCANCEL:
    kill(0);
    break;

  case IDC_BCONFIGURATION:
    onConfiguration();
    break;

  case IDC_BOPTIONS:
    return onOptions();

  case IDC_LISTENING:
    onListening();
    kill(0);
    break;

  case IDC_ORDER_SUPPORT_BUTTON:
    onOrder();
    break;

  case IDC_BABOUT:
    onAbout();
    break;

  default:
    _ASSERT(true);
    return FALSE;
  }
  return TRUE;
}
void QmitkExtWorkbenchWindowAdvisor::PostWindowCreate()
{
  // very bad hack...
  berry::IWorkbenchWindow::Pointer window =
    this->GetWindowConfigurer()->GetWindow();
  QMainWindow* mainWindow =
    qobject_cast<QMainWindow*> (window->GetShell()->GetControl());

  if (!windowIcon.isEmpty())
  {
    mainWindow->setWindowIcon(QIcon(windowIcon));
  }
  mainWindow->setContextMenuPolicy(Qt::PreventContextMenu);

  /*mainWindow->setStyleSheet("color: white;"
  "background-color: #808080;"
  "selection-color: #659EC7;"
  "selection-background-color: #808080;"
  " QMenuBar {"
  "background-color: #808080; }");*/

  // Load selected icon theme

  QStringList searchPaths = QIcon::themeSearchPaths();
  searchPaths.push_front( QString(":/org_mitk_icons/icons/") );
  QIcon::setThemeSearchPaths( searchPaths );

  berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
  berry::IPreferences::Pointer stylePref = prefService->GetSystemPreferences()->Node(berry::QtPreferences::QT_STYLES_NODE);
  QString iconTheme = stylePref->Get(berry::QtPreferences::QT_ICON_THEME, "<<default>>");
  if( iconTheme == QString( "<<default>>" ) )
  {
    iconTheme = QString( "tango" );
  }
  QIcon::setThemeName( iconTheme );

  // ==== Application menu ============================

  QMenuBar* menuBar = mainWindow->menuBar();
  menuBar->setContextMenuPolicy(Qt::PreventContextMenu);

#ifdef __APPLE__
  menuBar->setNativeMenuBar(true);
#else
  menuBar->setNativeMenuBar(false);
#endif

  QAction* fileOpenAction = new QmitkFileOpenAction(QIcon::fromTheme("document-open",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-open.svg")), window);
  fileOpenAction->setShortcut(QKeySequence::Open);
  QAction* fileSaveAction = new QmitkFileSaveAction(QIcon(":/org.mitk.gui.qt.ext/Save_48.png"), window);
  fileSaveAction->setShortcut(QKeySequence::Save);
  fileSaveProjectAction = new QmitkExtFileSaveProjectAction(window);
  fileSaveProjectAction->setIcon(QIcon::fromTheme("document-save",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/document-save.svg")));
  closeProjectAction = new QmitkCloseProjectAction(window);
  closeProjectAction->setIcon(QIcon::fromTheme("edit-delete",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-delete.svg")));

  auto   perspGroup = new QActionGroup(menuBar);
  std::map<QString, berry::IViewDescriptor::Pointer> VDMap;

  // sort elements (converting vector to map...)
  QList<berry::IViewDescriptor::Pointer>::const_iterator iter;

  berry::IViewRegistry* viewRegistry =
    berry::PlatformUI::GetWorkbench()->GetViewRegistry();
  const QList<berry::IViewDescriptor::Pointer> viewDescriptors = viewRegistry->GetViews();

  bool skip = false;
  for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
  {
    // if viewExcludeList is set, it contains the id-strings of view, which
    // should not appear as an menu-entry in the menu
    if (viewExcludeList.size() > 0)
    {
      for (int i=0; i<viewExcludeList.size(); i++)
      {
        if (viewExcludeList.at(i) == (*iter)->GetId())
        {
          skip = true;
          break;
        }
      }
      if (skip)
      {
        skip = false;
        continue;
      }
    }

    if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
      continue;
    if ((*iter)->GetId() == "org.mitk.views.imagenavigator")
      continue;
    if ((*iter)->GetId() == "org.mitk.views.viewnavigatorview")
      continue;

    std::pair<QString, berry::IViewDescriptor::Pointer> p(
      (*iter)->GetLabel(), (*iter));
    VDMap.insert(p);
  }

  std::map<QString, berry::IViewDescriptor::Pointer>::const_iterator
    MapIter;
  for (MapIter = VDMap.begin(); MapIter != VDMap.end(); ++MapIter)
  {
    berry::QtShowViewAction* viewAction = new berry::QtShowViewAction(window,
      (*MapIter).second);
    viewActions.push_back(viewAction);
  }

  if (!USE_EXPERIMENTAL_COMMAND_CONTRIBUTIONS)
  {
    QMenu* fileMenu = menuBar->addMenu("&File");
    fileMenu->setObjectName("FileMenu");
    fileMenu->addAction(fileOpenAction);
    fileMenu->addAction(fileSaveAction);
    fileMenu->addAction(fileSaveProjectAction);
    fileMenu->addAction(closeProjectAction);
    fileMenu->addSeparator();

    QAction* fileExitAction = new QmitkFileExitAction(window);
    fileExitAction->setIcon(QIcon::fromTheme("system-log-out",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/system-log-out.svg")));
    fileExitAction->setShortcut(QKeySequence::Quit);
    fileExitAction->setObjectName("QmitkFileExitAction");
    fileMenu->addAction(fileExitAction);

    // another bad hack to get an edit/undo menu...
    QMenu* editMenu = menuBar->addMenu("&Edit");
    undoAction = editMenu->addAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
      "&Undo",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onUndo()),
      QKeySequence("CTRL+Z"));
    undoAction->setToolTip("Undo the last action (not supported by all modules)");
    redoAction = editMenu->addAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg"))
      , "&Redo",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onRedo()),
      QKeySequence("CTRL+Y"));
    redoAction->setToolTip("execute the last action that was undone again (not supported by all modules)");

    // ==== Window Menu ==========================
    QMenu* windowMenu = menuBar->addMenu("Window");
    if (showNewWindowMenuItem)
    {
      windowMenu->addAction("&New Window", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onNewWindow()));
      windowMenu->addSeparator();
    }

    QMenu* perspMenu = windowMenu->addMenu("&Open Perspective");

    QMenu* viewMenu;
    if (showViewMenuItem)
    {
      viewMenu = windowMenu->addMenu("Show &View");
      viewMenu->setObjectName("Show View");
    }
    windowMenu->addSeparator();
    resetPerspAction = windowMenu->addAction("&Reset Perspective",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onResetPerspective()));

    if(showClosePerspectiveMenuItem)
      closePerspAction = windowMenu->addAction("&Close Perspective", QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onClosePerspective()));

    windowMenu->addSeparator();
    windowMenu->addAction("&Preferences...",
      QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onEditPreferences()),
      QKeySequence("CTRL+P"));

    // fill perspective menu
    berry::IPerspectiveRegistry* perspRegistry =
      window->GetWorkbench()->GetPerspectiveRegistry();

    QList<berry::IPerspectiveDescriptor::Pointer> perspectives(
      perspRegistry->GetPerspectives());

    skip = false;
    for (QList<berry::IPerspectiveDescriptor::Pointer>::iterator perspIt =
      perspectives.begin(); perspIt != perspectives.end(); ++perspIt)
    {
      // if perspectiveExcludeList is set, it contains the id-strings of perspectives, which
      // should not appear as an menu-entry in the perspective menu
      if (perspectiveExcludeList.size() > 0)
      {
        for (int i=0; i<perspectiveExcludeList.size(); i++)
        {
          if (perspectiveExcludeList.at(i) == (*perspIt)->GetId())
          {
            skip = true;
            break;
          }
        }
        if (skip)
        {
          skip = false;
          continue;
        }
      }

      QAction* perspAction = new berry::QtOpenPerspectiveAction(window,
        *perspIt, perspGroup);
      mapPerspIdToAction.insert((*perspIt)->GetId(), perspAction);
    }
    perspMenu->addActions(perspGroup->actions());

    if (showViewMenuItem)
    {
      for (auto viewAction : viewActions)
      {
        viewMenu->addAction(viewAction);
      }
    }

    // ===== Help menu ====================================
    QMenu* helpMenu = menuBar->addMenu("&Help");
    helpMenu->addAction("&Welcome",this, SLOT(onIntro()));
    helpMenu->addAction("&Open Help Perspective", this, SLOT(onHelpOpenHelpPerspective()));
    helpMenu->addAction("&Context Help",this, SLOT(onHelp()),  QKeySequence("F1"));
    helpMenu->addAction("&About",this, SLOT(onAbout()));
    // =====================================================
  }
  else
  {
    //undoAction = new QAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")),
    //  "&Undo", nullptr);
    undoAction = new QmitkUndoAction(QIcon::fromTheme("edit-undo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-undo.svg")), nullptr);
    undoAction->setShortcut(QKeySequence::Undo);
    redoAction = new QmitkRedoAction(QIcon::fromTheme("edit-redo",QIcon(":/org_mitk_icons/icons/tango/scalable/actions/edit-redo.svg")), nullptr);
    redoAction->setShortcut(QKeySequence::Redo);
  }

  // toolbar for showing file open, undo, redo and other main actions
  auto   mainActionsToolBar = new QToolBar;
  mainActionsToolBar->setObjectName("mainActionsToolBar");
  mainActionsToolBar->setContextMenuPolicy(Qt::PreventContextMenu);
#ifdef __APPLE__
  mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextUnderIcon );
#else
  mainActionsToolBar->setToolButtonStyle ( Qt::ToolButtonTextBesideIcon );
#endif

  imageNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/Slider.png"), "&Image Navigator", nullptr);
  bool imageNavigatorViewFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.imagenavigator");

  if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
  {
    openDicomEditorAction = new QmitkOpenDicomEditorAction(QIcon(":/org.mitk.gui.qt.ext/dcm-icon.png"),window);
  }

  if (imageNavigatorViewFound)
  {
    QObject::connect(imageNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onImageNavigator()));
    imageNavigatorAction->setCheckable(true);

    // add part listener for image navigator
    imageNavigatorPartListener.reset(new PartListenerForImageNavigator(imageNavigatorAction));
    window->GetPartService()->AddPartListener(imageNavigatorPartListener.data());
    berry::IViewPart::Pointer imageNavigatorView =
      window->GetActivePage()->FindView("org.mitk.views.imagenavigator");
    imageNavigatorAction->setChecked(false);
    if (imageNavigatorView)
    {
      bool isImageNavigatorVisible = window->GetActivePage()->IsPartVisible(imageNavigatorView);
      if (isImageNavigatorVisible)
        imageNavigatorAction->setChecked(true);
    }
    imageNavigatorAction->setToolTip("Toggle image navigator for navigating through image");
  }

  viewNavigatorAction = new QAction(QIcon(":/org.mitk.gui.qt.ext/view-manager_48.png"),"&View Navigator", nullptr);
  viewNavigatorFound = window->GetWorkbench()->GetViewRegistry()->Find("org.mitk.views.viewnavigatorview");
  if (viewNavigatorFound)
  {
    QObject::connect(viewNavigatorAction, SIGNAL(triggered(bool)), QmitkExtWorkbenchWindowAdvisorHack::undohack, SLOT(onViewNavigator()));
    viewNavigatorAction->setCheckable(true);

    // add part listener for view navigator
    viewNavigatorPartListener.reset(new PartListenerForViewNavigator(viewNavigatorAction));
    window->GetPartService()->AddPartListener(viewNavigatorPartListener.data());
    berry::IViewPart::Pointer viewnavigatorview =
      window->GetActivePage()->FindView("org.mitk.views.viewnavigatorview");
    viewNavigatorAction->setChecked(false);
    if (viewnavigatorview)
    {
      bool isViewNavigatorVisible = window->GetActivePage()->IsPartVisible(viewnavigatorview);
      if (isViewNavigatorVisible)
        viewNavigatorAction->setChecked(true);
    }
    viewNavigatorAction->setToolTip("Toggle View Navigator");
  }

  mainActionsToolBar->addAction(fileOpenAction);
  mainActionsToolBar->addAction(fileSaveProjectAction);
  mainActionsToolBar->addAction(closeProjectAction);
  mainActionsToolBar->addAction(undoAction);
  mainActionsToolBar->addAction(redoAction);
  if(this->GetWindowConfigurer()->GetWindow()->GetWorkbench()->GetEditorRegistry()->FindEditor("org.mitk.editors.dicomeditor"))
  {
    mainActionsToolBar->addAction(openDicomEditorAction);
  }
  if (imageNavigatorViewFound)
  {
    mainActionsToolBar->addAction(imageNavigatorAction);
  }
  if (viewNavigatorFound)
  {
    mainActionsToolBar->addAction(viewNavigatorAction);
  }
  mainWindow->addToolBar(mainActionsToolBar);

  // ==== Perspective Toolbar ==================================
  auto   qPerspectiveToolbar = new QToolBar;
  qPerspectiveToolbar->setObjectName("perspectiveToolBar");

  if (showPerspectiveToolbar)
  {
    qPerspectiveToolbar->addActions(perspGroup->actions());
    mainWindow->addToolBar(qPerspectiveToolbar);
  }
  else
    delete qPerspectiveToolbar;

  // ==== View Toolbar ==================================
  auto   qToolbar = new QToolBar;
  qToolbar->setObjectName("viewToolBar");

  if (showViewToolbar)
  {
    mainWindow->addToolBar(qToolbar);

    for (auto viewAction : viewActions)
    {
      qToolbar->addAction(viewAction);
    }
  }
  else
    delete qToolbar;

  QSettings settings(GetQSettingsFile(), QSettings::IniFormat);
  mainWindow->restoreState(settings.value("ToolbarPosition").toByteArray());

  auto   qStatusBar = new QStatusBar();

  //creating a QmitkStatusBar for Output on the QStatusBar and connecting it with the MainStatusBar
  auto  statusBar = new QmitkStatusBar(qStatusBar);
  //disabling the SizeGrip in the lower right corner
  statusBar->SetSizeGripEnabled(false);

  auto  progBar = new QmitkProgressBar();

  qStatusBar->addPermanentWidget(progBar, 0);
  progBar->hide();
  // progBar->AddStepsToDo(2);
  // progBar->Progress(1);

  mainWindow->setStatusBar(qStatusBar);

  if (showMemoryIndicator)
  {
    auto   memoryIndicator = new QmitkMemoryUsageIndicatorView();
    qStatusBar->addPermanentWidget(memoryIndicator, 0);
  }
}
Beispiel #23
0
void MainWindow::addAboutAction(QMenu* menu)
{
	QAction* about = menu->addAction(tr("&About"));
	connect(about, SIGNAL(triggered()), this, SLOT(onAbout()));
}