Beispiel #1
0
void
App::loadStatusBar()
{
    //TODO maybe not use a statusbar for this
    QStatusBar *statusBar = _mainwindow->statusBar();
    QStringList players{"Human", "Random", "NegaMax", "NegaMaxWTt", "MTD-f"};

    _whiteCombo = new QComboBox();
    statusBar->addPermanentWidget(_whiteCombo);
    _whiteCombo->addItems(players);
    _whiteCombo->setCurrentIndex(4);
    connect(_whiteCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setWhitePlayer(int)));

    statusBar->addPermanentWidget(new QLabel("White"));

    statusBar->showMessage("Test");

    statusBar->addPermanentWidget(new QLabel("Black"));

    _blackCombo = new QComboBox();
    statusBar->addPermanentWidget(_blackCombo);
    _blackCombo->addItems(players);
    _blackCombo->setCurrentIndex(4);
    connect(_blackCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setBlackPlayer(int)));
}
Beispiel #2
0
/**
* @brief 构造函数
* @param [I] 平台指针
* @param [I] 父指针
* @param [I] 窗口标志
*/
MainWindow::MainWindow(Workbench *wb, QWidget *parent, Qt::WFlags flags)
    : QMainWindow(parent, flags)
    , ui(new Ui::MainWindowClass)
    , m_workbench(wb)
{
    ui->setupUi(this);
    m_messageWidget = MessageWidget::instance();
    m_messageWidget->setParent(this, Qt::Tool);

    QStatusBar *statusBar = this->statusBar();

	{
		QToolButton *button = new QToolButton(statusBar);
		button->setIcon(QApplication::style()->standardIcon(QStyle::SP_FileDialogDetailedView));
		button->setAutoRaise(true);
		connect(button, SIGNAL(clicked()), workbench(), SLOT(showDebugger()));
		statusBar->addPermanentWidget(button);
	}

    // 显示消息按钮
    {
        QToolButton *button = new QToolButton(statusBar);
        button->addAction(m_messageWidget->toggleAction());
        button->setDefaultAction(m_messageWidget->toggleAction());
        button->setAutoRaise(true);
        statusBar->addPermanentWidget(button);
    }
}
void QmitkWorkbenchWindowAdvisor::PostWindowCreate()
{
  // very bad hack...
  berry::IWorkbenchWindow::Pointer window = this->GetWindowConfigurer()->GetWindow();
  QMainWindow* mainWindow = static_cast<QMainWindow*>(window->GetShell()->GetControl());

  QMenuBar* menuBar = mainWindow->menuBar();

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

  fileMenu->addAction(new QmitkFileOpenAction(window));
  fileMenu->addSeparator();
  fileMenu->addAction(new QmitkFileExitAction(window));

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

  QMenu* viewMenu = menuBar->addMenu("Show &View");

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

  for (iter = viewDescriptors.begin(); iter != viewDescriptors.end(); ++iter)
  {
    if ((*iter)->GetId() == "org.blueberry.ui.internal.introview")
      continue;
    std::pair<std::string, berry::IViewDescriptor::Pointer> p((*iter)->GetLabel(), (*iter)); 
    VDMap.insert(p);
  }

  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);
    //m_ViewActions.push_back(viewAction);
    viewMenu->addAction(viewAction);
    qToolbar->addAction(viewAction);
  }
  
  mainWindow->addToolBar(qToolbar);

  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();
  mainWindow->setStatusBar(qStatusBar);

  QmitkMemoryUsageIndicatorView* memoryIndicator = new QmitkMemoryUsageIndicatorView();
  qStatusBar->addPermanentWidget(memoryIndicator, 0);
}
Beispiel #4
0
void CallWindow::initFooter()
{
	leftFooter = new QLabel();
	rightFooter = new QLabel();
	QStatusBar *bar = statusBar();
	bar->addPermanentWidget(leftFooter, 2);
	bar->addPermanentWidget(rightFooter, 2);
}
Beispiel #5
0
void db_key::newItem(QString name)
{
	NewKey *dlg = new NewKey(qApp->activeWindow(), name);
	QProgressBar *bar;
	QStatusBar *status = mainwin->statusBar();
	pki_evp *nkey = NULL;
	pki_scard *cardkey = NULL;
	pki_key *key = NULL;

	if (!dlg->exec()) {
		delete dlg;
		return;
	}
	int ksize = dlg->getKeysize();
	if (ksize > 0) {
		if (ksize < 32) {
			QMessageBox::warning(NULL, XCA_TITLE,
				tr("Key size too small !"));
			delete dlg;
			return;
		}
		if (ksize < 1024 || ksize > 8192)
			if (QMessageBox::warning(NULL, XCA_TITLE,
				tr("You are sure to create a key of the size: %1 ?").arg(ksize),
				QMessageBox::Yes | QMessageBox::No) !=
				QMessageBox::Yes)
			{
				delete dlg;
				return;
			}
	}
	mainwin->repaint();
	bar = new QProgressBar();
	status->addPermanentWidget(bar, 1);
	try {
		if (dlg->isToken()) {
			key = cardkey = new pki_scard(dlg->keyDesc->text());
			cardkey->generateKey_card(dlg->getKeyCardSlot(),
						 ksize, bar);
		} else {
			key = nkey = new pki_evp(dlg->keyDesc->text());
			nkey->generate(ksize, dlg->getKeytype(), bar,
				dlg->getKeyCurve_nid());
		}
		key = (pki_key*)insert(key);
		emit keyDone(key->getIntNameWithType());
		createSuccess(key);

	} catch (errorEx &err) {
		delete key;
		mainwin->Error(err);
	}
	status->removeWidget(bar);
	delete bar;
	delete dlg;
}
Beispiel #6
0
int StatusBar::addPermanentWidget(lua_State * L) // ( QWidget * widget, int stretch = 0 )
{
	QStatusBar* obj = ObjectHelper<QStatusBar>::check( L, 1);
	QWidget* widget = ObjectHelper<QWidget>::check( L, 2);
	int stretch = 0;
	if (Util::isNum( L, 3 ) )
	{
		if ( Util::toInt( L, 3 ) < 0 )
		{
			Util::error( L, "Starting No can not be negative" );
		}
		else
		{
			stretch = Util::toInt( L, 3 );
		}
	}
	obj->addPermanentWidget( widget, stretch ) ;
	return 0;
}
Beispiel #7
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    setWindowFlags(Qt::WindowCloseButtonHint);
    ui->setupUi(this);
    QStatusBar *statusBar = this->statusBar();
    QLabel *mode = new QLabel( tr("  Time  ") );
    mode->setMinimumSize( mode->sizeHint() );
    mode->setAlignment( Qt::AlignCenter );
    mode->setText( tr("Ready") );
    mode->setToolTip( tr("The current working mode.") );
    statusBar->addPermanentWidget( mode );

    connect(ui->tableWidget_resultat,SIGNAL(clicked(QModelIndex)),this,SLOT(modifierPatient(QModelIndex)));
    connect(ui->lineEdit_search,SIGNAL(editingFinished()),this,SLOT(on_btn_search_clicked()));

    this->setWidget();
    this->afficherRess();
    this->on_btn_search_clicked();

    statusBar->showMessage( tr("Ready!!"));
}
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{

    //    "([^"]+)"|(\S+)

    //    ""([^""]+)""|(\\S+)


    //WavSound *w = new WavSound(":/resources/connected.wav", 0);
    //w->play();
    //return;

    //PlaySound();
    //return;
    ui->setupUi(this);

    QApplication::setWindowIcon(QIcon(":/resources/Icon/RunningIcon.png"));

    strangerPrefsWindow = new StrangerPrefsWindow(this);

    //QDockWidget *drawdock = new QDockWidget(this,Qt::Dialog);
    //this->addDockWidget(Qt::RightDockWidgetArea,drawdock);

    /*CometClient *c = new CometClient(this);

    c->get("http://gggoogle.ru", 6);
    c->get("http://gggoogle.ru", 7);
    c->get("http://google.ru", 8);
    c->get("http://googleq.ru", 9);

    c->cancelAllRequests();
    return;
*/

    /*QHBoxLayout *dockLayout = new QHBoxLayout(this);
    QComboBox *b = new QComboBox(this);
    QTextEdit *t = new QTextEdit(this);
    dockLayout->addWidget(b);
    dockLayout->addWidget(t);
    dockLayout->setSizeConstraint(QLayout::SetMinimumSize);


    ui->dockWidgetContents_2->setLayout(dockLayout);
    */

    QWidget::setTabOrder(ui->typingBox, ui->chatlogBox);

    //do not allow Qt framework to intercept Tab keypress (we use it for switching modes)
    //ui->chatlogBox->setFocusPolicy(Qt::NoFocus);


    /*QFile stylesheetFile(":/resources/stylesheet.qss");
    if(!stylesheetFile.open(QFile::ReadOnly)) {
        qDebug() << "Error opening file " << stylesheetFile.error();
    }
    QString stylesheetString = QLatin1String(stylesheetFile.readAll());
    setStyleSheet(stylesheetString);
*/

    nightColoringMode = false;
    switchColoringMode(); //switch to night coloring mode, and apply it

    QStatusBar *sb = this->statusBar();
    chatModeLabel = new QLabel(this);
    //chatModeLabel = new QPushButton(this);
    //chatModeLabel->setFlat(true);

    sb->addPermanentWidget(chatModeLabel);
    typingLabel = new QLabel(this);
    sb->addPermanentWidget(typingLabel);

    //center the window
    setGeometry(QStyle::alignedRect(Qt::LeftToRight, Qt::AlignCenter, size(), qApp->desktop()->availableGeometry()));


    receivedMessageSound = NULL;
    sentMessageSound = NULL;
    connectedSound = NULL;
    disconnectedSound = NULL;
    receivedMessageSound = new QSound(":/resources/sounds/shuffle.wav", this);
    //sentMessageSound = new QSound(":/resources/sounds/test.wav", this);
    connectedSound = new QSound(":/resources/sounds/click1.wav", this);
    disconnectedSound = new QSound(":/resources/sounds/phone_disc.wav", this);

    //receivedMessageSound->setObjectName();

//return;


    QObject::connect(ui->typingBox, SIGNAL(enterPressed()), this, SLOT(enterPressed()));
    QObject::connect(ui->typingBox, SIGNAL(escapePressed()), this, SLOT(escapePressed()));    
    QObject::connect(ui->typingBox, SIGNAL(switchMode()), this, SLOT(SwitchMode()));
    QObject::connect(ui->typingBox, SIGNAL(typingStarted()), this, SLOT(TypingStarted()));
    QObject::connect(ui->typingBox, SIGNAL(typingStopped()), this, SLOT(TypingStopped()));
    QObject::connect(ui->typingBox, SIGNAL(showPreferences()), this, SLOT(displayStrangerPreferencesWindow()));
    QObject::connect(ui->typingBox, SIGNAL(switchColoringMode()), this, SLOT(switchColoringMode()));



    stranger = new Stranger(this);
    spy = new Spy(this);
    rusStranger = new RusStranger(this);

    //rusStranger->requestChatKey();
    //rusStranger->requestUid();





    QObject::connect(stranger, SIGNAL(ReceivedMessage(const QString &)), this, SLOT(ReceivedMessage(const QString &)));
    QObject::connect(stranger, SIGNAL(StrangerDisconnected()), this, SLOT(StrangerDisconnected()));
    QObject::connect(stranger, SIGNAL(ConversationStarted(QStringList, bool)), this, SLOT(StrangerConnected(QStringList, bool)));
    //QObject::connect(stranger, SIGNAL(ConversationStarted()), this, SLOT(StrangerConnected()));


    QObject::connect(stranger, SIGNAL(ConversationStartedWithQuestion(QString)), this, SLOT(StrangerConnectedWithQuestion(QString)));
    QObject::connect(stranger, SIGNAL(StrangerStartsTyping()), this, SLOT(StrangerStartsTyping()));
    QObject::connect(stranger, SIGNAL(StrangerStopsTyping()), this, SLOT(StrangerStopsTyping()));
    QObject::connect(stranger, SIGNAL(SystemMessage(const QString &)), this, SLOT(SystemMessage(const QString &)));
    QObject::connect(stranger, SIGNAL(WaitingForStranger()), this, SLOT(WaitingForStranger()));

    QObject::connect(spy, SIGNAL(ReceivedMessage(const QString &,const QString &)), this, SLOT(SpymodeReceivedMessage(const QString &,const QString &)));
    QObject::connect(spy, SIGNAL(StrangerDisconnected(const QString &)), this, SLOT(SpymodeStrangerDisconnected(const QString &)));
    QObject::connect(spy, SIGNAL(ConversationStarted()), this, SLOT(SpymodeStrangersConnected()));
    QObject::connect(spy, SIGNAL(ConversationStartedWithQuestion(QString)), this, SLOT(StrangerConnectedWithQuestion(QString)));
    QObject::connect(spy, SIGNAL(StrangerStartsTyping(QString)), this, SLOT(SpymodeStrangerStartsTyping(const QString &)));
    QObject::connect(spy, SIGNAL(StrangerStopsTyping()), this, SLOT(SpymodeStrangerStopsTyping(const QString &)));
    QObject::connect(spy, SIGNAL(SystemMessage(const QString &)), this, SLOT(SystemMessage(const QString &)));
    QObject::connect(spy, SIGNAL(WaitingForStranger()), this, SLOT(WaitingForStranger()));


    QObject::connect(rusStranger, SIGNAL(ReceivedMessage(const QString &)), this, SLOT(ReceivedMessage(const QString &)));
    QObject::connect(rusStranger, SIGNAL(StrangerDisconnected()), this, SLOT(StrangerDisconnected()));
    QObject::connect(rusStranger, SIGNAL(ConversationStarted()), this, SLOT(StrangerConnected()));
    QObject::connect(rusStranger, SIGNAL(StrangerStartsTyping()), this, SLOT(StrangerStartsTyping()));
    QObject::connect(rusStranger, SIGNAL(StrangerStopsTyping()), this, SLOT(StrangerStopsTyping()));
    QObject::connect(rusStranger, SIGNAL(WaitingForStranger()), this, SLOT(WaitingForStranger()));




    //chatMode = Russian;
    chatMode = AnsweringQuestions;
    SwitchMode(); //switch it to regular

    this->escapePressed();

    //strangerPrefsWindow->setModal(true);
    //strangerPrefsWindow->show();

}
Beispiel #9
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);
}
Beispiel #10
0
TazDlg::TazDlg(QWidget* pParent)
	: QMainWindow(pParent), m_settings("tobis_stuff", "takin"),
		m_pSettingsDlg(new SettingsDlg(this, &m_settings)),
		m_pStatusMsg(new QLabel(this)),
		m_pCoordQStatusMsg(new QLabel(this)),
		m_pCoordCursorStatusMsg(new QLabel(this)),
		m_sceneRecip(this),
		m_dlgRecipParam(this, &m_settings),
		m_dlgRealParam(this, &m_settings),
		m_pGotoDlg(new GotoDlg(this, &m_settings))
{
	//log_debug("In ", __func__, ".");

	const bool bSmallqVisible = 0;
	const bool bBZVisible = 1;
	const bool bWSVisible = 1;

	this->setupUi(this);
	this->setWindowTitle(s_strTitle.c_str());
	this->setFont(g_fontGen);
	this->setWindowIcon(load_icon("res/icons/takin.svg"));

	btnAtoms->setEnabled(g_bHasScatlens);

	if(m_settings.contains("main/geo"))
	{
		QByteArray geo = m_settings.value("main/geo").toByteArray();
		restoreGeometry(geo);
	}
	/*if(m_settings.contains("main/width") && m_settings.contains("main/height"))
	{
		int iW = m_settings.value("main/width").toInt();
		int iH = m_settings.value("main/height").toInt();
		resize(iW, iH);
	}*/

	m_pStatusMsg->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	m_pCoordQStatusMsg->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	m_pCoordCursorStatusMsg->setFrameStyle(QFrame::Panel | QFrame::Sunken);
	for(QLabel* pLabel : {m_pStatusMsg/*, m_pCoordQStatusMsg, m_pCoordCursorStatusMsg*/})
		pLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);

	QStatusBar *pStatusBar = new QStatusBar(this);
	pStatusBar->addWidget(m_pStatusMsg, 1);
	pStatusBar->addPermanentWidget(m_pCoordQStatusMsg, 0);
	pStatusBar->addPermanentWidget(m_pCoordCursorStatusMsg, 0);
	m_pCoordQStatusMsg->setMinimumWidth(350);
	m_pCoordQStatusMsg->setAlignment(Qt::AlignCenter);
	m_pCoordCursorStatusMsg->setMinimumWidth(325);
	m_pCoordCursorStatusMsg->setAlignment(Qt::AlignCenter);
	this->setStatusBar(pStatusBar);

	// --------------------------------------------------------------------------------

	m_vecEdits_real =
	{
		editA, editB, editC,
		editAlpha, editBeta, editGamma
	};
	m_vecEdits_recip =
	{
		editARecip, editBRecip, editCRecip,
		editAlphaRecip, editBetaRecip, editGammaRecip
	};

	m_vecEdits_plane =
	{
		editScatX0, editScatX1, editScatX2,
		editScatY0, editScatY1, editScatY2,

		editRealX0, editRealX1, editRealX2,
		editRealY0, editRealY1, editRealY2,
	};
	m_vecEdits_monoana =
	{
		editMonoD, editAnaD
	};

	//m_vecSpinBoxesSample = { spinRotPhi, spinRotTheta, spinRotPsi };
	m_vecCheckBoxesSenses = { checkSenseM, checkSenseS, checkSenseA };


	m_vecEditNames_real =
	{
		"sample/a", "sample/b", "sample/c",
		"sample/alpha", "sample/beta", "sample/gamma"
	};
	m_vecEditNames_recip =
	{
		"sample/a_recip", "sample/b_recip", "sample/c_recip",
		"sample/alpha_recip", "sample/beta_recip", "sample/gamma_recip"
	};
	m_vecEditNames_plane =
	{
		"plane/x0", "plane/x1", "plane/x2",
		"plane/y0", "plane/y1", "plane/y2",

		"plane/real_x0", "plane/real_x1", "plane/real_x2",
		"plane/real_y0", "plane/real_y1", "plane/real_y2",
	};
	m_vecEditNames_monoana =
	{
		"tas/mono_d", "tas/ana_d"
	};

	m_vecSpinBoxNamesSample = {"sample/phi", "sample/theta", "sample/psi"};
	m_vecCheckBoxNamesSenses = {"tas/sense_m", "tas/sense_s", "tas/sense_a"};


	// recip
	m_pviewRecip = new ScatteringTriangleView(groupRecip);
	groupRecip->addTab(m_pviewRecip, "Reciprocal Lattice");

	m_pviewProjRecip = new ProjLatticeView(groupRecip);
	groupRecip->addTab(m_pviewProjRecip, "Projection");

	m_pviewRecip->setScene(&m_sceneRecip);
	m_pviewProjRecip->setScene(&m_sceneProjRecip);

	if(m_settings.contains("main/recip_tab"))
		groupRecip->setCurrentIndex(m_settings.value("main/recip_tab").value<int>());


	// real
	m_pviewRealLattice = new LatticeView(groupReal);
	groupReal->addTab(m_pviewRealLattice, "Real Lattice");

	m_pviewReal = new TasLayoutView(groupReal);
	groupReal->addTab(m_pviewReal, "TAS Instrument");

	m_pviewTof = new TofLayoutView(groupReal);
	groupReal->addTab(m_pviewTof, "TOF Instrument");

	m_pviewRealLattice->setScene(&m_sceneRealLattice);
	m_pviewReal->setScene(&m_sceneReal);
	m_pviewTof->setScene(&m_sceneTof);

	if(m_settings.contains("main/real_tab"))
		groupReal->setCurrentIndex(m_settings.value("main/real_tab").value<int>());



	QObject::connect(m_pSettingsDlg, SIGNAL(SettingsChanged()), this, SLOT(SettingsChanged()));

	QObject::connect(&m_sceneReal, SIGNAL(nodeEvent(bool)), this, SLOT(RealNodeEvent(bool)));
	QObject::connect(&m_sceneRecip, SIGNAL(nodeEvent(bool)), this, SLOT(RecipNodeEvent(bool)));
	QObject::connect(&m_sceneTof, SIGNAL(nodeEvent(bool)), this, SLOT(TofNodeEvent(bool)));

	// TAS
	QObject::connect(&m_sceneRecip, SIGNAL(triangleChanged(const TriangleOptions&)),
		&m_sceneReal, SLOT(triangleChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneReal, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneRecip, SLOT(tasChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		&m_sceneReal, SLOT(recipParamsChanged(const RecipParams&)));

	// TOF
	QObject::connect(&m_sceneRecip, SIGNAL(triangleChanged(const TriangleOptions&)),
		&m_sceneTof, SLOT(triangleChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneTof, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneRecip, SLOT(tasChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		&m_sceneTof, SLOT(recipParamsChanged(const RecipParams&)));

	// connections between instruments
	QObject::connect(&m_sceneTof, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneReal, SLOT(triangleChanged(const TriangleOptions&)));
	QObject::connect(&m_sceneReal, SIGNAL(tasChanged(const TriangleOptions&)),
		&m_sceneTof, SLOT(triangleChanged(const TriangleOptions&)));

	// scale factor
	if(m_pviewRecip)
		QObject::connect(m_pviewRecip, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneRecip, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewProjRecip)
		QObject::connect(m_pviewProjRecip, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneProjRecip, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewRealLattice)
		QObject::connect(m_pviewRealLattice, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneRealLattice, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewReal)
		QObject::connect(m_pviewReal, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneReal, SLOT(scaleChanged(t_real_glob)));
	if(m_pviewTof)
		QObject::connect(m_pviewTof, SIGNAL(scaleChanged(t_real_glob)),
			&m_sceneTof, SLOT(scaleChanged(t_real_glob)));

	// parameter dialogs
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		&m_dlgRecipParam, SLOT(paramsChanged(const RecipParams&)));
	QObject::connect(&m_sceneReal, SIGNAL(paramsChanged(const RealParams&)),
		&m_dlgRealParam, SLOT(paramsChanged(const RealParams&)));

	// cursor position
	QObject::connect(&m_sceneRecip, SIGNAL(coordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)),
		this, SLOT(RecipCoordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)));
	QObject::connect(&m_sceneProjRecip, SIGNAL(coordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)),
		this, SLOT(RecipCoordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)));
	QObject::connect(&m_sceneRealLattice, SIGNAL(coordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)),
		this, SLOT(RealCoordsChanged(t_real_glob, t_real_glob, t_real_glob, bool, t_real_glob, t_real_glob, t_real_glob)));

	QObject::connect(&m_sceneRecip, SIGNAL(spurionInfo(const tl::ElasticSpurion&, const std::vector<tl::InelasticSpurion<t_real_glob>>&, const std::vector<tl::InelasticSpurion<t_real_glob>>&)),
		this, SLOT(spurionInfo(const tl::ElasticSpurion&, const std::vector<tl::InelasticSpurion<t_real_glob>>&, const std::vector<tl::InelasticSpurion<t_real_glob>>&)));

	QObject::connect(m_pGotoDlg, SIGNAL(vars_changed(const CrystalOptions&, const TriangleOptions&)),
		this, SLOT(VarsChanged(const CrystalOptions&, const TriangleOptions&)));
	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		m_pGotoDlg, SLOT(RecipParamsChanged(const RecipParams&)));

	QObject::connect(&m_sceneRecip, SIGNAL(paramsChanged(const RecipParams&)),
		this, SLOT(recipParamsChanged(const RecipParams&)));


	for(QLineEdit* pEdit : m_vecEdits_monoana)
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(UpdateDs()));

	for(QLineEdit* pEdit : m_vecEdits_real)
	{
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CheckCrystalType()));
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CalcPeaks()));
	}

	for(QLineEdit* pEdit : m_vecEdits_plane)
	{
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CalcPeaks()));
	}

	//for(QDoubleSpinBox* pSpin : m_vecSpinBoxesSample)
	//	QObject::connect(pSpin, SIGNAL(valueChanged(t_real)), this, SLOT(CalcPeaks()));

	for(QLineEdit* pEdit : m_vecEdits_recip)
	{
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CheckCrystalType()));
		QObject::connect(pEdit, SIGNAL(textEdited(const QString&)), this, SLOT(CalcPeaksRecip()));
	}

	QObject::connect(checkSenseM, SIGNAL(stateChanged(int)), this, SLOT(UpdateMonoSense()));
	QObject::connect(checkSenseS, SIGNAL(stateChanged(int)), this, SLOT(UpdateSampleSense()));
	QObject::connect(checkSenseA, SIGNAL(stateChanged(int)), this, SLOT(UpdateAnaSense()));

	QObject::connect(editSpaceGroupsFilter, SIGNAL(textEdited(const QString&)), this, SLOT(RepopulateSpaceGroups()));
	QObject::connect(comboSpaceGroups, SIGNAL(currentIndexChanged(int)), this, SLOT(SetCrystalType()));
	QObject::connect(comboSpaceGroups, SIGNAL(currentIndexChanged(int)), this, SLOT(CalcPeaks()));
	QObject::connect(checkPowder, SIGNAL(stateChanged(int)), this, SLOT(CalcPeaks()));

	QObject::connect(btnAtoms, SIGNAL(clicked(bool)), this, SLOT(ShowAtomsDlg()));



	// --------------------------------------------------------------------------------
	// file menu
	QMenu *pMenuFile = new QMenu("File", this);

	QAction *pNew = new QAction("New", this);
	pNew->setIcon(load_icon("res/icons/document-new.svg"));
	pMenuFile->addAction(pNew);

	pMenuFile->addSeparator();

	QAction *pLoad = new QAction("Load...", this);
	pLoad->setIcon(load_icon("res/icons/document-open.svg"));
	pMenuFile->addAction(pLoad);

	m_pMenuRecent = new QMenu("Recently Loaded", this);
	tl::RecentFiles recent(&m_settings, "main/recent");
	m_pMapperRecent = new QSignalMapper(m_pMenuRecent);
	QObject::connect(m_pMapperRecent, SIGNAL(mapped(const QString&)),
		this, SLOT(LoadFile(const QString&)));
	recent.FillMenu(m_pMenuRecent, m_pMapperRecent);
	pMenuFile->addMenu(m_pMenuRecent);

	QAction *pSave = new QAction("Save", this);
	pSave->setIcon(load_icon("res/icons/document-save.svg"));
	pMenuFile->addAction(pSave);

	QAction *pSaveAs = new QAction("Save as...", this);
	pSaveAs->setIcon(load_icon("res/icons/document-save-as.svg"));
	pMenuFile->addAction(pSaveAs);

	pMenuFile->addSeparator();

	QAction *pImport = new QAction("Import...", this);
	pImport->setIcon(load_icon("res/icons/drive-harddisk.svg"));
	pMenuFile->addAction(pImport);

	m_pMenuRecentImport = new QMenu("Recently Imported", this);
	tl::RecentFiles recentimport(&m_settings, "main/recent_import");
	m_pMapperRecentImport = new QSignalMapper(m_pMenuRecentImport);
	QObject::connect(m_pMapperRecentImport, SIGNAL(mapped(const QString&)),
		this, SLOT(ImportFile(const QString&)));
	recentimport.FillMenu(m_pMenuRecentImport, m_pMapperRecentImport);
	pMenuFile->addMenu(m_pMenuRecentImport);

	pMenuFile->addSeparator();

	QAction *pSettings = new QAction("Settings...", this);
	pSettings->setIcon(load_icon("res/icons/preferences-system.svg"));
	pMenuFile->addAction(pSettings);

	pMenuFile->addSeparator();

	QAction *pExit = new QAction("Exit", this);
	pExit->setIcon(load_icon("res/icons/system-log-out.svg"));
	pMenuFile->addAction(pExit);


	// --------------------------------------------------------------------------------
	// recip menu
	m_pMenuViewRecip = new QMenu("Reciprocal Space", this);

	m_pGoto = new QAction("Go to Position...", this);
	m_pGoto->setIcon(load_icon("res/icons/goto.svg"));
	m_pMenuViewRecip->addAction(m_pGoto);

	QAction *pRecipParams = new QAction("Information...", this);
	m_pMenuViewRecip->addAction(pRecipParams);
	m_pMenuViewRecip->addSeparator();

	m_pSmallq = new QAction("Show Reduced Scattering Vector q", this);
	m_pSmallq->setIcon(load_icon("res/icons/q.svg"));
	m_pSmallq->setCheckable(1);
	m_pSmallq->setChecked(bSmallqVisible);
	m_pMenuViewRecip->addAction(m_pSmallq);

	m_pSnapSmallq = new QAction("Snap G to Bragg Peak", this);
	m_pSnapSmallq->setCheckable(1);
	m_pSnapSmallq->setChecked(m_sceneRecip.getSnapq());
	m_pMenuViewRecip->addAction(m_pSnapSmallq);

	QAction *pKeepAbsKiKf = new QAction("Keep |ki| and |kf| Fixed", this);
	pKeepAbsKiKf->setCheckable(1);
	pKeepAbsKiKf->setChecked(m_sceneRecip.getKeepAbsKiKf());
	m_pMenuViewRecip->addAction(pKeepAbsKiKf);

	m_pBZ = new QAction("Show First Brillouin Zone", this);
	m_pBZ->setIcon(load_icon("res/icons/brillouin.svg"));
	m_pBZ->setCheckable(1);
	m_pBZ->setChecked(bBZVisible);
	m_pMenuViewRecip->addAction(m_pBZ);


	QMenu *pMenuEwald = new QMenu("Ewald Sphere", this);
	QActionGroup *pGroupEwald = new QActionGroup(this);
	m_pEwaldSphereNone = new QAction("Disabled", this);
	m_pEwaldSphereKi = new QAction("Around ki", this);
	m_pEwaldSphereKf = new QAction("Around kf", this);
	for(QAction* pAct : {m_pEwaldSphereNone, m_pEwaldSphereKi, m_pEwaldSphereKf})
	{
		pAct->setCheckable(1);
		pGroupEwald->addAction(pAct);
	}

	m_pEwaldSphereKf->setChecked(1);
	pMenuEwald->addActions(pGroupEwald->actions());
	m_pMenuViewRecip->addMenu(pMenuEwald);


	m_pMenuViewRecip->addSeparator();

	QMenu *pMenuProj = new QMenu("Projection", this);
	pMenuProj->setTearOffEnabled(1);
	QActionGroup *pGroupProj = new QActionGroup(this);

	m_pProjGnom = new QAction("Gnomonic", this);
	m_pProjStereo = new QAction("Stereographic", this);
	m_pProjPara = new QAction("Parallel", this);
	m_pProjPersp = new QAction("Perspectivic", this);

	for(QAction *pAct : {m_pProjGnom, m_pProjStereo, m_pProjPara, m_pProjPersp})
	{
		pAct->setCheckable(1);
		pGroupProj->addAction(pAct);
	}

	m_pProjStereo->setChecked(1);
	pMenuProj->addActions(pGroupProj->actions());

	m_pMenuViewRecip->addMenu(pMenuProj);

