mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
3ea0a4abd7
Made update window enforce dependencies Added update button to welcome window (need icon still) git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@756 0fc631ac-6414-0410-93d0-97cfa31319b6
94 lines
3.0 KiB
C++
94 lines
3.0 KiB
C++
//+----------------------------------------------------------------------------+
|
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
|
//| Copyright: (C) 2001 - 2007 Twan van Laarhoven |
|
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
|
//+----------------------------------------------------------------------------+
|
|
|
|
#ifndef HEADER_UTIL_UPDATE_CHECKER
|
|
#define HEADER_UTIL_UPDATE_CHECKER
|
|
|
|
// ----------------------------------------------------------------------------- : Includes
|
|
|
|
#include <util/prec.hpp>
|
|
#include <gui/welcome_window.hpp>
|
|
|
|
// ----------------------------------------------------------------------------- : Update checking
|
|
|
|
// Checks for updates if the settings say so
|
|
void check_updates();
|
|
|
|
/// Checks if the current version is the latest version
|
|
/** If async==true then checking is done in another thread
|
|
*/
|
|
void check_updates_now(bool async = true);
|
|
|
|
/// Show a dialog to inform the user that updates are available (if there are any)
|
|
/** Call check_updates first.
|
|
* Call this function from an onIdle loop */
|
|
void show_update_dialog(Window* parent);
|
|
|
|
// ----------------------------------------------------------------------------- : Update window
|
|
|
|
class PackageUpdateList;
|
|
class wxHtmlWindow;
|
|
|
|
DECLARE_POINTER_TYPE(PackageVersionData);
|
|
|
|
/// A window that displays the updates and allows the user to select some.
|
|
/** NOTE: cannot be called 'UpdateWindow' because there is a Win32 function with that name
|
|
*/
|
|
class UpdatesWindow : public Frame {
|
|
public:
|
|
UpdatesWindow();
|
|
~UpdatesWindow() { (new WelcomeWindow)->Show(); }
|
|
|
|
void DrawTitles(wxPaintEvent&);
|
|
|
|
enum PackageStatus {
|
|
STATUS_INSTALLED,
|
|
STATUS_NOT_INSTALLED,
|
|
STATUS_UPGRADEABLE
|
|
};
|
|
enum PackageAction {
|
|
ACTION_INSTALL,
|
|
ACTION_UNINSTALL,
|
|
ACTION_UPGRADE,
|
|
ACTION_NOTHING,
|
|
ACTION_NEW_MSE // means that you need a new version of MSE to install/upgrade
|
|
};
|
|
|
|
typedef pair<PackageStatus, PackageAction> PackageData;
|
|
|
|
map<PackageVersionDataP, PackageData> package_data;
|
|
|
|
private:
|
|
DECLARE_EVENT_TABLE();
|
|
PackageUpdateList* package_list; ///< List of available packages
|
|
wxHtmlWindow* description_window;
|
|
|
|
wxStaticText *package_title, *status_title, *new_title;
|
|
wxButton *install_button, *upgrade_button, *remove_button, *cancel_button, *apply_button;
|
|
|
|
void onUpdateCheckFinished(wxCommandEvent&);
|
|
void onPackageSelect(wxCommandEvent&);
|
|
void onActionChange(wxCommandEvent&);
|
|
void onApplyChanges(wxCommandEvent&);
|
|
|
|
void SelectPackageDependencies (PackageVersionDataP);
|
|
void RemovePackageDependencies (PackageVersionDataP);
|
|
void DowngradePackageDependencies(PackageVersionDataP);
|
|
|
|
/// Update the buttons to indicate that this is selected.
|
|
void updateButtons(int index);
|
|
|
|
void setDefaultPackageStatus();
|
|
};
|
|
|
|
/// Was update data found?
|
|
bool update_data_found();
|
|
/// Is there an update?
|
|
bool update_available();
|
|
|
|
// ----------------------------------------------------------------------------- : EOF
|
|
#endif
|