1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
|
// -------------------------------------------------------------------------------- //
// Copyright (C) 2008-2013 J.Rios
// anonbeat@gmail.com
//
// This Program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 3, or (at your option)
// any later version.
//
// This Program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; see the file LICENSE. If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
// http://www.gnu.org/copyleft/gpl.html
//
// -------------------------------------------------------------------------------- //
#ifndef COVEREDIT_H
#define COVEREDIT_H
#include "ArrayStringArray.h"
#include "AutoPulseGauge.h"
#include "ThreadArray.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/image.h>
#include <wx/statbmp.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/bmpbuttn.h>
#include <wx/dialog.h>
#include <wx/gauge.h>
#include <wx/choice.h>
#include <wx/checkbox.h>
#define GUCOVERINFO_LINK 0
#define GUCOVERINFO_SIZE 1
// -------------------------------------------------------------------------------- //
class guCoverImage
{
public:
wxString m_Link;
wxString m_SizeStr;
wxImage * m_Image;
guCoverImage()
{
m_Link = wxEmptyString;
m_Image = NULL;
};
guCoverImage( const wxString &link, const wxString size, wxImage * image )
{
m_Link = link;
m_SizeStr = size;
m_Image = image;
};
~guCoverImage()
{
if( m_Image )
delete m_Image;
};
};
WX_DECLARE_OBJARRAY(guCoverImage, guCoverImageArray);
class guCoverEditor;
class guCoverFetcher;
// -------------------------------------------------------------------------------- //
class guFetchCoverLinksThread : public wxThread
{
private:
guCoverEditor * m_CoverEditor;
guCoverFetcher * m_CoverFetcher;
guArrayStringArray m_CoverLinks;
int m_CurrentPage;
int m_LastDownload;
wxString m_Artist;
wxString m_Album;
int m_EngineIndex;
public:
guFetchCoverLinksThread( guCoverEditor * owner, const wxChar * artist, const wxChar * album, int engineindex );
~guFetchCoverLinksThread();
virtual ExitCode Entry();
};
// -------------------------------------------------------------------------------- //
class guDownloadCoverThread : public wxThread
{
private:
guCoverEditor * m_CoverEditor;
wxString m_UrlStr;
wxString m_SizeStr;
public:
guDownloadCoverThread( guCoverEditor * Owner, const wxArrayString * CoverInfo );
~guDownloadCoverThread();
virtual ExitCode Entry();
};
class guCoverFetcher;
// -------------------------------------------------------------------------------- //
// Class guCoverEditor
// -------------------------------------------------------------------------------- //
class guCoverEditor : public wxDialog
{
private:
wxTextCtrl * m_ArtistTextCtrl;
wxTextCtrl * m_AlbumTextCtrl;
wxChoice * m_EngineChoice;
wxStaticBitmap * m_CoverBitmap;
wxBitmapButton * m_PrevButton;
wxBitmapButton * m_NextButton;
wxButton * m_ButtonsSizerOK;
wxButton * m_ButtonsSizerCancel;
wxBoxSizer * m_SizeSizer;
wxStaticText * m_SizeStaticText;
wxMutex m_DownloadThreadMutex;
wxMutex m_DownloadEventsMutex;
guAutoPulseGauge * m_Gauge;
wxStaticText * m_InfoTextCtrl;
wxCheckBox * m_EmbedToFilesChkBox;
guCoverImageArray m_AlbumCovers;
guFetchCoverLinksThread * m_DownloadCoversThread;
guThreadArray m_DownloadThreads;
int m_CurrentImage;
int m_EngineIndex;
void OnInitDialog( wxInitDialogEvent& event );
void OnTextCtrlEnter( wxCommandEvent& event );
void OnEngineChanged( wxCommandEvent& event );
void OnCoverLeftDClick( wxMouseEvent& event );
void OnCoverLeftClick( wxMouseEvent& event );
void OnPrevButtonClick( wxCommandEvent& event );
void OnNextButtonClick( wxCommandEvent& event );
void OnAddCoverImage( wxCommandEvent &event );
void UpdateCoverBitmap();
void EndDownloadLinksThread();
void EndDownloadCoverThread( guDownloadCoverThread * DownloadCoverThread );
void OnDownloadedLinks( wxCommandEvent &event );
void OnMouseWheel( wxMouseEvent &event );
public:
guCoverEditor( wxWindow * parent, const wxString &Artist, const wxString &Album );// wxWindowID id = wxID_ANY, const wxString& title = wxT("Cover Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE );
~guCoverEditor();
wxString GetSelectedCoverUrl( void );
wxImage * GetSelectedCoverImage( void );
bool EmbedToFiles( void ) { return m_EmbedToFilesChkBox->IsChecked(); }
friend class guFetchCoverLinksThread;
friend class guDownloadCoverThread;
};
#endif
// -------------------------------------------------------------------------------- //
|