#if !defined NO_3D
	QAction *pView3D = new QAction("3D View...", this);
	//pView3D->setIcon(QIcon::fromTheme("applications-graphics"));
	m_pMenuViewRecip->addAction(pView3D);
#endif

	m_pMenuViewRecip->addSeparator();

	QAction *pRecipExport = new QAction("Export Lattice Graphics...", this);
	pRecipExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewRecip->addAction(pRecipExport);

	QAction *pProjExport = new QAction("Export Projection Graphics...", this);
	pProjExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewRecip->addAction(pProjExport);

#ifdef USE_GIL
	QAction *pBZExport = new QAction("Export Brillouin Zone Image...", this);
	pBZExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewRecip->addAction(pBZExport);
#endif


	// --------------------------------------------------------------------------------
	// real menu
	m_pMenuViewReal = new QMenu("Real Space", this);
	m_pMenuViewReal->addAction(m_pGoto);

	QAction *pRealParams = new QAction("Information...", this);
	m_pMenuViewReal->addAction(pRealParams);

	m_pMenuViewReal->addSeparator();

	m_pShowRealQDir = new QAction("Show Q Direction", this);
	m_pShowRealQDir->setCheckable(1);
	m_pShowRealQDir->setChecked(m_sceneReal.GetTasLayout()->GetRealQVisible());
	m_pMenuViewReal->addAction(m_pShowRealQDir);

	m_pWS = new QAction("Show Wigner-Seitz Cell", this);
	m_pWS->setIcon(load_icon("res/icons/brillouin.svg"));
	m_pWS->setCheckable(1);
	m_pWS->setChecked(bWSVisible);
	m_pMenuViewReal->addAction(m_pWS);

	m_pMenuViewReal->addSeparator();

