forked from teamnwah/openmw-tes3coop
Move OpenDialog to editor and use it in startup dialogue.
Remove debug output from DataFilesList.
This commit is contained in:
parent
f7e5ea24f4
commit
347a734364
5 changed files with 21 additions and 50 deletions
|
@ -15,6 +15,8 @@ CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0)
|
|||
|
||||
connect (&mStartup, SIGNAL (createDocument()), this, SLOT (createDocument ()));
|
||||
connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ()));
|
||||
|
||||
connect (&mOpenDialog, SIGNAL(accepted()), this, SLOT(openFiles()));
|
||||
}
|
||||
|
||||
void CS::Editor::createDocument()
|
||||
|
@ -36,26 +38,24 @@ void CS::Editor::createDocument()
|
|||
}
|
||||
|
||||
void CS::Editor::loadDocument()
|
||||
{
|
||||
mOpenDialog.show();
|
||||
mOpenDialog.raise();
|
||||
mOpenDialog.activateWindow();
|
||||
}
|
||||
|
||||
void CS::Editor::openFiles()
|
||||
{
|
||||
mStartup.hide();
|
||||
|
||||
/// \todo open the ESX picker instead
|
||||
/// \todo remove the manual record creation and load the ESX files instead
|
||||
|
||||
std::ostringstream stream;
|
||||
|
||||
stream << "Document" << (++mNewDocumentIndex);
|
||||
|
||||
std::vector<boost::filesystem::path> files;
|
||||
files.push_back (stream.str());
|
||||
|
||||
CSMDoc::Document *document = mDocumentManager.addDocument (files, false);
|
||||
|
||||
std::vector<boost::filesystem::path> paths;
|
||||
mOpenDialog.getFileList(paths);
|
||||
CSMDoc::Document *document = mDocumentManager.addDocument(paths, false);
|
||||
|
||||
static const char *sGlobals[] =
|
||||
{
|
||||
"Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0
|
||||
};
|
||||
|
||||
|
||||
for (int i=0; sGlobals[i]; ++i)
|
||||
{
|
||||
ESM::Global record;
|
||||
|
@ -64,9 +64,9 @@ void CS::Editor::loadDocument()
|
|||
record.mType = ESM::VT_Float;
|
||||
document->getData().getGlobals().add (record);
|
||||
}
|
||||
|
||||
|
||||
document->getData().merge(); /// \todo remove once proper ESX loading is implemented
|
||||
|
||||
|
||||
mViewManager.addView (document);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include "view/doc/viewmanager.hpp"
|
||||
#include "view/doc/startup.hpp"
|
||||
#include "view/doc/opendialog.hpp"
|
||||
|
||||
namespace CS
|
||||
{
|
||||
|
@ -19,6 +20,7 @@ namespace CS
|
|||
CSMDoc::DocumentManager mDocumentManager;
|
||||
CSVDoc::ViewManager mViewManager;
|
||||
CSVDoc::StartupDialogue mStartup;
|
||||
OpenDialog mOpenDialog;
|
||||
|
||||
// not implemented
|
||||
Editor (const Editor&);
|
||||
|
@ -36,6 +38,7 @@ namespace CS
|
|||
void createDocument();
|
||||
|
||||
void loadDocument();
|
||||
void openFiles();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "../tools/subviews.hpp"
|
||||
|
||||
#include "opendialog.hpp"
|
||||
#include "viewmanager.hpp"
|
||||
#include "operations.hpp"
|
||||
#include "subview.hpp"
|
||||
|
@ -32,12 +31,8 @@ void CSVDoc::View::setupFileMenu()
|
|||
QAction *new_ = new QAction (tr ("New"), this);
|
||||
connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest()));
|
||||
file->addAction (new_);
|
||||
|
||||
mOpen = new QAction(tr ("&Open"), this);
|
||||
connect (mOpen, SIGNAL (triggered()), this, SLOT (open()));
|
||||
file->addAction (mOpen);
|
||||
|
||||
QAction *open = new QAction (tr ("Open"), this);
|
||||
QAction *open = new QAction (tr ("&Open"), this);
|
||||
connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest()));
|
||||
file->addAction (open);
|
||||
|
||||
|
@ -119,7 +114,7 @@ void CSVDoc::View::updateActions()
|
|||
}
|
||||
|
||||
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
|
||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews), mOpenDialog(0)
|
||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews)
|
||||
{
|
||||
setDockOptions (QMainWindow::AllowNestedDocks);
|
||||
|
||||
|
@ -214,26 +209,6 @@ void CSVDoc::View::save()
|
|||
mDocument->save();
|
||||
}
|
||||
|
||||
void CSVDoc::View::open()
|
||||
{
|
||||
if (!mOpenDialog) {
|
||||
mOpenDialog = new OpenDialog(this);
|
||||
connect(mOpenDialog, SIGNAL(accepted()), this, SLOT(openNewFiles()));
|
||||
}
|
||||
|
||||
mOpenDialog->show();
|
||||
mOpenDialog->raise();
|
||||
mOpenDialog->activateWindow();
|
||||
}
|
||||
|
||||
void CSVDoc::View::openNewFiles()
|
||||
{
|
||||
std::vector<boost::filesystem::path> paths;
|
||||
mOpenDialog->getFileList(paths);
|
||||
//FIXME load new files
|
||||
|
||||
}
|
||||
|
||||
void CSVDoc::View::verify()
|
||||
{
|
||||
addSubView (mDocument->verify());
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "subviewfactory.hpp"
|
||||
|
||||
class QAction;
|
||||
class OpenDialog;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
|
@ -37,12 +36,10 @@ namespace CSVDoc
|
|||
QAction *mUndo;
|
||||
QAction *mRedo;
|
||||
QAction *mSave;
|
||||
QAction *mOpen;
|
||||
QAction *mVerify;
|
||||
std::vector<QAction *> mEditingActions;
|
||||
Operations *mOperations;
|
||||
SubViewFactoryManager mSubViewFactory;
|
||||
OpenDialog * mOpenDialog;
|
||||
|
||||
// not implemented
|
||||
View (const View&);
|
||||
|
@ -97,8 +94,6 @@ namespace CSVDoc
|
|||
|
||||
void newView();
|
||||
|
||||
void open();
|
||||
void openNewFiles();
|
||||
void save();
|
||||
|
||||
void verify();
|
||||
|
|
|
@ -204,13 +204,11 @@ void DataFilesList::selectedFiles(std::vector<boost::filesystem::path>& paths)
|
|||
foreach (const QString &path, masterPaths)
|
||||
{
|
||||
paths.push_back(path.toStdString());
|
||||
cerr << path.toStdString() << endl;
|
||||
}
|
||||
QStringList pluginPaths = mPluginsModel->checkedItemsPaths();
|
||||
foreach (const QString &path, pluginPaths)
|
||||
{
|
||||
paths.push_back(path.toStdString());
|
||||
cerr << path.toStdString() << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue