Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lintest/fb2edit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/fb2main.cpp')
-rw-r--r--source/fb2main.cpp39
1 files changed, 20 insertions, 19 deletions
diff --git a/source/fb2main.cpp b/source/fb2main.cpp
index db7709f..f05ddbf 100644
--- a/source/fb2main.cpp
+++ b/source/fb2main.cpp
@@ -1,5 +1,6 @@
#include <QtGui>
#include <QtDebug>
+#include <QStackedWidget>
#include <QTreeView>
#include <QWebFrame>
@@ -67,6 +68,14 @@ FbMainWindow::FbMainWindow(const QString &filename, ViewMode mode)
createStatusBar();
readSettings();
+ mainDock = new QStackedWidget(this);
+ mainDock->addWidget(textFrame = new FbTextFrame(mainDock));
+ mainDock->addWidget(codeEdit = new FbCodeEdit(mainDock));
+ mainDock->addWidget(headTree = new FbHeadView(mainDock));
+ setCentralWidget(mainDock);
+
+ headTree->setView(textFrame->view());
+
setCurrentFile(filename);
if (mode == FB2) {
viewText();
@@ -780,7 +789,7 @@ void FbMainWindow::viewText()
} else {
textFrame = new FbTextFrame(this, actionInspect);
}
- setCentralWidget(textFrame);
+// setCentralWidget(textFrame);
viewTree();
FbTextEdit *textEdit = textFrame->view();
@@ -800,30 +809,22 @@ void FbMainWindow::viewText()
void FbMainWindow::viewHead()
{
- if (headTree && centralWidget() == headTree) return;
-
- if (textFrame) textFrame->hideInspector();
-
- QString xml;
- if (codeEdit) xml = codeEdit->text();
+ if (mainDock->currentWidget() == headTree) return;
FB2DELETE(dockTree);
FB2DELETE(dockImgs);
- FB2DELETE(codeEdit);
- FB2DELETE(toolEdit);
+ textFrame->hideInspector();
- if (!textFrame) {
- textFrame = new FbTextFrame(this, actionInspect);
- }
+ mainDock->setCurrentWidget(headTree);
- if (!headTree) {
- headTree = new FbHeadView(textFrame->view(), this);
- connect(headTree, SIGNAL(status(QString)), this, SLOT(status(QString)));
- }
+ QString xml;
+ if (codeEdit) xml = codeEdit->text();
+
+ connect(headTree, SIGNAL(status(QString)), this, SLOT(status(QString)));
this->setFocus();
textFrame->setParent(NULL);
- setCentralWidget(headTree);
+// setCentralWidget(headTree);
textFrame->setParent(this);
headTree->updateTree();
@@ -878,7 +879,7 @@ void FbMainWindow::viewCode()
codeEdit = new FbCodeEdit;
}
if (load) codeEdit->load(xml);
- setCentralWidget(codeEdit);
+// setCentralWidget(codeEdit);
codeEdit->setFocus();
FB2DELETE(toolEdit);
@@ -938,7 +939,7 @@ void FbMainWindow::viewHtml()
}
codeEdit->setPlainText(html);
- setCentralWidget(codeEdit);
+// setCentralWidget(codeEdit);
codeEdit->setFocus();
FB2DELETE(toolEdit);