#if !defined NO_3D
	QAction *pView3DReal = new QAction("3D View...", this);
	//pView3DReal->setIcon(QIcon::fromTheme("applications-graphics"));
	m_pMenuViewReal->addAction(pView3DReal);
	m_pMenuViewReal->addSeparator();
#endif

	QAction *pRealLatticeExport = new QAction("Export Lattice Graphics...", this);
	pRealLatticeExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pRealLatticeExport);

	QAction *pRealExport = new QAction("Export TAS Layout...", this);
	pRealExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pRealExport);

	QAction *pTofExport = new QAction("Export TOF Layout...", this);
	pTofExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pTofExport);

#ifdef USE_GIL
	QAction *pWSExport = new QAction("Export Wigner-Seitz Cell Image...", this);
	pWSExport->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pWSExport);
#endif

	QAction *pExportUC = new QAction("Export Unit Cell Model...", this);
	pExportUC->setIcon(load_icon("res/icons/image-x-generic.svg"));
	m_pMenuViewReal->addAction(pExportUC);


	// --------------------------------------------------------------------------------
	// resolution menu
	QMenu *pMenuReso = new QMenu("Resolution", this);

	QAction *pResoParams = new QAction("Parameters...", this);
	pResoParams->setIcon(load_icon("res/icons/accessories-calculator.svg"));
	pMenuReso->addAction(pResoParams);

	pMenuReso->addSeparator();

	QAction *pResoEllipses = new QAction("Ellipses...", this);
	pResoEllipses->setIcon(load_icon("res/icons/ellipses.svg"));
	pMenuReso->addAction(pResoEllipses);

