Files
MagicSetEditor2/src/gui/update_checker.hpp
T
coppro 3ea0a4abd7 Made it so that update window and set window can't be open simultaneously (don't explode the set by deleting the style, say).
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
2007-09-25 02:02:53 +00:00

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