QXRD  0.11.16
Public Slots | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
QxrdWelcomeWindow Class Reference

#include <qxrdwelcomewindow.h>

Inheritance diagram for QxrdWelcomeWindow:
Inheritance graph
[legend]
Collaboration diagram for QxrdWelcomeWindow:
Collaboration graph
[legend]

Public Slots

void displayMessage (QString msg)
 
void clearStatusMessage ()
 

Public Member Functions

 QxrdWelcomeWindow (QxrdApplication *app)
 
 ~QxrdWelcomeWindow ()
 
void appendRecentExperiment (QString title)
 
void possiblyClose ()
 
bool wantToClose ()
 
void closeEvent (QCloseEvent *event)
 
void readSettings (QSettings *settings, QString section)
 
void writeSettings (QSettings *settings, QString section)
 

Protected Member Functions

void changeEvent (QEvent *e)
 

Private Slots

void populateRecentExperimentsMenu ()
 
void openMostRecent ()
 

Private Member Functions

void setupRecentExperimentsMenu (QAction *action)
 

Private Attributes

Ui::QxrdWelcomeWindow * ui
 
QxrdApplicationm_Application
 
int m_InsertRow
 
QSignalMapper m_SignalMapper
 
QLabel * m_StatusMsg
 
QTimer m_StatusTimer
 
QMenu * m_RecentExperimentsMenu
 

Detailed Description

Definition at line 13 of file qxrdwelcomewindow.h.

Constructor & Destructor Documentation

QxrdWelcomeWindow::QxrdWelcomeWindow ( QxrdApplication app)
explicit

Definition at line 9 of file qxrdwelcomewindow.cpp.

References appendRecentExperiment(), QxrdApplication::chooseExistingExperiment(), QxrdApplication::chooseNewExperiment(), clearStatusMessage(), QxrdApplication::editGlobalPreferences(), m_Application, m_SignalMapper, m_StatusMsg, m_StatusTimer, QxrdApplication::openRecentExperiment(), QxrdApplication::possiblyQuit(), setupRecentExperimentsMenu(), and ui.

