mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
Abstract away InstanceCopyPrefs' internals through new getSelectedFiltersAsRegex() function
+ fix typo in comment + remove unused import + add [[nodiscard]] to methods Signed-off-by: Marcelo Hernandez <marcelohdez.inq@gmail.com>
This commit is contained in:
parent
385c452ddf
commit
63b6c6685c
5 changed files with 45 additions and 60 deletions
|
|
@ -9,62 +9,16 @@ InstanceCopyTask::InstanceCopyTask(InstancePtr origInstance, const InstanceCopyP
|
|||
{
|
||||
m_origInstance = origInstance;
|
||||
m_keepPlaytime = prefs.keepPlaytime;
|
||||
QString filter;
|
||||
|
||||
if(!prefs.copySaves)
|
||||
QString filters = prefs.getSelectedFiltersAsRegex();
|
||||
if (!filters.isEmpty())
|
||||
{
|
||||
appendToFilter(filter, "saves");
|
||||
// Set regex filter:
|
||||
// FIXME: get this from the original instance type...
|
||||
auto matcherReal = new RegexpMatcher(filters);
|
||||
matcherReal->caseSensitive(false);
|
||||
m_matcher.reset(matcherReal);
|
||||
}
|
||||
|
||||
if(!prefs.copyGameOptions) {
|
||||
appendToFilter(filter, "options.txt");
|
||||
}
|
||||
|
||||
if(!prefs.copyResourcePacks)
|
||||
{
|
||||
appendToFilter(filter, "resourcepacks");
|
||||
appendToFilter(filter, "texturepacks");
|
||||
}
|
||||
|
||||
if(!prefs.copyShaderPacks)
|
||||
{
|
||||
appendToFilter(filter, "shaderpacks");
|
||||
}
|
||||
|
||||
if(!prefs.copyServers)
|
||||
{
|
||||
appendToFilter(filter, "servers.dat");
|
||||
appendToFilter(filter, "servers.dat_old");
|
||||
appendToFilter(filter, "server-resource-packs");
|
||||
}
|
||||
|
||||
if(!prefs.copyMods)
|
||||
{
|
||||
appendToFilter(filter, "coremods");
|
||||
appendToFilter(filter, "mods");
|
||||
appendToFilter(filter, "config");
|
||||
}
|
||||
|
||||
if (!filter.isEmpty())
|
||||
{
|
||||
resetFromMatcher(filter);
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceCopyTask::appendToFilter(QString& filter, const QString& append)
|
||||
{
|
||||
if (!filter.isEmpty())
|
||||
filter.append('|'); // OR regex
|
||||
|
||||
filter.append("[.]?minecraft/" + append);
|
||||
}
|
||||
|
||||
void InstanceCopyTask::resetFromMatcher(const QString& regexp)
|
||||
{
|
||||
// FIXME: get this from the original instance type...
|
||||
auto matcherReal = new RegexpMatcher(regexp);
|
||||
matcherReal->caseSensitive(false);
|
||||
m_matcher.reset(matcherReal);
|
||||
}
|
||||
|
||||
void InstanceCopyTask::executeTask()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue