forked from mirror/openmw-tes3mp
Add "open" option in opencs.
This commit is contained in:
parent
ac62dd050d
commit
492482de7f
7 changed files with 73 additions and 3 deletions
|
@ -17,7 +17,7 @@ set (OPENCS_SRC
|
|||
view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp
|
||||
view/world/dialoguesubview.cpp
|
||||
|
||||
view/tools/reportsubview.cpp view/tools/subviews.cpp
|
||||
view/tools/reportsubview.cpp view/tools/subviews.cpp view/tools/opendialog.cpp
|
||||
)
|
||||
|
||||
set (OPENCS_HDR
|
||||
|
@ -38,7 +38,7 @@ set (OPENCS_HDR
|
|||
view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp
|
||||
view/world/dialoguesubview.hpp
|
||||
|
||||
view/tools/reportsubview.hpp view/tools/subviews.hpp
|
||||
view/tools/reportsubview.hpp view/tools/subviews.hpp view/tools/opendialog.hpp
|
||||
)
|
||||
|
||||
set (OPENCS_US
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include "../tools/subviews.hpp"
|
||||
|
||||
#include "../tools/opendialog.hpp"
|
||||
|
||||
#include "viewmanager.hpp"
|
||||
#include "operations.hpp"
|
||||
#include "subview.hpp"
|
||||
|
@ -31,6 +33,10 @@ void CSVDoc::View::setupFileMenu()
|
|||
QAction *new_ = new QAction (tr ("New"), this);
|
||||
connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest()));
|
||||
file->addAction (new_);
|
||||
|
||||
mLoad = new QAction(tr ("&Load"), this);
|
||||
connect (mLoad, SIGNAL (triggered()), this, SLOT (load()));
|
||||
file->addAction (mLoad);
|
||||
|
||||
mSave = new QAction (tr ("&Save"), this);
|
||||
connect (mSave, SIGNAL (triggered()), this, SLOT (save()));
|
||||
|
@ -110,7 +116,7 @@ void CSVDoc::View::updateActions()
|
|||
}
|
||||
|
||||
CSVDoc::View::View (ViewManager& viewManager, CSMDoc::Document *document, int totalViews)
|
||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews)
|
||||
: mViewManager (viewManager), mDocument (document), mViewIndex (totalViews-1), mViewTotal (totalViews), mOpenDialog(0)
|
||||
{
|
||||
setDockOptions (QMainWindow::AllowNestedDocks);
|
||||
|
||||
|
@ -205,6 +211,27 @@ void CSVDoc::View::save()
|
|||
mDocument->save();
|
||||
}
|
||||
|
||||
void CSVDoc::View::load()
|
||||
{
|
||||
if (!mOpenDialog) {
|
||||
mOpenDialog = new OpenDialog(this);
|
||||
connect(mOpenDialog, SIGNAL(accepted()), this, SLOT(loadNewFiles()));
|
||||
}
|
||||
|
||||
mOpenDialog->show();
|
||||
mOpenDialog->raise();
|
||||
mOpenDialog->activateWindow();
|
||||
}
|
||||
|
||||
void CSVDoc::View::loadNewFiles()
|
||||
{
|
||||
//FIXME close old files
|
||||
std::vector<boost::filesystem::path> paths;
|
||||
mOpenDialog->getFileList(paths);
|
||||
//FIXME load new files
|
||||
|
||||
}
|
||||
|
||||
void CSVDoc::View::verify()
|
||||
{
|
||||
addSubView (mDocument->verify());
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "subviewfactory.hpp"
|
||||
|
||||
class QAction;
|
||||
class OpenDialog;
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
|
@ -36,10 +37,12 @@ namespace CSVDoc
|
|||
QAction *mUndo;
|
||||
QAction *mRedo;
|
||||
QAction *mSave;
|
||||
QAction *mLoad;
|
||||
QAction *mVerify;
|
||||
std::vector<QAction *> mEditingActions;
|
||||
Operations *mOperations;
|
||||
SubViewFactoryManager mSubViewFactory;
|
||||
OpenDialog * mOpenDialog;
|
||||
|
||||
// not implemented
|
||||
View (const View&);
|
||||
|
@ -92,6 +95,8 @@ namespace CSVDoc
|
|||
|
||||
void newView();
|
||||
|
||||
void load();
|
||||
void loadNewFiles();
|
||||
void save();
|
||||
|
||||
void verify();
|
||||
|
|
|
@ -451,6 +451,22 @@ bool DataFilesList::setupDataFiles()
|
|||
return true;
|
||||
}
|
||||
|
||||
void DataFilesList::getSelectedFiles(std::vector<boost::filesystem::path>& paths)
|
||||
{
|
||||
QStringList masterPaths = mMastersModel->checkedItemsPaths();
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
void DataFilesList::writeConfig(QString profile)
|
||||
{
|
||||
// Don't overwrite the config if no masters are found
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
void writeConfig(QString profile = QString());
|
||||
bool showDataFilesWarning();
|
||||
bool setupDataFiles();
|
||||
void getSelectedFiles(std::vector<boost::filesystem::path>& paths);
|
||||
|
||||
public slots:
|
||||
void setCheckState(QModelIndex index);
|
||||
|
|
|
@ -292,6 +292,7 @@ void DataFilesModel::addMasters(const QString &path)
|
|||
|
||||
EsmFile *file = new EsmFile(master);
|
||||
file->setDates(info.lastModified(), info.lastRead());
|
||||
file->setPath(info.absoluteFilePath());
|
||||
|
||||
// Add the master to the table
|
||||
if (findItem(master) == 0)
|
||||
|
@ -427,6 +428,25 @@ QStringList DataFilesModel::checkedItems()
|
|||
return list;
|
||||
}
|
||||
|
||||
QStringList DataFilesModel::checkedItemsPaths()
|
||||
{
|
||||
QStringList list;
|
||||
|
||||
QList<EsmFile *>::ConstIterator it;
|
||||
QList<EsmFile *>::ConstIterator itEnd = mFiles.constEnd();
|
||||
|
||||
int i = 0;
|
||||
for (it = mFiles.constBegin(); it != itEnd; ++it) {
|
||||
EsmFile *file = item(i);
|
||||
++i;
|
||||
|
||||
if (mCheckStates[file->fileName()] == Qt::Checked && mAvailableFiles.contains(file->fileName()))
|
||||
list << file->path();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void DataFilesModel::uncheckAll()
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
|
|
|
@ -43,6 +43,7 @@ public:
|
|||
|
||||
QStringList checkedItems();
|
||||
QStringList uncheckedItems();
|
||||
QStringList checkedItemsPaths();
|
||||
|
||||
Qt::CheckState checkState(const QModelIndex &index);
|
||||
void setCheckState(const QModelIndex &index, Qt::CheckState state);
|
||||
|
|
Loading…
Reference in a new issue