|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
|
|
|
|
|
#include "view.hpp"
|
|
|
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
|
|
#include <QCloseEvent>
|
|
|
|
|
#include <QMenuBar>
|
|
|
|
@ -16,7 +16,7 @@ void CSVDoc::View::closeEvent (QCloseEvent *event)
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::setupUi()
|
|
|
|
|
{
|
|
|
|
|
// window menu
|
|
|
|
|
// view menu
|
|
|
|
|
QMenu *view = menuBar()->addMenu (tr ("&View"));
|
|
|
|
|
|
|
|
|
|
QAction *newWindow = new QAction (tr ("&New View"), this);
|
|
|
|
@ -25,12 +25,25 @@ void CSVDoc::View::setupUi()
|
|
|
|
|
view->addAction (newWindow);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document)
|
|
|
|
|
: mViewManager (viewManager), mDocument (document)
|
|
|
|
|
void CSVDoc::View::updateTitle()
|
|
|
|
|
{
|
|
|
|
|
std::ostringstream stream;
|
|
|
|
|
|
|
|
|
|
stream << "New Document ";
|
|
|
|
|
|
|
|
|
|
if (mViewTotal>1)
|
|
|
|
|
stream << " [" << (mViewIndex+1) << "/" << mViewTotal << "]";
|
|
|
|
|
|
|
|
|
|
setWindowTitle (stream.str().c_str());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
|
|
|
|
|
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews)
|
|
|
|
|
{
|
|
|
|
|
setCentralWidget (new QWidget);
|
|
|
|
|
resize (200, 200);
|
|
|
|
|
setWindowTitle ("New Document");
|
|
|
|
|
|
|
|
|
|
updateTitle();
|
|
|
|
|
|
|
|
|
|
setupUi();
|
|
|
|
|
}
|
|
|
|
@ -45,6 +58,13 @@ CSMDoc::Document *CSVDoc::View::getDocument()
|
|
|
|
|
return mDocument;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::setIndex (int viewIndex, int totalViews)
|
|
|
|
|
{
|
|
|
|
|
mViewIndex = viewIndex;
|
|
|
|
|
mViewTotal = totalViews;
|
|
|
|
|
updateTitle();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CSVDoc::View::newView()
|
|
|
|
|
{
|
|
|
|
|
mViewManager.addView (mDocument);
|
|
|
|
|