#if !defined NO_3D
	QAction *pResoEllipses3D = new QAction("3D Ellipsoids...", this);
	pMenuReso->addAction(pResoEllipses3D);
#endif

	pMenuReso->addSeparator();

	QAction *pResoConv = new QAction("Convolution...", this);
	pMenuReso->addAction(pResoConv);


	// --------------------------------------------------------------------------------
	// calc menu
	QMenu *pMenuCalc = new QMenu("Calculation", this);

	QAction *pNeutronProps = new QAction("Neutron Properties...", this);
	pNeutronProps->setIcon(load_icon("res/icons/x-office-spreadsheet-template.svg"));
	pMenuCalc->addAction(pNeutronProps);

	pMenuCalc->addSeparator();

	QAction *pPowder = new QAction("Powder Lines...", this);
	pPowder->setIcon(load_icon("res/icons/weather-snow.svg"));
	pMenuCalc->addAction(pPowder);

	QAction *pDW = new QAction("Scattering Factors...", this);
	pMenuCalc->addAction(pDW);

	QAction *pFormfactor = nullptr;
	if(g_bHasFormfacts && g_bHasScatlens)
	{
		pFormfactor = new QAction("Form Factors...", this);
		pMenuCalc->addAction(pFormfactor);
	}

	QAction *pSgList = new QAction("Space Group Types...", this);
	pMenuCalc->addAction(pSgList);

	QAction *pDisp = new QAction("Dispersions...", this);
	//pDisp->setIcon(load_icon("disp.svg"));
	pMenuCalc->addAction(pDisp);

	pMenuCalc->addSeparator();

	QAction *pDynPlane = new QAction("Kinematic Plane...", this);
	pMenuCalc->addAction(pDynPlane);

	QAction *pSpuri = new QAction("Spurious Scattering...", this);
	pMenuCalc->addAction(pSpuri);