9  :
10  QMainWindow(NULL),
11  ui(new Ui::QxrdWelcomeWindow),
12  m_Application(app),
13  m_InsertRow(5),
14  m_SignalMapper(NULL),
16 {
17  ui->setupUi(this);
18 
19  m_StatusMsg = new QLabel(NULL);
20  m_StatusMsg -> setMinimumWidth(500);
21  m_StatusMsg -> setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
22  m_StatusMsg -> setToolTip(tr("Status Messages"));
23 
24  statusBar() -> addPermanentWidget(m_StatusMsg);
25 
26  connect(&m_StatusTimer, &QTimer::timeout, this, &QxrdWelcomeWindow::clearStatusMessage);
27 
28  connect(ui->m_ActionEditApplicationPreferences, &QAction::triggered, m_Application, &QxrdApplication::editGlobalPreferences);
29  connect(ui->m_ActionNewExperiment, &QAction::triggered, m_Application, &QxrdApplication::chooseNewExperiment);
30  connect(ui->m_ActionOpenExperiment, &QAction::triggered, m_Application, &QxrdApplication::chooseExistingExperiment);
31  connect(ui->m_ActionExitApplication, &QAction::triggered, m_Application, &QxrdApplication::possiblyQuit);
32 
33  connect(ui->m_NewExperiment, &QAbstractButton::clicked, ui->m_ActionNewExperiment, &QAction::trigger);
34  connect(ui->m_OpenExistingExperiment, &QAbstractButton::clicked, ui->m_ActionOpenExperiment, &QAction::trigger);
35 
36  connect(&m_SignalMapper, (void (QSignalMapper::*)(const QString&)) &QSignalMapper::mapped,
38 
39  QStringList recents = m_Application->get_RecentExperiments();
40 
41  foreach (QString recent, recents) {
42  appendRecentExperiment(recent);
43  }
44 
45  setupRecentExperimentsMenu(ui->m_ActionOpenRecentExperiment);
46 }
QxrdApplication * m_Application
void setupRecentExperimentsMenu(QAction *action)
Ui::QxrdWelcomeWindow * ui
void chooseExistingExperiment()
void appendRecentExperiment(QString title)
void openRecentExperiment(QString path)
QSignalMapper m_SignalMapper
QMenu * m_RecentExperimentsMenu

Here is the call graph for this function:

QxrdWelcomeWindow::~QxrdWelcomeWindow ( )

Definition at line 48 of file qxrdwelcomewindow.cpp.

References ui.

49 {
50  delete ui;
51 }
Ui::QxrdWelcomeWindow * ui

Member Function Documentation

void QxrdWelcomeWindow::appendRecentExperiment ( QString  title)

Definition at line 93 of file qxrdwelcomewindow.cpp.

References m_InsertRow, m_SignalMapper, and ui.

Referenced by QxrdWelcomeWindow().

94 {
96 
97  item->setText(title);
98 
99  ui->m_GridLayout->addWidget(item, m_InsertRow++, 0, 1, 2);
100 
101  connect(item, &QAbstractButton::clicked, &m_SignalMapper, (void (QSignalMapper::*) ()) &QSignalMapper::map);
102 
103  m_SignalMapper.setMapping(item, title);
104 }
Ui::QxrdWelcomeWindow * ui
QSignalMapper m_SignalMapper

Here is the caller graph for this function:

void QxrdWelcomeWindow::changeEvent ( QEvent *  e)
protected

Definition at line 53 of file qxrdwelcomewindow.cpp.

References ui.

54 {
55  QMainWindow::changeEvent(e);
56  switch (e->type()) {
57  case QEvent::LanguageChange:
58  ui->retranslateUi(this);
59  break;
60  default:
61  break;
62  }
63 }
Ui::QxrdWelcomeWindow * ui
void QxrdWelcomeWindow::clearStatusMessage ( )
slot

Definition at line 165 of file qxrdwelcomewindow.cpp.

References m_StatusMsg.

Referenced by QxrdWelcomeWindow().

166 {
167  m_StatusMsg -> setText("");
168 }

Here is the caller graph for this function:

void QxrdWelcomeWindow::closeEvent ( QCloseEvent *  event)

Definition at line 106 of file qxrdwelcomewindow.cpp.

107 {
108  QMainWindow::closeEvent(event);
110 // event -> accept();
111 // } else {
112 // event -> ignore();
113 // }
114 }
void QxrdWelcomeWindow::displayMessage ( QString  msg)
slot

Definition at line 158 of file qxrdwelcomewindow.cpp.

References m_StatusMsg, and m_StatusTimer.

159 {
160  m_StatusMsg -> setText(msg);
161 
162  m_StatusTimer.start(5000);
163 }
void QxrdWelcomeWindow::openMostRecent ( )
privateslot

Definition at line 170 of file qxrdwelcomewindow.cpp.

References m_Application, and QxrdApplication::openExperiment().

171 {
172  QString experiment = m_Application->get_RecentExperiments().value(0);
173 
174  if (experiment.length()) {
175  m_Application->openExperiment(experiment);
176  }
177 }
QxrdApplication * m_Application
void openExperiment(QString path)

Here is the call graph for this function:

void QxrdWelcomeWindow::populateRecentExperimentsMenu ( )
privateslot

Definition at line 74 of file qxrdwelcomewindow.cpp.

References m_Application, m_RecentExperimentsMenu, and m_SignalMapper.

Referenced by setupRecentExperimentsMenu().

75 {
76 // printMessage("Populating recent experiments menu");
77 
78  m_RecentExperimentsMenu->clear();
79 
80  QStringList recent = m_Application->get_RecentExperiments();
81 
82  foreach (QString exp, recent) {
83 // printf("Recent experiment: %s\n", qPrintable(exp));
84 
85  QAction *action = new QAction(exp, m_RecentExperimentsMenu);
86  connect(action, &QAction::triggered, &m_SignalMapper, (void (QSignalMapper::*) ()) &QSignalMapper::map);
87  m_SignalMapper.setMapping(action, exp);
88 
89  m_RecentExperimentsMenu -> addAction(action);
90  }
91 }
QxrdApplication * m_Application
QSignalMapper m_SignalMapper
QMenu * m_RecentExperimentsMenu

Here is the caller graph for this function:

void QxrdWelcomeWindow::possiblyClose ( )

Definition at line 116 of file qxrdwelcomewindow.cpp.

References wantToClose().

117 {
118  // printf("QxrdWindow::possiblyClose()\n");
119  if (wantToClose()) {
120  close();
121  }
122 }

Here is the call graph for this function:

void QxrdWelcomeWindow::readSettings ( QSettings *  settings,
QString  section 
)

Definition at line 133 of file qxrdwelcomewindow.cpp.

References QcepProperty::readSettings().

134 {
135  if (settings) {
136  QByteArray geometry = settings->value(section+"-geometry").toByteArray();
137  QByteArray winstate = settings->value(section+"-state").toByteArray();
138 
139  if (!geometry.isEmpty() && !winstate.isEmpty()) {
140  restoreGeometry(geometry);
141  restoreState(winstate,1);
142  }
143 
144  QcepProperty::readSettings(this, settings, section);
145  }
146 }
static void readSettings(QObject *object, QSettings *settings, QString section)

Here is the call graph for this function:

void QxrdWelcomeWindow::setupRecentExperimentsMenu ( QAction *  action)
private

Definition at line 65 of file qxrdwelcomewindow.cpp.

References m_RecentExperimentsMenu, and populateRecentExperimentsMenu().

Referenced by QxrdWelcomeWindow().

66 {
67  m_RecentExperimentsMenu = new QMenu(this);
68 
69  action->setMenu(m_RecentExperimentsMenu);
70 
72 }
void populateRecentExperimentsMenu()
QMenu * m_RecentExperimentsMenu

Here is the call graph for this function:

Here is the caller graph for this function:

bool QxrdWelcomeWindow::wantToClose ( )

Definition at line 124 of file qxrdwelcomewindow.cpp.

References THREAD_CHECK.

Referenced by possiblyClose().

125 {
126  THREAD_CHECK;
127 
128  return QMessageBox::question(this, tr("Really Close?"),
129  tr("Do you really want to close the window?"),
130  QMessageBox::Ok | QMessageBox::Cancel) == QMessageBox::Ok;
131 }
#define THREAD_CHECK
Definition: qcepmacros.h:11

Here is the caller graph for this function:

void QxrdWelcomeWindow::writeSettings ( QSettings *  settings,
QString  section 
)

Definition at line 148 of file qxrdwelcomewindow.cpp.

References QcepProperty::writeSettings().

149 {
150  if (settings) {
151  settings->setValue(section+"-geometry", saveGeometry());
152  settings->setValue(section+"-state", saveState(1));
153 
154  QcepProperty::writeSettings(this, settings, section);
155  }
156 }
static void writeSettings(QObject *object, QSettings *settings, QString section)

Here is the call graph for this function:

Member Data Documentation

QxrdApplication* QxrdWelcomeWindow::m_Application
private
int QxrdWelcomeWindow::m_InsertRow
private

Definition at line 47 of file qxrdwelcomewindow.h.

Referenced by appendRecentExperiment().

QMenu* QxrdWelcomeWindow::m_RecentExperimentsMenu
private
QSignalMapper QxrdWelcomeWindow::m_SignalMapper
private
QLabel* QxrdWelcomeWindow::m_StatusMsg
private

Definition at line 49 of file qxrdwelcomewindow.h.

Referenced by clearStatusMessage(), displayMessage(), and QxrdWelcomeWindow().

QTimer QxrdWelcomeWindow::m_StatusTimer
private

Definition at line 50 of file qxrdwelcomewindow.h.

Referenced by displayMessage(), and QxrdWelcomeWindow().

Ui::QxrdWelcomeWindow* QxrdWelcomeWindow::ui
private

The documentation for this class was generated from the following files: