1
//--------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2007 Cecilio Salmeron
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU General Public License as published by the Free Software Foundation;
7
// either version 2 of the License, or (at your option) any later version.
9
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
10
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
11
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
13
// You should have received a copy of the GNU General Public License along with this
14
// program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street,
15
// Fifth Floor, Boston, MA 02110-1301, USA.
17
// For any comment, suggestion or feature request, please contact the manager of
18
// the project at cecilios@users.sourceforge.net
20
//-------------------------------------------------------------------------------------
21
/*! @file UpdaterDlg.cpp
22
@brief Implementation file for all dialog classes used only by the updater
23
@ingroup updates_management
25
#if defined(__GNUG__) && !defined(__APPLE__)
26
#pragma implementation "UpdaterDlg.h"
29
// For compilers that support precompilation, includes "wx/wx.h".
30
#include "wx/wxprec.h"
40
#include "wx/xrc/xmlres.h"
41
#include <wx/listctrl.h>
46
#include "UpdaterDlg.h"
47
//#include "Updater.h"
51
//-----------------------------------------------------------------------------
52
// Implementation of class lmUpdaterDlgStart
53
//-----------------------------------------------------------------------------
56
BEGIN_EVENT_TABLE(lmUpdaterDlgStart, wxDialog)
57
EVT_BUTTON( XRCID( "btnProceed" ), lmUpdaterDlgStart::OnProceedClicked )
58
EVT_BUTTON( XRCID( "btnCancel" ), lmUpdaterDlgStart::OnCancelClicked )
64
lmUpdaterDlgStart::lmUpdaterDlgStart(wxWindow* parent)
66
// create the dialog controls
67
wxXmlResource::Get()->LoadDialog(this, parent, _T("UpdaterDlgStart"));
70
//get pointers to all controls
74
wxStaticBitmap* pBmpUpdaterLogo = XRCCTRL(*this, "bmpUpdaterLogo", wxStaticBitmap);
75
pBmpUpdaterLogo->SetBitmap( wxArtProvider::GetIcon(_T("banner_updater"), wxART_OTHER) );
84
//-----------------------------------------------------------------------------
85
// Implementation of class lmUpdaterDlgInfo
86
//-----------------------------------------------------------------------------
89
BEGIN_EVENT_TABLE(lmUpdaterDlgInfo, wxDialog)
90
EVT_BUTTON( XRCID( "btnDownload" ), lmUpdaterDlgInfo::OnDownloadClicked )
91
EVT_BUTTON( XRCID( "btnCancel" ), lmUpdaterDlgInfo::OnCancelClicked )
94
EVT_UPDATE_UI(wxID_ANY, lmUpdaterDlgInfo::OnUpdateUI)
100
lmUpdaterDlgInfo::lmUpdaterDlgInfo(wxWindow* parent, lmUpdater* pUpdater)
102
// create the dialog controls
103
wxXmlResource::Get()->LoadDialog(this, parent, _T("UpdaterDlgInfo"));
106
//get pointers to all controls
108
m_pUpdates = XRCCTRL(*this, "lstUpdates", wxCheckListBox);
109
m_pDescription = XRCCTRL(*this, "txtDescription", wxStaticText);
110
m_pBtnDownload = XRCCTRL(*this, "btnDownload", wxButton);
113
wxStaticBitmap* pBmpUpdaterLogo = XRCCTRL(*this, "bmpUpdaterLogo", wxStaticBitmap);
114
pBmpUpdaterLogo->SetBitmap( wxArtProvider::GetIcon(_T("banner_updater"), wxART_OTHER) );
118
m_pUpdater = pUpdater;
124
void lmUpdaterDlgInfo::AddPackage(wxString sPackage, wxString sDescription)
126
m_pUpdates->Set(1, &sPackage);
127
m_pUpdates->Check(m_nNumItems, true);
128
m_pDescription->SetLabel(sDescription);
133
void lmUpdaterDlgInfo::OnDownloadClicked(wxCommandEvent& WXUNUSED(event))
135
m_pUpdater->DownloadFiles();
140
void lmUpdaterDlgInfo::OnUpdateUI(wxUpdateUIEvent& WXUNUSED(event))
142
//enable / disable download button
143
bool fEnableDownload = false;
145
for (i=0; i < m_nNumItems; i++) {
146
if (m_pUpdates->IsChecked(i) ) {
147
fEnableDownload = true;
151
m_pBtnDownload->Enable(fEnableDownload);