#if !defined NO_NET
	// --------------------------------------------------------------------------------
	// network menu
	QMenu *pMenuNet = new QMenu("Network", this);

	QAction *pConn = new QAction("Connect to Instrument...", this);
	pConn->setIcon(load_icon("res/icons/network-transmit-receive.svg"));
	pMenuNet->addAction(pConn);

	QAction *pDisconn = new QAction("Disconnect", this);
	pDisconn->setIcon(load_icon("res/icons/network-offline.svg"));
	pMenuNet->addAction(pDisconn);

	pMenuNet->addSeparator();

	QAction *pNetScanMon = new QAction("Scan Monitor...", this);
	pMenuNet->addAction(pNetScanMon);

	QAction *pNetCache = new QAction("Network Cache...", this);
	pMenuNet->addAction(pNetCache);

	QAction *pNetRefresh = new QAction("Refresh", this);
	pNetRefresh->setIcon(load_icon("res/icons/view-refresh.svg"));
	pMenuNet->addSeparator();
	pMenuNet->addAction(pNetRefresh);
#endif


	// --------------------------------------------------------------------------------
	// tools menu
	QMenu *pMenuTools = new QMenu("Tools", this);

	QAction *pScanViewer = new QAction("Scan Viewer...", this);
	pMenuTools->addAction(pScanViewer);



	// --------------------------------------------------------------------------------
	// help menu
	QMenu *pMenuHelp = new QMenu("Help", this);

	QAction *pHelp = new QAction("Show Help...", this);
	pHelp->setIcon(load_icon("res/icons/help-browser.svg"));
	pMenuHelp->addAction(pHelp);

	QAction *pDevelDoc = new QAction("Show Developer Help...", this);
	if(find_resource("doc/devel/html/index.html", 0) == "")
		pDevelDoc->setEnabled(0);
	pDevelDoc->setIcon(load_icon("res/icons/help-browser.svg"));
	pMenuHelp->addAction(pDevelDoc);

	pMenuHelp->addSeparator();

	QAction *pAboutQt = new QAction("About Qt...", this);
	//pAboutQt->setIcon(QIcon::fromTheme("help-about"));
	pMenuHelp->addAction(pAboutQt);

	//pMenuHelp->addSeparator();
	QAction *pAbout = new QAction("About Takin...", this);
	pAbout->setIcon(load_icon("res/icons/dialog-information.svg"));
	pMenuHelp->addAction(pAbout);



	// --------------------------------------------------------------------------------
	QMenuBar *pMenuBar = new QMenuBar(this);
	pMenuBar->addMenu(pMenuFile);
	pMenuBar->addMenu(m_pMenuViewRecip);
	pMenuBar->addMenu(m_pMenuViewReal);
	pMenuBar->addMenu(pMenuReso);
	pMenuBar->addMenu(pMenuCalc);
	pMenuBar->addMenu(pMenuTools);
