Added new line at end of file to remove gcc warning
[mussa.git] / qui / threading / GuiProxy.cpp
1 #include <QThreadStorage>
2
3 #include "qui/threading/GuiProxy.hpp"
4 #include "qui/threading/ThreadManager.hpp"
5 #include <iostream>
6 GuiProxy::GuiProxy() :
7   master(this)
8 {
9 }
10
11 GuiProxy::GuiProxy(GuiProxy *master_) :
12   master(master_)
13 {
14   connect(this, SIGNAL(create_mussa_window_signal(GuiProxy *)),
15           master, SLOT(create_mussa_window(GuiProxy *)),
16           Qt::QueuedConnection);
17 }
18
19 void GuiProxy::create_mussa_window(MussaRef m)
20 {
21   if (this == master) {
22     MussaWindow *mw(new MussaWindow(m));
23     mw->show();
24     windows.push_back(mw);
25   } else {
26     if (!analysis) {
27       analysis = m;
28       emit create_mussa_window_signal(this);
29     }
30   }
31
32
33 void GuiProxy::create_mussa_window(GuiProxy *proxy) {
34   create_mussa_window(proxy->analysis);
35   proxy->analysis.reset();
36 }
37
38
39 void MussaWindowProxy(MussaRef m) {
40   GuiProxy *proxy = ThreadManager::get_gui_proxy();  
41   if (proxy) {
42     proxy->create_mussa_window(m);
43   } else {
44     std::cout << "no local proxy" << std::endl;
45   }
46 }
47     
48