00001 #ifndef IMPORTMUSIC_H_ 00002 #define IMPORTMUSIC_H_ 00003 00004 #include <iostream> 00005 using namespace std; 00006 00007 #include <mythtv/mythdialogs.h> 00008 00009 class Metadata; 00010 class ImportMusicDialog; 00011 00012 typedef struct 00013 { 00014 Metadata *metadata; 00015 bool isNewTune; 00016 bool metadataHasChanged; 00017 } TrackInfo; 00018 00019 class FileScannerThread: public QThread 00020 { 00021 public: 00022 FileScannerThread(ImportMusicDialog *parent); 00023 virtual void run(); 00024 00025 private: 00026 ImportMusicDialog *m_parent; 00027 }; 00028 00029 class ImportMusicDialog : public MythThemedDialog 00030 { 00031 00032 Q_OBJECT 00033 00034 public: 00035 00036 ImportMusicDialog(MythMainWindow *parent, const char* name = 0); 00037 ~ImportMusicDialog(); 00038 00039 bool somethingWasImported() { return m_somethingWasImported; } 00040 void doScan(void); 00041 00042 public slots: 00043 void editLostFocus(); 00044 void addAllNewPressed(void); 00045 void playPressed(void); 00046 void addPressed(void); 00047 void nextNewPressed(void); 00048 void locationPressed(void); 00049 void coverArtPressed(void); 00050 00051 void nextPressed(void); 00052 void prevPressed(void); 00053 void showEditMetadataDialog(void); 00054 void scanPressed(void); 00055 00056 // popup menu 00057 void showMenu(void); 00058 void closeMenu(void); 00059 void saveDefaults(void); 00060 void setCompilation(void); 00061 void setCompilationArtist(void); 00062 void setArtist(void); 00063 void setAlbum(void); 00064 void setYear(void); 00065 void setGenre(void); 00066 void setRating(void); 00067 void setTitleWordCaps(void); 00068 void setTitleInitialCap(void); 00069 00070 private: 00071 void keyPressEvent(QKeyEvent *e); 00072 void wireUpTheme(); 00073 void fillWidgets(); 00074 void startScan(void); 00075 void scanDirectory(QString &directory, vector<TrackInfo*> *tracks); 00076 void showImportCoverArtDialog(); 00077 00078 bool m_somethingWasImported; 00079 vector<TrackInfo*> *m_tracks; 00080 QStringList m_sourceFiles; 00081 int m_currentTrack; 00082 00083 // 00084 // GUI stuff 00085 // 00086 UIRemoteEditType *m_location_edit; 00087 UIPushButtonType *m_location_button; 00088 UITextButtonType *m_scan_button; 00089 UITextButtonType *m_coverart_button; 00090 00091 UITextType *m_filename_text; 00092 UITextType *m_compartist_text; 00093 UITextType *m_artist_text; 00094 UITextType *m_album_text; 00095 UITextType *m_title_text; 00096 UITextType *m_genre_text; 00097 UITextType *m_year_text; 00098 UITextType *m_track_text; 00099 00100 UIPushButtonType *m_next_button; 00101 UIPushButtonType *m_prev_button; 00102 00103 UITextType *m_current_text; 00104 UITextType *m_status_text; 00105 00106 UITextButtonType *m_play_button; 00107 UITextButtonType *m_add_button; 00108 UITextButtonType *m_addallnew_button; 00109 UITextButtonType *m_nextnew_button; 00110 00111 UICheckBoxType *m_compilation_check; 00112 00113 MythPopupBox *m_popupMenu; 00114 00115 // default metadata values 00116 bool m_defaultCompilation; 00117 QString m_defaultCompArtist; 00118 QString m_defaultArtist; 00119 QString m_defaultAlbum; 00120 QString m_defaultGenre; 00121 int m_defaultYear; 00122 int m_defaultRating; 00123 bool m_haveDefaults; 00124 }; 00125 00127 00128 class ImportCoverArtDialog : public MythThemedDialog 00129 { 00130 00131 Q_OBJECT 00132 00133 public: 00134 00135 ImportCoverArtDialog(const QString &sourceDir, Metadata *metadata, 00136 MythMainWindow *parent, const char* name = 0); 00137 ~ImportCoverArtDialog(); 00138 00139 00140 public slots: 00141 void copyPressed(void); 00142 void prevPressed(void); 00143 void nextPressed(void); 00144 void selectorChanged(int item); 00145 00146 private: 00147 void wireUpTheme(); 00148 void keyPressEvent(QKeyEvent *e); 00149 void scanDirectory(void); 00150 void updateStatus(void); 00151 void updateTypeSelector(void); 00152 00153 QStringList m_filelist; 00154 QString m_sourceDir; 00155 Metadata *m_metadata; 00156 int m_currentFile; 00157 QString m_saveFilename; 00158 00159 // 00160 // GUI stuff 00161 // 00162 UITextType *m_filename_text; 00163 UITextType *m_current_text; 00164 UITextType *m_status_text; 00165 UITextType *m_destination_text; 00166 00167 UIImageType *m_coverart_image; 00168 UISelectorType *m_type_selector; 00169 00170 UIPushButtonType *m_next_button; 00171 UIPushButtonType *m_prev_button; 00172 UITextButtonType *m_copy_button; 00173 UITextButtonType *m_exit_button; 00174 }; 00175 00176 #endif
1.5.5