#if !defined NO_NET
	pMenuBar->addMenu(pMenuNet);
#endif
	pMenuBar->addMenu(pMenuHelp);


	QObject::connect(pNew, SIGNAL(triggered()), this, SLOT(New()));
	QObject::connect(pLoad, SIGNAL(triggered()), this, SLOT(Load()));
	QObject::connect(pSave, SIGNAL(triggered()), this, SLOT(Save()));
	QObject::connect(pSaveAs, SIGNAL(triggered()), this, SLOT(SaveAs()));
	QObject::connect(pImport, SIGNAL(triggered()), this, SLOT(Import()));
	QObject::connect(pScanViewer, SIGNAL(triggered()), this, SLOT(ShowScanViewer()));
	QObject::connect(pSettings, SIGNAL(triggered()), this, SLOT(ShowSettingsDlg()));
	QObject::connect(pExit, SIGNAL(triggered()), this, SLOT(close()));

	QObject::connect(m_pSmallq, SIGNAL(toggled(bool)), this, SLOT(EnableSmallq(bool)));
	QObject::connect(m_pBZ, SIGNAL(toggled(bool)), this, SLOT(EnableBZ(bool)));
	QObject::connect(m_pWS, SIGNAL(toggled(bool)), this, SLOT(EnableWS(bool)));

	for(QAction* pAct : {m_pEwaldSphereNone, m_pEwaldSphereKi, m_pEwaldSphereKf})
		QObject::connect(pAct, SIGNAL(triggered()), this, SLOT(ShowEwaldSphere()));

	QObject::connect(m_pShowRealQDir, SIGNAL(toggled(bool)), this, SLOT(EnableRealQDir(bool)));

	QObject::connect(m_pSnapSmallq, SIGNAL(toggled(bool)), &m_sceneRecip, SLOT(setSnapq(bool)));
	QObject::connect(pKeepAbsKiKf, SIGNAL(toggled(bool)), &m_sceneRecip, SLOT(setKeepAbsKiKf(bool)));

	QObject::connect(pRecipParams, SIGNAL(triggered()), this, SLOT(ShowRecipParams()));
	QObject::connect(pRealParams, SIGNAL(triggered()), this, SLOT(ShowRealParams()));

	for(QAction *pProj : {m_pProjGnom, m_pProjStereo, m_pProjPara, m_pProjPersp})
		QObject::connect(pProj, SIGNAL(triggered()), this, SLOT(RecipProjChanged()));

#if !defined NO_3D
	QObject::connect(pView3D, SIGNAL(triggered()), this, SLOT(Show3D()));
	QObject::connect(pView3DReal, SIGNAL(triggered()), this, SLOT(Show3DReal()));
	QObject::connect(pResoEllipses3D, SIGNAL(triggered()), this, SLOT(ShowResoEllipses3D()));
#endif

	QObject::connect(pRecipExport, SIGNAL(triggered()), this, SLOT(ExportRecip()));
	QObject::connect(pProjExport, SIGNAL(triggered()), this, SLOT(ExportProj()));
	QObject::connect(pRealExport, SIGNAL(triggered()), this, SLOT(ExportReal()));
	QObject::connect(pTofExport, SIGNAL(triggered()), this, SLOT(ExportTof()));
	QObject::connect(pRealLatticeExport, SIGNAL(triggered()), this, SLOT(ExportRealLattice()));

	QObject::connect(pExportUC, SIGNAL(triggered()), this, SLOT(ExportUCModel()));

#ifdef USE_GIL
	QObject::connect(pBZExport, SIGNAL(triggered()), this, SLOT(ExportBZImage()));
	QObject::connect(pWSExport, SIGNAL(triggered()), this, SLOT(ExportWSImage()));
#endif

	QObject::connect(pResoParams, SIGNAL(triggered()), this, SLOT(ShowResoParams()));
	QObject::connect(pResoEllipses, SIGNAL(triggered()), this, SLOT(ShowResoEllipses()));
	QObject::connect(pResoConv, SIGNAL(triggered()), this, SLOT(ShowResoConv()));

	QObject::connect(pNeutronProps, SIGNAL(triggered()), this, SLOT(ShowNeutronDlg()));
	QObject::connect(m_pGoto, SIGNAL(triggered()), this, SLOT(ShowGotoDlg()));
	QObject::connect(pPowder, SIGNAL(triggered()), this, SLOT(ShowPowderDlg()));
	QObject::connect(pDisp, SIGNAL(triggered()), this, SLOT(ShowDispDlg()));
	QObject::connect(pSpuri, SIGNAL(triggered()), this, SLOT(ShowSpurions()));
	QObject::connect(pDW, SIGNAL(triggered()), this, SLOT(ShowDWDlg()));
	QObject::connect(pDynPlane, SIGNAL(triggered()), this, SLOT(ShowDynPlaneDlg()));

#if !defined NO_NET
	QObject::connect(pConn, SIGNAL(triggered()), this, SLOT(ShowConnectDlg()));
	QObject::connect(pDisconn, SIGNAL(triggered()), this, SLOT(Disconnect()));
	QObject::connect(pNetRefresh, SIGNAL(triggered()), this, SLOT(NetRefresh()));
	QObject::connect(pNetCache, SIGNAL(triggered()), this, SLOT(ShowNetCache()));
	QObject::connect(pNetScanMon, SIGNAL(triggered()), this, SLOT(ShowNetScanMonitor()));
