mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-07 12:10:52 -06:00
Remove explicit specification of read-only profiles and read-only configuration files and use a filesystem lookup instead
This commit is contained in:
@@ -110,8 +110,6 @@ private:
|
||||
const std::string _userConfigPath;
|
||||
const std::string _profilePath;
|
||||
const std::string _userProfilePath;
|
||||
const std::vector<std::string>& _readOnlyWindowConfigs;
|
||||
const std::vector<std::string>& _readOnlyProfiles;
|
||||
bool _shouldLaunch = false;
|
||||
int _userAssetCount = 0;
|
||||
int _userConfigStartingIdx = 0;
|
||||
|
||||
@@ -48,14 +48,11 @@ public:
|
||||
* \param assetBasePath The path to the folder where the assets live
|
||||
* \param userAssetBasePath The path to the folder where the user assets live
|
||||
* \param profileName The path to the folder in which all profiles live
|
||||
* \param profilesReadOnly vector list of profile names that are read-only and must
|
||||
* not be overwritten
|
||||
* \param parent Pointer to parent Qt widget
|
||||
*/
|
||||
ProfileEdit(openspace::Profile& profile, const std::string& profileName,
|
||||
std::string assetBasePath, std::string userAssetBasePath,
|
||||
std::string profileBasePath,
|
||||
const std::vector<std::string>& profilesReadOnly, QWidget* parent);
|
||||
std::string profileBasePath, QWidget* parent);
|
||||
|
||||
/**
|
||||
* Gets the status of the save when the window is closed; was the file saved?
|
||||
@@ -103,7 +100,6 @@ private:
|
||||
const std::string _userAssetBasePath;
|
||||
const std::string _profileBasePath;
|
||||
bool _saveSelected = false;
|
||||
const std::vector<std::string>& _readOnlyProfiles;
|
||||
|
||||
QLineEdit* _profileEdit = nullptr;
|
||||
QLabel* _modulesLabel = nullptr;
|
||||
|
||||
@@ -64,13 +64,10 @@ public:
|
||||
* imported window cluster configuration.
|
||||
* \param configName The name of the window configuration filename
|
||||
* \param configBasePath The path to the folder where default config files reside
|
||||
* \param configsReadOnly vector list of window config names that are read-only and
|
||||
* must not be overwritten
|
||||
* \param parent Pointer to parent Qt widget
|
||||
*/
|
||||
SgctEdit(sgct::config::Cluster& cluster, const std::string& configName,
|
||||
std::string& configBasePath, const std::vector<std::string>& configsReadOnly,
|
||||
QWidget* parent);
|
||||
std::string& configBasePath, QWidget* parent);
|
||||
|
||||
/**
|
||||
* Returns the saved filename
|
||||
@@ -112,7 +109,6 @@ private:
|
||||
QColor(0xF8, 0x33, 0x3C)
|
||||
};
|
||||
std::string _configurationFilename;
|
||||
const std::vector<std::string> _readOnlyConfigs;
|
||||
|
||||
QBoxLayout* _layoutButtonBox = nullptr;
|
||||
QPushButton* _saveButton = nullptr;
|
||||
|
||||
@@ -213,8 +213,6 @@ LauncherWindow::LauncherWindow(bool profileEnabled,
|
||||
, _userProfilePath(
|
||||
absPath(globalConfig.pathTokens.at("USER_PROFILES")).string() + '/'
|
||||
)
|
||||
, _readOnlyWindowConfigs(globalConfig.readOnlyWindowConfigs)
|
||||
, _readOnlyProfiles(globalConfig.readOnlyProfiles)
|
||||
, _sgctConfigName(sgctConfigName)
|
||||
{
|
||||
Q_INIT_RESOURCE(resources);
|
||||
@@ -724,7 +722,6 @@ void LauncherWindow::openProfileEditor(const std::string& profile, bool isUserPr
|
||||
_assetPath,
|
||||
_userAssetPath,
|
||||
saveProfilePath,
|
||||
_readOnlyProfiles,
|
||||
this
|
||||
);
|
||||
editor.exec();
|
||||
@@ -806,7 +803,6 @@ void LauncherWindow::openWindowEditor(const std::string& winCfg, bool isUserWinC
|
||||
preview,
|
||||
winCfg,
|
||||
saveWindowCfgPath,
|
||||
_readOnlyWindowConfigs,
|
||||
this
|
||||
);
|
||||
ret = editor.exec();
|
||||
|
||||
@@ -99,14 +99,12 @@ ProfileEdit::ProfileEdit(Profile& profile, const std::string& profileName,
|
||||
std::string assetBasePath,
|
||||
std::string userAssetBasePath,
|
||||
std::string profileBasePath,
|
||||
const std::vector<std::string>& readOnlyProfiles,
|
||||
QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, _profile(profile)
|
||||
, _assetBasePath(std::move(assetBasePath))
|
||||
, _userAssetBasePath(std::move(userAssetBasePath))
|
||||
, _profileBasePath(std::move(profileBasePath))
|
||||
, _readOnlyProfiles(readOnlyProfiles)
|
||||
{
|
||||
setWindowTitle("Profile Editor");
|
||||
createWidgets(profileName);
|
||||
@@ -489,17 +487,19 @@ void ProfileEdit::approved() {
|
||||
return;
|
||||
}
|
||||
|
||||
auto it = std::find(_readOnlyProfiles.begin(), _readOnlyProfiles.end(), profileName);
|
||||
if (it == _readOnlyProfiles.end()) {
|
||||
_saveSelected = true;
|
||||
_errorMsg->setText("");
|
||||
accept();
|
||||
}
|
||||
else {
|
||||
std::filesystem::path p = fmt::format("{}/{}.profile", _profileBasePath, profileName);
|
||||
if (std::filesystem::exists(p)) {
|
||||
// The filename exists in the OpenSpace-provided folder, so we don't want to allow
|
||||
// a user to overwrite it
|
||||
_errorMsg->setText(
|
||||
"This is a read-only profile. Click 'Duplicate' or rename & save"
|
||||
);
|
||||
}
|
||||
else {
|
||||
_saveSelected = true;
|
||||
_errorMsg->setText("");
|
||||
accept();
|
||||
}
|
||||
}
|
||||
|
||||
void ProfileEdit::keyPressEvent(QKeyEvent* evt) {
|
||||
|
||||
@@ -78,13 +78,11 @@ SgctEdit::SgctEdit(QWidget* parent, std::string userConfigPath)
|
||||
}
|
||||
|
||||
SgctEdit::SgctEdit(sgct::config::Cluster& cluster, const std::string& configName,
|
||||
std::string& configBasePath,
|
||||
const std::vector<std::string>& configsReadOnly, QWidget* parent)
|
||||
std::string& configBasePath, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, _cluster(cluster)
|
||||
, _userConfigPath(configBasePath)
|
||||
, _configurationFilename(configName)
|
||||
, _readOnlyConfigs(configsReadOnly)
|
||||
, _didImportValues(true)
|
||||
{
|
||||
setWindowTitle("Window Configuration Editor");
|
||||
|
||||
Reference in New Issue
Block a user