Create the method that changes the state of the application
Not used yet. The idea is to call 'setApplicationState("plan");'
and all widgegts for plan will be magically setup because we
added the plan state with registerApplicationState.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
93198a8098
commit
57e938d040
@ -170,6 +170,7 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||
|
||||
updateManager = new UpdateManager(this);
|
||||
undoBuffer = new UndoBuffer(this);
|
||||
setApplicationState("Default");
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
@ -1505,3 +1506,25 @@ void MainWindow::registerApplicationState(const QByteArray& state, QWidget *topL
|
||||
{
|
||||
applicationState[state] = WidgetForBorder(topLeft, bottomLeft, topRight, bottomRight);
|
||||
}
|
||||
|
||||
void MainWindow::setApplicationState(const QByteArray& state) {
|
||||
if (!applicationState.keys().contains(state))
|
||||
return;
|
||||
|
||||
// yes, index is zero both times. please don't change it.
|
||||
if (ui.topSplitter->count()) {
|
||||
ui.topSplitter->widget(0)->setParent(NULL);
|
||||
ui.topSplitter->widget(0)->setParent(NULL);
|
||||
}
|
||||
if (ui.bottomSplitter->count()) {
|
||||
ui.bottomSplitter->widget(0)->setParent(NULL);
|
||||
ui.bottomSplitter->widget(0)->setParent(NULL);
|
||||
}
|
||||
|
||||
|
||||
WidgetForBorder curr = applicationState[state];
|
||||
ui.topSplitter->addWidget(curr.topLeft);
|
||||
ui.topSplitter->addWidget(curr.topRight);
|
||||
ui.bottomSplitter->addWidget(curr.bottomLeft);
|
||||
ui.bottomSplitter->addWidget(curr.bottomRight);
|
||||
}
|
||||
|
||||
@ -83,6 +83,7 @@ public:
|
||||
void setPlanNotes(const char *notes);
|
||||
void printPlan();
|
||||
void checkSurvey(QSettings *s);
|
||||
void setApplicationState(const QByteArray& state);
|
||||
UndoBuffer *undoBuffer;
|
||||
private
|
||||
slots:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user