mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Renamed global PackageManager object to package_manager to reduce confusion
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@907 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -57,7 +57,7 @@ String PackageChoiceValue::toString() const {
|
||||
|
||||
PackagedP PackageChoiceValue::getPackage() const {
|
||||
if (package_name.empty()) return nullptr;
|
||||
else return packages.openAny(package_name, true);
|
||||
else return package_manager.openAny(package_name, true);
|
||||
}
|
||||
|
||||
bool PackageChoiceValue::update(Context& ctx) {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ Game::Game()
|
||||
{}
|
||||
|
||||
GameP Game::byName(const String& name) {
|
||||
return packages.open<Game>(name + _(".mse-game"));
|
||||
return package_manager.open<Game>(name + _(".mse-game"));
|
||||
}
|
||||
|
||||
bool Game::isMagic() const {
|
||||
|
||||
@@ -151,7 +151,7 @@ void Installer::addPackage(const String& package) {
|
||||
if (fn.GetExt() == _("mse-installer")) {
|
||||
prefered_filename = package;
|
||||
} else {
|
||||
PackagedP p = ::packages.openAny(package);
|
||||
PackagedP p = package_manager.openAny(package);
|
||||
addPackage(*p);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ LocaleP the_locale;
|
||||
String Locale::typeName() const { return _("locale"); }
|
||||
|
||||
LocaleP Locale::byName(const String& name) {
|
||||
return packages.open<Locale>(name + _(".mse-locale"));
|
||||
return package_manager.open<Locale>(name + _(".mse-locale"));
|
||||
}
|
||||
|
||||
IMPLEMENT_REFLECTION_NO_SCRIPT(Locale) {
|
||||
|
||||
@@ -33,9 +33,9 @@ StyleSheetP StyleSheet::byGameAndName(const Game& game, const String& name) {
|
||||
try {
|
||||
map<String, String>::const_iterator it = stylesheet_alternatives.find(full_name);
|
||||
if (it != stylesheet_alternatives.end()) {
|
||||
return packages.open<StyleSheet>(it->second);
|
||||
return package_manager.open<StyleSheet>(it->second);
|
||||
} else {
|
||||
return packages.open<StyleSheet>(full_name);
|
||||
return package_manager.open<StyleSheet>(full_name);
|
||||
}
|
||||
} catch (PackageNotFoundError& e) {
|
||||
if (stylesheet_for_reading()) {
|
||||
|
||||
@@ -42,7 +42,7 @@ String SymbolFont::typeNameStatic() { return _("symbol-font"); }
|
||||
String SymbolFont::typeName() const { return _("symbol-font"); }
|
||||
|
||||
SymbolFontP SymbolFont::byName(const String& name) {
|
||||
return packages.open<SymbolFont>(
|
||||
return package_manager.open<SymbolFont>(
|
||||
name.size() > 16 && is_substr(name, name.size() - 16, _(".mse-symbol-font"))
|
||||
? name : name + _(".mse-symbol-font"));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void PackageList::showData(const String& pattern) {
|
||||
packages.clear();
|
||||
// find matching packages
|
||||
vector<PackagedP> matching;
|
||||
::packages.findMatching(pattern, matching);
|
||||
package_manager.findMatching(pattern, matching);
|
||||
FOR_EACH(p, matching) {
|
||||
// open image
|
||||
InputStreamP stream = p->openIconFile();
|
||||
|
||||
@@ -182,7 +182,7 @@ void PackagesWindow::init(Window* parent, bool show_only_installable) {
|
||||
|
||||
// get packages
|
||||
wxBusyCursor busy;
|
||||
packages.installedPackages(installable_packages);
|
||||
package_manager.findAllInstalledPackages(installable_packages);
|
||||
FOR_EACH(p, installable_packages) p->determineStatus();
|
||||
checkInstallerList(false);
|
||||
|
||||
@@ -254,12 +254,12 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
|
||||
wxPD_AUTO_HIDE | wxPD_APP_MODAL | wxPD_CAN_ABORT | wxPD_SMOOTH
|
||||
);
|
||||
// Clear package list
|
||||
packages.reset();
|
||||
package_manager.reset();
|
||||
// Download installers
|
||||
int package_pos = 0, progress = 0;
|
||||
int package_pos = 0, step = 0;
|
||||
FOR_EACH(ip, installable_packages) {
|
||||
++package_pos; ++progress;
|
||||
if (!progress.Update(progress, String::Format(_ERROR_("downloading updates"), package_pos, total))) {
|
||||
++package_pos; ++step;
|
||||
if (!progress.Update(step, String::Format(_ERROR_("downloading updates"), package_pos, total))) {
|
||||
return; // aborted
|
||||
}
|
||||
if ((ip->action & PACKAGE_INSTALL) && ip->installer && !ip->installer->installer) {
|
||||
@@ -281,11 +281,11 @@ void PackagesWindow::onOk(wxCommandEvent& ev) {
|
||||
// Install stuff
|
||||
package_pos = 0 ;
|
||||
FOR_EACH(ip, installable_packages) {
|
||||
++package_pos; ++progress;
|
||||
if (!progress.Update(progress, String::Format(_ERROR_("installing updates"), package_pos, total))) {
|
||||
++package_pos; ++step;
|
||||
if (!progress.Update(step, String::Format(_ERROR_("installing updates"), package_pos, total))) {
|
||||
// don't allow abort.
|
||||
}
|
||||
packages.install(*ip);
|
||||
package_manager.install(*ip);
|
||||
}
|
||||
// Done
|
||||
// Continue event propagation into the dialog window so that it closes.
|
||||
|
||||
@@ -139,7 +139,7 @@ GlobalPreferencesPage::GlobalPreferencesPage(Window* parent)
|
||||
language = new wxComboBox(this, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, 0, nullptr, wxCB_READONLY);
|
||||
// set values
|
||||
vector<PackagedP> locales;
|
||||
::packages.findMatching(_("*.mse-locale"), locales);
|
||||
package_manager.findMatching(_("*.mse-locale"), locales);
|
||||
sort(locales.begin(), locales.end(), compare_package_name);
|
||||
int n = 0;
|
||||
FOR_EACH(package, locales) {
|
||||
|
||||
@@ -564,8 +564,8 @@ void SetWindow::onFileReload(wxCommandEvent&) {
|
||||
vector<CardP>::const_iterator card_it = find(set->cards.begin(), set->cards.end(), current_panel->selectedCard());
|
||||
if (card_it != set->cards.end()) card_pos = card_it - set->cards.begin();
|
||||
}
|
||||
packages.reset(); // unload all packages
|
||||
settings.read(); // reload settings
|
||||
package_manager.reset(); // unload all packages
|
||||
settings.read(); // reload settings
|
||||
setSet(import_set(filename));
|
||||
// reselect card
|
||||
if (card_pos < set->cards.size()) {
|
||||
|
||||
@@ -75,7 +75,7 @@ bool update_available() {
|
||||
FOR_EACH_CONST(p, update_version_data->packages) {
|
||||
if (!settings.check_updates_all && p->package != mse_package) continue;
|
||||
Version v;
|
||||
if (packages.installedVersion(p->package, v) && v < p->version) {
|
||||
if (package_manager.installedVersion(p->package, v) && v < p->version) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -79,7 +79,7 @@ int MSE::OnRun() {
|
||||
wxFileSystem::AddHandler(new wxInternetFSHandler); // needed for update checker
|
||||
init_script_variables();
|
||||
init_file_formats();
|
||||
packages.init();
|
||||
package_manager.init();
|
||||
settings.read();
|
||||
the_locale = Locale::byName(settings.locale);
|
||||
check_updates();
|
||||
@@ -212,7 +212,7 @@ int MSE::OnRun() {
|
||||
int MSE::OnExit() {
|
||||
thumbnail_thread.abortAll();
|
||||
settings.write();
|
||||
packages.destroy();
|
||||
package_manager.destroy();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ struct PackageChoiceValueViewer::ComparePackagePosHint {
|
||||
|
||||
void PackageChoiceValueViewer::initItems() {
|
||||
vector<PackagedP> choices;
|
||||
packages.findMatching(field().match, choices);
|
||||
package_manager.findMatching(field().match, choices);
|
||||
sort(choices.begin(), choices.end(), ComparePackagePosHint());
|
||||
FOR_EACH(p, choices) {
|
||||
Item i;
|
||||
|
||||
@@ -194,7 +194,7 @@ void TokenIterator::readToken() {
|
||||
// read the entire file, and start at the beginning of it
|
||||
pos = 0;
|
||||
filename = include_file;
|
||||
InputStreamP is = packages.openFileFromPackage(package, include_file);
|
||||
InputStreamP is = package_manager.openFileFromPackage(package, include_file);
|
||||
input = read_utf8_line(*is, true, true);
|
||||
} else if (isAlpha(c) || c == _('_')) {
|
||||
// name
|
||||
|
||||
@@ -179,7 +179,7 @@ InputStreamP Package::openIn(const String& file) {
|
||||
if (!file.empty() && file.GetChar(0) == _('/')) {
|
||||
// absolute path, open file from another package
|
||||
Packaged* p = dynamic_cast<Packaged*>(this);
|
||||
return packages.openFileFromPackage(p, file);
|
||||
return package_manager.openFileFromPackage(p, file);
|
||||
}
|
||||
FileInfos::iterator it = files.find(normalize_internal_filename(file));
|
||||
if (it == files.end()) {
|
||||
@@ -547,7 +547,7 @@ void Packaged::validate(Version) {
|
||||
}
|
||||
// check dependencies
|
||||
FOR_EACH(dep, dependencies) {
|
||||
packages.checkDependency(*dep, true);
|
||||
package_manager.checkDependency(*dep, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ DECLARE_TYPEOF_COLLECTION(PackageVersion::FileInfo);
|
||||
|
||||
// ----------------------------------------------------------------------------- : PackageManager : in memory
|
||||
|
||||
PackageManager packages;
|
||||
PackageManager package_manager;
|
||||
|
||||
|
||||
void PackageManager::init() {
|
||||
@@ -148,7 +148,7 @@ bool PackageManager::installedVersion(const String& package_name, Version& versi
|
||||
}
|
||||
}
|
||||
|
||||
void PackageManager::installedPackages(vector<InstallablePackageP>& packages) {
|
||||
void PackageManager::findAllInstalledPackages(vector<InstallablePackageP>& packages) {
|
||||
// from directories
|
||||
vector<InstallablePackageP> more_packages;
|
||||
global.installedPackages(packages);
|
||||
@@ -229,7 +229,7 @@ void PackageDirectory::installedPackages(vector<InstallablePackageP>& packages_o
|
||||
if (it1 == packages.end() || (*it1)->name > *it2) {
|
||||
// add new package to db
|
||||
try {
|
||||
PackagedP pack = ::packages.openAny(*it2, true);
|
||||
PackagedP pack = package_manager.openAny(*it2, true);
|
||||
db_changed = true;
|
||||
PackageVersionP ver(new PackageVersion(
|
||||
is_local ? PackageVersion::STATUS_LOCAL : PackageVersion::STATUS_GLOBAL));
|
||||
@@ -244,7 +244,7 @@ void PackageDirectory::installedPackages(vector<InstallablePackageP>& packages_o
|
||||
} else {
|
||||
// ok, a package already in the db
|
||||
try {
|
||||
PackagedP pack = ::packages.openAny(*it2, true);
|
||||
PackagedP pack = package_manager.openAny(*it2, true);
|
||||
(*it1)->check_status(*pack);
|
||||
packages_out.push_back(new_intrusive2<InstallablePackage>(new_intrusive1<PackageDescription>(*pack), *it1));
|
||||
} catch (const Error&) { db_changed = true; }
|
||||
|
||||
@@ -149,7 +149,7 @@ class PackageManager {
|
||||
bool installedVersion(const String& pkg, Version& version_out);
|
||||
|
||||
/// Get all installed packages
|
||||
void installedPackages(vector<InstallablePackageP>& packages);
|
||||
void findAllInstalledPackages(vector<InstallablePackageP>& packages);
|
||||
|
||||
/// Install/uninstall a package
|
||||
void install(const InstallablePackage& package);
|
||||
@@ -162,7 +162,7 @@ class PackageManager {
|
||||
};
|
||||
|
||||
/// The global PackageManager instance
|
||||
extern PackageManager packages;
|
||||
extern PackageManager package_manager;
|
||||
|
||||
// ----------------------------------------------------------------------------- : PackageVersion
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ Reader::Reader(Packaged* pkg, const String& filename)
|
||||
: indent(0), expected_indent(0), state(OUTSIDE)
|
||||
, ignore_invalid(false)
|
||||
, filename(filename), package(pkg), line_number(0), previous_line_number(0)
|
||||
, input(packages.openFileFromPackage(package, filename))
|
||||
, input(package_manager.openFileFromPackage(package, filename))
|
||||
{
|
||||
moveNext();
|
||||
handleAppVersion();
|
||||
|
||||
Reference in New Issue
Block a user