#endif

	QObject::connect(pSgList, SIGNAL(triggered()), this, SLOT(ShowSgListDlg()));

	if(pFormfactor)
		QObject::connect(pFormfactor, SIGNAL(triggered()), this, SLOT(ShowFormfactorDlg()));

	QObject::connect(pHelp, SIGNAL(triggered()), this, SLOT(ShowHelp()));
	QObject::connect(pDevelDoc, SIGNAL(triggered()), this, SLOT(ShowDevelDoc()));
	QObject::connect(pAbout, SIGNAL(triggered()), this, SLOT(ShowAbout()));
	QObject::connect(pAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));


	setMenuBar(pMenuBar);
	// --------------------------------------------------------------------------------


	// --------------------------------------------------------------------------------
	// context menus
	if(m_pviewRecip) m_pviewRecip->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewProjRecip) m_pviewProjRecip->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewRealLattice) m_pviewRealLattice->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewReal) m_pviewReal->setContextMenuPolicy(Qt::CustomContextMenu);
	if(m_pviewTof) m_pviewTof->setContextMenuPolicy(Qt::CustomContextMenu);

	if(m_pviewRecip)
		QObject::connect(m_pviewRecip, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RecipContextMenu(const QPoint&)));
	if(m_pviewProjRecip)
		QObject::connect(m_pviewProjRecip, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RecipContextMenu(const QPoint&)));
	if(m_pviewRealLattice)
		QObject::connect(m_pviewRealLattice, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RealContextMenu(const QPoint&)));
	if(m_pviewReal)
		QObject::connect(m_pviewReal, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RealContextMenu(const QPoint&)));
	if(m_pviewTof)
		QObject::connect(m_pviewTof, SIGNAL(customContextMenuRequested(const QPoint&)),
			this, SLOT(RealContextMenu(const QPoint&)));


	// --------------------------------------------------------------------------------
	// tool bars
	QToolBar *pFileTools = new QToolBar(this);
	pFileTools->setWindowTitle("File");
	pFileTools->addAction(pNew);
	pFileTools->addAction(pLoad);
	pFileTools->addAction(pImport);
	pFileTools->addAction(pSave);
	pFileTools->addAction(pSaveAs);
	addToolBar(pFileTools);

	QToolBar *pRecipTools = new QToolBar(this);
	pRecipTools->setWindowTitle("Reciprocal Space");
	pRecipTools->addAction(m_pGoto);
	pRecipTools->addAction(m_pSmallq);
	pRecipTools->addAction(m_pBZ);
	//pRecipTools->addAction(m_pEwaldSphere);
	addToolBar(pRecipTools);

	QToolBar *pResoTools = new QToolBar(this);
	pResoTools->setWindowTitle("Resolution");
	pResoTools->addAction(pResoParams);
	pResoTools->addAction(pResoEllipses);
	addToolBar(pResoTools);

	QToolBar *pCalcTools = new QToolBar(this);
	pCalcTools->setWindowTitle("Calculation");
	pCalcTools->addAction(pNeutronProps);
	pCalcTools->addAction(pPowder);
	addToolBar(pCalcTools);

#if !defined NO_NET
	QToolBar *pNetTools = new QToolBar(this);
	pNetTools->setWindowTitle("Network");
	pNetTools->addAction(pConn);
	pNetTools->addAction(pDisconn);
	pNetTools->addAction(pNetRefresh);
	addToolBar(pNetTools);
#endif

	// --------------------------------------------------------------------------------


	RepopulateSpaceGroups();

	unsigned int iMaxPeaks = m_settings.value("main/max_peaks", 10).toUInt();

	m_sceneRecip.GetTriangle()->SetMaxPeaks(iMaxPeaks);
	m_sceneRecip.GetTriangle()->SetPlaneDistTolerance(s_dPlaneDistTolerance);

	m_sceneProjRecip.GetLattice()->SetMaxPeaks(iMaxPeaks/2);

	m_sceneRealLattice.GetLattice()->SetMaxPeaks(iMaxPeaks);
	m_sceneRealLattice.GetLattice()->SetPlaneDistTolerance(s_dPlaneDistTolerance);

#if !defined NO_3D
	if(m_pRecip3d)
	{
		m_pRecip3d->SetMaxPeaks((t_real)iMaxPeaks);
		m_pRecip3d->SetPlaneDistTolerance(s_dPlaneDistTolerance);
	}
#endif

	m_bReady = 1;
	UpdateDs();
	CalcPeaks();


	m_sceneRecip.GetTriangle()->SetqVisible(bSmallqVisible);
	m_sceneRecip.GetTriangle()->SetBZVisible(bBZVisible);
	m_sceneRecip.GetTriangle()->SetEwaldSphereVisible(EWALD_KF);
	m_sceneRealLattice.GetLattice()->SetWSVisible(bWSVisible);
	m_sceneRecip.emitUpdate();
	//m_sceneRecip.emitAllParams();

	setAcceptDrops(1);
}
ExternalHelpWindow::ExternalHelpWindow(QWidget *parent)
    : QMainWindow(parent)
{
    QSettings *settings = Core::ICore::settings();
    settings->beginGroup(QLatin1String(Help::Constants::ID_MODE_HELP));

    const QVariant geometry = settings->value(QLatin1String("geometry"));
    if (geometry.isValid())
        restoreGeometry(geometry.toByteArray());
    else
        resize(640, 480);

    settings->endGroup();

    QAction *action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_I));
    connect(action, SIGNAL(triggered()), this, SIGNAL(activateIndex()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_C));
    connect(action, SIGNAL(triggered()), this, SIGNAL(activateContents()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Slash));
    connect(action, SIGNAL(triggered()), this, SIGNAL(activateSearch()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_B));
    connect(action, SIGNAL(triggered()), this, SIGNAL(activateBookmarks()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_O));
    connect(action, SIGNAL(triggered()), this, SIGNAL(activateOpenPages()));
    addAction(action);

    CentralWidget *centralWidget = CentralWidget::instance();

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus));
    connect(action, SIGNAL(triggered()), centralWidget, SLOT(zoomIn()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus));
    connect(action, SIGNAL(triggered()), centralWidget, SLOT(zoomOut()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
    connect(action, SIGNAL(triggered()), this, SIGNAL(addBookmark()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
    connect(action, SIGNAL(triggered()), centralWidget, SLOT(copy()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
    connect(action, SIGNAL(triggered()), centralWidget, SLOT(print()));
    addAction(action);

    action = new QAction(this);
    action->setShortcut(QKeySequence::Back);
    action->setEnabled(centralWidget->isBackwardAvailable());
    connect(action, SIGNAL(triggered()), centralWidget, SLOT(backward()));
    connect(centralWidget, SIGNAL(backwardAvailable(bool)), action,
        SLOT(setEnabled(bool)));

    action = new QAction(this);
    action->setShortcut(QKeySequence::Forward);
    action->setEnabled(centralWidget->isForwardAvailable());
    connect(action, SIGNAL(triggered()), centralWidget, SLOT(forward()));
    connect(centralWidget, SIGNAL(forwardAvailable(bool)), action,
        SLOT(setEnabled(bool)));

    QAction *reset = new QAction(this);
    connect(reset, SIGNAL(triggered()), centralWidget, SLOT(resetZoom()));
    addAction(reset);

    QAction *ctrlTab = new QAction(this);
    connect(ctrlTab, SIGNAL(triggered()), &OpenPagesManager::instance(),
        SLOT(gotoPreviousPage()));
    addAction(ctrlTab);

    QAction *ctrlShiftTab = new QAction(this);
    connect(ctrlShiftTab, SIGNAL(triggered()), &OpenPagesManager::instance(),
        SLOT(gotoNextPage()));
    addAction(ctrlShiftTab);

    action = new QAction(QIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
        tr("Show Sidebar"), this);
    connect(action, SIGNAL(triggered()), this, SIGNAL(showHideSidebar()));

    if (Utils::HostOsInfo::isMacHost()) {
        reset->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
        action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
        ctrlTab->setShortcut(QKeySequence(Qt::ALT + Qt::Key_Tab));
        ctrlShiftTab->setShortcut(QKeySequence(Qt::ALT + Qt::SHIFT + Qt::Key_Tab));
    } else {
        reset->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_0));
        action->setShortcut(QKeySequence(Qt::ALT + Qt::Key_0));
        ctrlTab->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Tab));
        ctrlShiftTab->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab));
    }

    QToolButton *button = new QToolButton;
    button->setDefaultAction(action);

    QStatusBar *statusbar = statusBar();
    statusbar->show();
    statusbar->setProperty("p_styled", true);
    statusbar->addPermanentWidget(button);

    QWidget *w = new QWidget;
    QHBoxLayout *layout = new QHBoxLayout(w);
    layout->addStretch(1);
    statusbar->insertWidget(1, w, 1);

    installEventFilter(this);
    setWindowTitle(tr("Qt Creator Offline Help"));
}
Beispiel #12
0
MainWindow::MainWindow(Main * main) :
    mMain(main)
{
    setCorner( Qt::BottomLeftCorner, Qt::LeftDockWidgetArea );

    // Construct status bar:

    mLangStatus = new StatusLabel();
    mLangStatus->setText("Inactive");
    mSynthStatus = new StatusLabel();
    mSynthStatus->setText("Inactive");

    QStatusBar *status = statusBar();
    status->addPermanentWidget( new QLabel("Interpreter:") );
    status->addPermanentWidget( mLangStatus );
    status->addPermanentWidget( new QLabel("Synth:") );
    status->addPermanentWidget( mSynthStatus );

    // Code editor
    mEditors = new MultiEditor(main);

    // Docks
    mDocListDock = new DocumentsDock(main->documentManager(), this);
    mPostDock = new PostDock(this);

    // Layout

    // use a layout for tool widgets, to provide for separate margin control
    QVBoxLayout *tool_box = new QVBoxLayout;
    tool_box->addWidget(cmdLine());
    tool_box->setContentsMargins(5,2,5,2);

    QVBoxLayout *center_box = new QVBoxLayout;
    center_box->setContentsMargins(0,0,0,0);
    center_box->setSpacing(0);
    center_box->addWidget(mEditors);
    center_box->addLayout(tool_box);
    QWidget *central = new QWidget;
    central->setLayout(center_box);
    setCentralWidget(central);

    addDockWidget(Qt::LeftDockWidgetArea, mDocListDock);
    addDockWidget(Qt::BottomDockWidgetArea, mPostDock);

    // A system for easy evaluation of pre-defined code:
    connect(&mCodeEvalMapper, SIGNAL(mapped(QString)),
            this, SIGNAL(evaluateCode(QString)));
    connect(this, SIGNAL(evaluateCode(QString,bool)),
            main->scProcess(), SLOT(evaluateCode(QString,bool)));
    // Interpreter: post output
    connect(main->scProcess(), SIGNAL( scPost(QString) ),
            mPostDock->mPostWindow, SLOT( post(QString) ) );
    // Interpreter: monitor running state
    connect(main->scProcess(), SIGNAL( stateChanged(QProcess::ProcessState) ),
            this, SLOT( onInterpreterStateChanged(QProcess::ProcessState) ) );
    // Interpreter: forward status messages
    connect(main->scProcess(), SIGNAL(statusMessage(const QString&)),
            status, SLOT(showMessage(const QString&)));
    // Document list interaction
    connect(mDocListDock->list(), SIGNAL(clicked(Document*)),
            mEditors, SLOT(setCurrent(Document*)));
    connect(mEditors, SIGNAL(currentChanged(Document*)),
            mDocListDock->list(), SLOT(setCurrent(Document*)),
            Qt::QueuedConnection);

    createMenus();

    QIcon icon;
    icon.addFile(":/icons/sc-cube-128");
    icon.addFile(":/icons/sc-cube-48");
    icon.addFile(":/icons/sc-cube-32");
    icon.addFile(":/icons/sc-cube-16");
    QApplication::setWindowIcon(icon);
}
Beispiel #13
0
HPicSync::HPicSync(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::HPicSync),mOptionWidget(NULL),mThreadManager(this),mDirManager(mThreadManager,mDatabaseHandler,mOption),
      mThumbManager(mDatabaseHandler, mOption),mMoreThanOneSelected(false)

