|
@@ -1,5 +1,6 @@
|
|
#include <QtGui>
|
|
#include <QtGui>
|
|
#include <QtDebug>
|
|
#include <QtDebug>
|
|
|
|
+#include <QStackedWidget>
|
|
#include <QTreeView>
|
|
#include <QTreeView>
|
|
#include <QWebFrame>
|
|
#include <QWebFrame>
|
|
|
|
|
|
@@ -67,6 +68,14 @@ FbMainWindow::FbMainWindow(const QString &filename, ViewMode mode)
|
|
createStatusBar();
|
|
createStatusBar();
|
|
readSettings();
|
|
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);
|
|
setCurrentFile(filename);
|
|
if (mode == FB2) {
|
|
if (mode == FB2) {
|
|
viewText();
|
|
viewText();
|
|
@@ -780,7 +789,7 @@ void FbMainWindow::viewText()
|
|
} else {
|
|
} else {
|
|
textFrame = new FbTextFrame(this, actionInspect);
|
|
textFrame = new FbTextFrame(this, actionInspect);
|
|
}
|
|
}
|
|
- setCentralWidget(textFrame);
|
|
|
|
|
|
+// setCentralWidget(textFrame);
|
|
viewTree();
|
|
viewTree();
|
|
|
|
|
|
FbTextEdit *textEdit = textFrame->view();
|
|
FbTextEdit *textEdit = textFrame->view();
|
|
@@ -800,30 +809,22 @@ void FbMainWindow::viewText()
|
|
|
|
|
|
void FbMainWindow::viewHead()
|
|
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(dockTree);
|
|
FB2DELETE(dockImgs);
|
|
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();
|
|
this->setFocus();
|
|
textFrame->setParent(NULL);
|
|
textFrame->setParent(NULL);
|
|
- setCentralWidget(headTree);
|
|
|
|
|
|
+// setCentralWidget(headTree);
|
|
textFrame->setParent(this);
|
|
textFrame->setParent(this);
|
|
headTree->updateTree();
|
|
headTree->updateTree();
|
|
|
|
|
|
@@ -878,7 +879,7 @@ void FbMainWindow::viewCode()
|
|
codeEdit = new FbCodeEdit;
|
|
codeEdit = new FbCodeEdit;
|
|
}
|
|
}
|
|
if (load) codeEdit->load(xml);
|
|
if (load) codeEdit->load(xml);
|
|
- setCentralWidget(codeEdit);
|
|
|
|
|
|
+// setCentralWidget(codeEdit);
|
|
codeEdit->setFocus();
|
|
codeEdit->setFocus();
|
|
|
|
|
|
FB2DELETE(toolEdit);
|
|
FB2DELETE(toolEdit);
|
|
@@ -938,7 +939,7 @@ void FbMainWindow::viewHtml()
|
|
}
|
|
}
|
|
|
|
|
|
codeEdit->setPlainText(html);
|
|
codeEdit->setPlainText(html);
|
|
- setCentralWidget(codeEdit);
|
|
|
|
|
|
+// setCentralWidget(codeEdit);
|
|
codeEdit->setFocus();
|
|
codeEdit->setFocus();
|
|
|
|
|
|
FB2DELETE(toolEdit);
|
|
FB2DELETE(toolEdit);
|