From ba365ff49ed9be07af0244389077c3fc71b36d7a Mon Sep 17 00:00:00 2001 From: graffy76 Date: Fri, 25 Oct 2013 19:23:03 -0500 Subject: [PATCH] Fixed merge conflicts with saving branch --- apps/launcher/datafilespage.cpp | 34 ------------------- apps/opencs/editor.cpp | 8 ++--- apps/opencs/editor.hpp | 2 +- apps/opencs/model/doc/document.cpp | 2 +- apps/opencs/model/world/idcollection.hpp | 2 +- apps/opencs/view/doc/filedialog.cpp | 42 +++++++++++------------- apps/opencs/view/doc/filedialog.hpp | 9 +++-- 7 files changed, 31 insertions(+), 68 deletions(-) diff --git a/apps/launcher/datafilespage.cpp b/apps/launcher/datafilespage.cpp index d36ab65e9..e246b4515 100644 --- a/apps/launcher/datafilespage.cpp +++ b/apps/launcher/datafilespage.cpp @@ -161,42 +161,8 @@ void Launcher::DataFilesPage::slotProfileDeleted (const QString &item) void Launcher::DataFilesPage::slotProfileChangedByUser(const QString &previous, const QString ¤t) { -<<<<<<< HEAD setProfile(previous, current, true); emit signalProfileChanged (ui.profilesComboBox->findText(current)); -======= - if (mContentModel->rowCount() < 1) - return; - - QString profile = mLauncherSettings.value(QString("Profiles/currentprofile")); - - if (profile.isEmpty()) { - profile = profilesComboBox->currentText(); - mLauncherSettings.setValue(QString("Profiles/currentprofile"), profile); - } - - mLauncherSettings.remove(QString("Profiles/") + profile + QString("/master")); - mLauncherSettings.remove(QString("Profiles/") + profile + QString("/plugin")); - - mGameSettings.remove(QString("master")); - mGameSettings.remove(QString("plugins")); - mGameSettings.remove(QString("content")); - - ContentSelectorModel::ContentFileList items = mContentModel->checkedItems(); - - foreach(const ContentSelectorModel::EsmFile *item, items) { - - if (item->gameFiles().size() == 0) { - mLauncherSettings.setMultiValue(QString("Profiles/") + profile + QString("/master"), item->fileName()); - mGameSettings.setMultiValue(QString("content"), item->fileName()); - - } else { - mLauncherSettings.setMultiValue(QString("Profiles/") + profile + QString("/plugin"), item->fileName()); - mGameSettings.setMultiValue(QString("content"), item->fileName()); - } - } - ->>>>>>> 3146af34d642a28b15b55f7eb9999d8ac50168a0 } void Launcher::DataFilesPage::slotProfileRenamed(const QString &previous, const QString ¤t) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 03758b16e..51cc490c7 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -10,6 +10,7 @@ #include "model/world/data.hpp" #include +#include CS::Editor::Editor() : mDocumentManager (mCfgMgr), mViewManager (mDocumentManager) @@ -19,7 +20,6 @@ CS::Editor::Editor() setupDataFiles(); mNewGame.setLocalData (mLocal); - mFileDialog.setLocalData (mLocal); connect (&mViewManager, SIGNAL (newGameRequest ()), this, SLOT (createGame ())); connect (&mViewManager, SIGNAL (newAddonRequest ()), this, SLOT (createAddon ())); @@ -32,8 +32,8 @@ CS::Editor::Editor() connect (&mStartup, SIGNAL (editConfig()), this, SLOT (showSettings ())); connect (&mFileDialog, SIGNAL(openFiles()), this, SLOT(openFiles())); - connect (&mFileDialog, SIGNAL(createNewFile (const boost::filesystem::path&)), - this, SLOT(createNewFile (const boost::filesystem::path&))); + connect (&mFileDialog, SIGNAL(createNewFile ()), + this, SLOT(createNewFile ())); connect (&mNewGame, SIGNAL (createRequest (const boost::filesystem::path&)), this, SLOT (createNewGame (const boost::filesystem::path&))); @@ -141,7 +141,7 @@ void CS::Editor::openFiles() mFileDialog.hide(); } -void CS::Editor::createNewFile (const boost::filesystem::path& savePath) +void CS::Editor::createNewFile () { std::vector files; diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index 16f6b9516..ef013bc8f 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -60,7 +60,7 @@ namespace CS void loadDocument(); void openFiles(); - void createNewFile (const boost::filesystem::path& savePath); + void createNewFile (); void createNewGame (const boost::filesystem::path& file); void showStartup(); diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index cc886f9cc..590a19439 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -2246,7 +2246,7 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration, co mData.setAuthor (""); } /// \todo un-outcomment the else, once loading an existing content file works properly again. -// else + else { if (boost::filesystem::exists (mProjectPath)) { diff --git a/apps/opencs/model/world/idcollection.hpp b/apps/opencs/model/world/idcollection.hpp index 0d723bef1..a7b37be5b 100644 --- a/apps/opencs/model/world/idcollection.hpp +++ b/apps/opencs/model/world/idcollection.hpp @@ -111,7 +111,7 @@ namespace CSMWorld else { record.mState = RecordBase::State_Deleted; - setRecord (index, record); + this->setRecord (index, record); } return true; diff --git a/apps/opencs/view/doc/filedialog.cpp b/apps/opencs/view/doc/filedialog.cpp index 0bf7c6951..fb6c0a0e8 100644 --- a/apps/opencs/view/doc/filedialog.cpp +++ b/apps/opencs/view/doc/filedialog.cpp @@ -17,8 +17,6 @@ #include "filewidget.hpp" #include "adjusterwidget.hpp" -#include - CSVDoc::FileDialog::FileDialog(QWidget *parent) : QDialog(parent), mSelector (0) { @@ -61,6 +59,13 @@ void CSVDoc::FileDialog::showDialog(DialogType dialogType) break; } + //connections common to both dialog view flavors + connect (mSelector, SIGNAL (signalCurrentGamefileIndexChanged (int)), + this, SLOT (slotUpdateAcceptButton (int))); + + connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (createNewFile())); + connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected())); + show(); raise(); activateWindow(); @@ -82,13 +87,7 @@ void CSVDoc::FileDialog::buildNewFileView() ui.projectGroupBoxLayout->insertWidget (0, mFileWidget); connect (mFileWidget, SIGNAL (nameChanged(const QString &, bool)), - this, SLOT (slotUpdateCreateButton(const QString &, bool))); - - connect (mSelector, SIGNAL (signalCurrentGamefileIndexChanged (int)), - this, SLOT (slotUpdateCreateButton (int))); - - connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (createNewFile())); - connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected())); + this, SLOT (slotUpdateAcceptButton(const QString &, bool))); } void CSVDoc::FileDialog::buildOpenFileView() @@ -96,21 +95,25 @@ void CSVDoc::FileDialog::buildOpenFileView() setWindowTitle(tr("Open")); ui.projectGroupBox->setTitle (QString("")); - connect (ui.projectButtonBox, SIGNAL (accepted()), this, SIGNAL (openFiles())); - connect (ui.projectButtonBox, SIGNAL (rejected()), this, SLOT (slotRejected())); + ui.projectButtonBox->button(QDialogButtonBox::Ok)->setEnabled (false); } -void CSVDoc::FileDialog::slotUpdateCreateButton (int) +void CSVDoc::FileDialog::slotUpdateAcceptButton (int) { - slotUpdateCreateButton (mFileWidget->getName(), true); + QString name = ""; + + if (mDialogType == DialogType_New) + name = mFileWidget->getName(); + + slotUpdateAcceptButton (name, true); } -void CSVDoc::FileDialog::slotUpdateCreateButton(const QString &name, bool) +void CSVDoc::FileDialog::slotUpdateAcceptButton(const QString &name, bool) { - if (!(mDialogType == DialogType_New)) - return; + bool success = (mSelector->selectedFiles().size() > 0); - bool success = (!name.isEmpty() && mSelector->selectedFiles().size() > 0); + if (mDialogType == DialogType_New) + success = success && !(name.isEmpty()); ui.projectButtonBox->button (QDialogButtonBox::Ok)->setEnabled (success); } @@ -128,8 +131,3 @@ void CSVDoc::FileDialog::slotRejected() emit rejected(); close(); } - -void CSVDoc::FileDialog::createNewFile() -{ - emit createNewFile (mAdjusterWidget->getPath()); -} diff --git a/apps/opencs/view/doc/filedialog.hpp b/apps/opencs/view/doc/filedialog.hpp index be268f372..30f2f5d56 100644 --- a/apps/opencs/view/doc/filedialog.hpp +++ b/apps/opencs/view/doc/filedialog.hpp @@ -55,15 +55,14 @@ namespace CSVDoc signals: void openFiles(); - void createNewFile (const boost::filesystem::path& savePath); + void createNewFile (); - void signalUpdateCreateButton (bool, int); - void signalUpdateCreateButtonFlags(int); + void signalUpdateAcceptButton (bool, int); private slots: - void slotUpdateCreateButton (int); - void slotUpdateCreateButton (const QString &, bool); + void slotUpdateAcceptButton (int); + void slotUpdateAcceptButton (const QString &, bool); void slotRejected(); }; }