2011-04-08 00:04:09 +02:00
|
|
|
#ifndef DATAFILESPAGE_H
|
|
|
|
#define DATAFILESPAGE_H
|
|
|
|
|
2013-10-22 21:52:35 -05:00
|
|
|
#include "ui_datafilespage.h"
|
2021-08-01 23:35:45 +02:00
|
|
|
|
|
|
|
#include <components/process/processinvoker.hpp>
|
|
|
|
|
2013-11-03 00:02:46 -05:00
|
|
|
#include <QDir>
|
2018-05-22 20:50:31 -05:00
|
|
|
#include <QStringList>
|
2011-04-08 00:04:09 +02:00
|
|
|
#include <QWidget>
|
2013-11-03 00:02:46 -05:00
|
|
|
|
2011-05-11 20:04:25 +02:00
|
|
|
class QSortFilterProxyModel;
|
2013-03-05 03:47:57 +01:00
|
|
|
class QAbstractItemModel;
|
2011-06-07 20:21:01 +02:00
|
|
|
class QMenu;
|
2013-02-11 15:01:00 +01:00
|
|
|
|
2012-01-21 01:14:35 +01:00
|
|
|
namespace Files
|
|
|
|
{
|
|
|
|
struct ConfigurationManager;
|
2013-10-06 21:13:47 -05:00
|
|
|
}
|
|
|
|
namespace ContentSelectorView
|
|
|
|
{
|
|
|
|
class ContentSelector;
|
2022-09-22 21:26:05 +03:00
|
|
|
}
|
2013-12-25 00:50:25 +01:00
|
|
|
namespace Config
|
|
|
|
{
|
|
|
|
class GameSettings;
|
|
|
|
class LauncherSettings;
|
|
|
|
}
|
2012-01-21 01:14:35 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
namespace Launcher
|
2011-04-08 00:04:09 +02:00
|
|
|
{
|
2021-08-01 23:35:45 +02:00
|
|
|
class MainDialog;
|
2013-10-25 11:17:26 -05:00
|
|
|
class TextInputDialog;
|
|
|
|
class ProfilesComboBox;
|
2013-09-21 23:06:29 -05:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
class DataFilesPage : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2013-10-06 21:13:47 -05:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
ContentSelectorView::ContentSelector* mSelector;
|
|
|
|
Ui::DataFilesPage ui;
|
2013-10-22 21:52:35 -05:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
public:
|
2013-12-25 00:50:25 +01:00
|
|
|
explicit DataFilesPage(Files::ConfigurationManager& cfg, Config::GameSettings& gameSettings,
|
2021-08-01 23:35:45 +02:00
|
|
|
Config::LauncherSettings& launcherSettings, MainDialog* parent = nullptr);
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
QAbstractItemModel* profilesModel() const;
|
2013-03-05 03:47:57 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
int profilesIndex() const;
|
2013-02-11 15:01:00 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
// void writeConfig(QString profile = QString());
|
|
|
|
void saveSettings(const QString& profile = "");
|
2014-04-17 00:01:19 +02:00
|
|
|
bool loadSettings();
|
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
signals:
|
|
|
|
void signalProfileChanged(int index);
|
2018-06-08 19:18:23 -05:00
|
|
|
void signalLoadedCellsChanged(QStringList selectedFiles);
|
2011-04-08 00:04:09 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
public slots:
|
|
|
|
void slotProfileChanged(int index);
|
2013-03-05 03:47:57 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
private slots:
|
2013-10-01 21:29:45 -05:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
void slotProfileChangedByUser(const QString& previous, const QString& current);
|
|
|
|
void slotProfileRenamed(const QString& previous, const QString& current);
|
|
|
|
void slotProfileDeleted(const QString& item);
|
2018-05-26 20:35:28 -05:00
|
|
|
void slotAddonDataChanged();
|
2020-03-21 19:35:20 +00:00
|
|
|
void slotRefreshButtonClicked();
|
2013-10-22 21:52:35 -05:00
|
|
|
|
2019-05-15 17:53:18 +03:00
|
|
|
void updateNewProfileOkButton(const QString& text);
|
|
|
|
void updateCloneProfileOkButton(const QString& text);
|
2020-04-26 15:31:39 +02:00
|
|
|
void addSubdirectories(bool append);
|
|
|
|
void sortDirectories();
|
|
|
|
void removeDirectory();
|
|
|
|
void moveArchive(int step);
|
|
|
|
void moveDirectory(int step);
|
2014-04-17 02:17:18 +02:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
void on_newProfileAction_triggered();
|
2019-05-15 17:53:18 +03:00
|
|
|
void on_cloneProfileAction_triggered();
|
2013-10-25 11:17:26 -05:00
|
|
|
void on_deleteProfileAction_triggered();
|
2012-10-10 22:58:04 +02:00
|
|
|
|
2021-08-01 23:35:45 +02:00
|
|
|
void startNavMeshTool();
|
|
|
|
void killNavMeshTool();
|
2021-12-19 22:49:41 +01:00
|
|
|
void readNavMeshToolStdout();
|
|
|
|
void readNavMeshToolStderr();
|
2021-08-01 23:35:45 +02:00
|
|
|
void navMeshToolFinished(int exitCode, QProcess::ExitStatus exitStatus);
|
|
|
|
|
2015-02-06 12:24:06 +13:00
|
|
|
public:
|
2015-02-06 12:45:15 +13:00
|
|
|
/// Content List that is always present
|
2015-02-06 12:24:06 +13:00
|
|
|
const static char* mDefaultContentListName;
|
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
private:
|
2021-12-19 22:49:41 +01:00
|
|
|
struct NavMeshToolProgress
|
|
|
|
{
|
2023-01-27 19:09:00 +01:00
|
|
|
bool mEnabled = true;
|
2021-12-19 22:49:41 +01:00
|
|
|
QByteArray mLogData;
|
|
|
|
QByteArray mMessagesData;
|
|
|
|
std::map<std::uint64_t, std::string> mWorldspaces;
|
|
|
|
int mCellsCount = 0;
|
|
|
|
int mExpectedMaxProgress = 0;
|
|
|
|
};
|
2013-10-01 21:29:45 -05:00
|
|
|
|
2021-08-01 23:35:45 +02:00
|
|
|
MainDialog* mMainDialog;
|
2019-05-15 17:53:18 +03:00
|
|
|
TextInputDialog* mNewProfileDialog;
|
|
|
|
TextInputDialog* mCloneProfileDialog;
|
2012-02-22 08:34:47 +01:00
|
|
|
|
2013-10-25 11:17:26 -05:00
|
|
|
Files::ConfigurationManager& mCfgMgr;
|
2012-02-22 08:34:47 +01:00
|
|
|
|
2013-12-25 00:50:25 +01:00
|
|
|
Config::GameSettings& mGameSettings;
|
|
|
|
Config::LauncherSettings& mLauncherSettings;
|
2012-01-21 01:14:35 +01:00
|
|
|
|
2014-12-10 21:47:04 +01:00
|
|
|
QString mPreviousProfile;
|
2018-05-26 20:35:28 -05:00
|
|
|
QStringList previousSelectedFiles;
|
2013-11-03 00:02:46 -05:00
|
|
|
QString mDataLocal;
|
2020-04-26 15:31:39 +02:00
|
|
|
QStringList mKnownArchives;
|
|
|
|
QStringList mNewDataDirs;
|
2013-11-03 00:02:46 -05:00
|
|
|
|
2021-08-01 23:35:45 +02:00
|
|
|
Process::ProcessInvoker* mNavMeshToolInvoker;
|
2021-12-19 22:49:41 +01:00
|
|
|
NavMeshToolProgress mNavMeshToolProgress;
|
2021-08-01 23:35:45 +02:00
|
|
|
|
2020-04-26 15:31:39 +02:00
|
|
|
void addArchive(const QString& name, Qt::CheckState selected, int row = -1);
|
|
|
|
void addArchivesFromDir(const QString& dir);
|
2013-10-25 11:17:26 -05:00
|
|
|
void buildView();
|
|
|
|
void setProfile(int index, bool savePrevious);
|
|
|
|
void setProfile(const QString& previous, const QString& current, bool savePrevious);
|
|
|
|
void removeProfile(const QString& profile);
|
|
|
|
bool showDeleteMessageBox(const QString& text);
|
|
|
|
void addProfile(const QString& profile, bool setAsCurrent);
|
|
|
|
void checkForDefaultProfile();
|
2015-01-26 18:46:18 +13:00
|
|
|
void populateFileViews(const QString& contentModelName);
|
2018-05-27 17:15:36 -05:00
|
|
|
void reloadCells(QStringList selectedFiles);
|
2020-03-21 19:35:20 +00:00
|
|
|
void refreshDataFilesView();
|
2021-12-19 22:49:41 +01:00
|
|
|
void updateNavMeshProgress(int minDataSize);
|
2020-04-26 15:31:39 +02:00
|
|
|
QString selectDirectory();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the file paths of all selected content files
|
|
|
|
* @return the file paths of all selected content files
|
|
|
|
*/
|
|
|
|
QStringList selectedFilePaths() const;
|
|
|
|
QStringList selectedArchivePaths(bool all = false) const;
|
|
|
|
QStringList selectedDirectoriesPaths() const;
|
2013-11-03 00:02:46 -05:00
|
|
|
|
|
|
|
class PathIterator
|
|
|
|
{
|
|
|
|
QStringList::ConstIterator mCitEnd;
|
|
|
|
QStringList::ConstIterator mCitCurrent;
|
|
|
|
QStringList::ConstIterator mCitBegin;
|
|
|
|
QString mFile;
|
|
|
|
QString mFilePath;
|
|
|
|
|
|
|
|
public:
|
|
|
|
PathIterator(const QStringList& list)
|
|
|
|
{
|
|
|
|
mCitBegin = list.constBegin();
|
|
|
|
mCitCurrent = mCitBegin;
|
|
|
|
mCitEnd = list.constEnd();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString findFirstPath(const QString& file)
|
|
|
|
{
|
|
|
|
mCitCurrent = mCitBegin;
|
|
|
|
mFile = file;
|
|
|
|
return path();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString findNextPath() { return path(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
QString path()
|
|
|
|
{
|
|
|
|
bool success = false;
|
|
|
|
QDir dir;
|
|
|
|
QFileInfo file;
|
|
|
|
|
|
|
|
while (!success)
|
|
|
|
{
|
|
|
|
if (mCitCurrent == mCitEnd)
|
|
|
|
break;
|
|
|
|
|
|
|
|
dir.setPath(*(mCitCurrent++));
|
|
|
|
file.setFile(dir.absoluteFilePath(mFile));
|
|
|
|
|
|
|
|
success = file.exists();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (success)
|
|
|
|
return file.absoluteFilePath();
|
|
|
|
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
};
|
2014-12-30 17:25:19 +13:00
|
|
|
|
|
|
|
QStringList filesInProfile(const QString& profileName, PathIterator& pathIterator);
|
2013-10-25 11:17:26 -05:00
|
|
|
};
|
|
|
|
}
|
2011-04-24 21:42:56 +02:00
|
|
|
#endif
|