{
    ui->setupUi(this);

    ui->listWidgetNew->setItemDelegate(new HPSListViewDelegate(mOption.getThumbSize(),&mMoreThanOneSelected,this));
    ui->listWidgetOld->setItemDelegate(new HPSOldListDelegate(mOption.getThumbSize(),this));

    mDirManager.setModel( ui->comboBox->standardModel());
    initCBOrdner(mOption.getComboBoxView(),mOption.getComboBoxCurrentDir());


    QStatusBar *bar = ui->statusbar;
    mConnectLabel = new QLabel(tr("nicht verbunden"));
    mConnectPixGruenLabel = new QLabel();
    mConnectPixGruenLabel->setPixmap(QPixmap(":/knopfGruen").scaled(QSize(17,17),Qt::KeepAspectRatio));
    mConnectPixRotLabel = new QLabel();
    mConnectPixRotLabel->setPixmap(QPixmap(":/knopfRot").scaled(QSize(17,17),Qt::KeepAspectRatio));
    mBar = new HPSProgressBar;
    // this->mPixOldLoadCountLabel = new QLabel("");
    //this->mPixOldLoadCountLabel->setVisible(false);
    mBar->setVisible(false);
    mBar->setValue(0);
    mBar->setTextVisible(false);
    bar->addWidget(this->mConnectPixGruenLabel);
    bar->addWidget(this->mConnectPixRotLabel);
    bar->addWidget(this->mConnectLabel);
    bar->addPermanentWidget( mBar);
ui->progressBar->hide();
    /*
    this->connect(this->mCloseButton,SIGNAL(clicked()),this,SLOT(close()));
    this->connect(this->mOptionButton,SIGNAL(clicked()),this,SLOT(showOption()));
    this->connect(this->mRefreshButton,SIGNAL(clicked()),this,SLOT(test()));
    this->connect(this->mCopyButton,SIGNAL(clicked()),this,SLOT(test2()));

    connect(mPlusButton,SIGNAL(clicked()),this,SLOT(clickedPlus()));
    connect( &mThumbManager,SIGNAL(thumbsReady(int)),this,SLOT(refreshBar(int)));
    connect( &mThumbManager,SIGNAL(startThumbCreation(QString,int)),this,SLOT(initBar(QString,int)));
    connect( &mThumbManager,SIGNAL(dirCreationReady(QString)),&mDirManager,SLOT(finishAddDir(QString)));
    //connect( &mThumbManager,SIGNAL(startCreation()),this,SLOT(startBar()));
    connect( &mThumbManager,SIGNAL(creationReady()),this,SLOT(finishBar()));
    connect( mMinusButton,SIGNAL(clicked()),this,SLOT(clickedMinus()));

*/
    connect( ui->comboBox,SIGNAL(dirChanged(QString)),this,SLOT(comboBoxDirClicked(QString)));
    setGeometry(mOption.getGeometry());
    if(!mDatabaseHandler.openDatabase("picsync.db"))
        QMessageBox::critical(this, trUtf8("Fehler"), trUtf8("Verbindeung mit der Datenbank konnte nicht hergestellt werden."),QMessageBox::Ok);

    QDir dir( QApplication::applicationDirPath());
    if(!dir.exists(".thumbs")){
        dir.mkdir(".thumbs");
    }

    initThumbManager();
    qDebug() << Q_FUNC_INFO << mOption.dirFromDirlister();
    if(!mOption.dirFromDirlister().isEmpty()){
        mDirManager.startAddDir(mOption.dirFromDirlister(),true);
    }
    mThreadManager.initDirWatcher(mOption,mDirManager,mDatabaseHandler);
   HPSDirWatcher *dirWatcher =  mThreadManager.dirWatcher();
   connect(this,SIGNAL(startFirstRun()),dirWatcher,SLOT(startFirstRun()));
   emit startFirstRun();

}