00001 #ifndef IMPORTMUSIC_H_ 00002 #define IMPORTMUSIC_H_ 00003 00004 #include <iostream> 00005 #include <vector> 00006 using namespace std; 00007 00008 #include <QStringList> 00009 00010 #include <mythscreentype.h> 00011 #include <mthread.h> 00012 00013 class Metadata; 00014 class ImportMusicDialog; 00015 00016 class MythUIText; 00017 class MythUITextEdit; 00018 class MythUIImage; 00019 class MythUIButton; 00020 class MythUIButtonList; 00021 class MythUICheckBox; 00022 class MythDialogBox; 00023 00024 typedef struct 00025 { 00026 Metadata *metadata; 00027 bool isNewTune; 00028 bool metadataHasChanged; 00029 } TrackInfo; 00030 00031 class FileScannerThread: public MThread 00032 { 00033 public: 00034 FileScannerThread(ImportMusicDialog *parent); 00035 virtual void run(); 00036 00037 private: 00038 ImportMusicDialog *m_parent; 00039 }; 00040 00041 class ImportMusicDialog : public MythScreenType 00042 { 00043 00044 Q_OBJECT 00045 00046 public: 00047 ImportMusicDialog(MythScreenStack *parent); 00048 ~ImportMusicDialog(); 00049 00050 bool Create(void); 00051 bool keyPressEvent(QKeyEvent *); 00052 void customEvent(QEvent *); 00053 00054 bool somethingWasImported() { return m_somethingWasImported; } 00055 void doScan(void); 00056 00057 public slots: 00058 void addAllNewPressed(void); 00059 void playPressed(void); 00060 void addPressed(void); 00061 void nextNewPressed(void); 00062 void locationPressed(void); 00063 void coverArtPressed(void); 00064 00065 void nextPressed(void); 00066 void prevPressed(void); 00067 void showEditMetadataDialog(void); 00068 void startScan(void); 00069 void doExit(bool ok); 00070 00071 // popup menu 00072 void showMenu(void); 00073 void saveDefaults(void); 00074 void setCompilation(void); 00075 void setCompilationArtist(void); 00076 void setArtist(void); 00077 void setAlbum(void); 00078 void setYear(void); 00079 void setTrack(void); 00080 void setGenre(void); 00081 void setRating(void); 00082 void setTitleWordCaps(void); 00083 void setTitleInitialCap(void); 00084 void metadataChanged(void); 00085 00086 signals: 00087 void importFinished(void); 00088 00089 private: 00090 void fillWidgets(); 00091 void scanDirectory(QString &directory, vector<TrackInfo*> *tracks); 00092 void showImportCoverArtDialog(); 00093 00094 bool m_somethingWasImported; 00095 vector<TrackInfo*> *m_tracks; 00096 QStringList m_sourceFiles; 00097 int m_currentTrack; 00098 Metadata *m_playingMetaData; 00099 00100 // GUI stuff 00101 MythUITextEdit *m_locationEdit; 00102 MythUIButton *m_locationButton; 00103 MythUIButton *m_scanButton; 00104 MythUIButton *m_coverartButton; 00105 00106 MythUIText *m_filenameText; 00107 MythUIText *m_compartistText; 00108 MythUIText *m_artistText; 00109 MythUIText *m_albumText; 00110 MythUIText *m_titleText; 00111 MythUIText *m_genreText; 00112 MythUIText *m_yearText; 00113 MythUIText *m_trackText; 00114 00115 MythUIButton *m_nextButton; 00116 MythUIButton *m_prevButton; 00117 00118 MythUIText *m_currentText; 00119 MythUIText *m_statusText; 00120 00121 MythUIButton *m_playButton; 00122 MythUIButton *m_addButton; 00123 MythUIButton *m_addallnewButton; 00124 MythUIButton *m_nextnewButton; 00125 00126 MythUICheckBox *m_compilationCheck; 00127 00128 MythDialogBox *m_popupMenu; 00129 00130 // default metadata values 00131 bool m_defaultCompilation; 00132 QString m_defaultCompArtist; 00133 QString m_defaultArtist; 00134 QString m_defaultAlbum; 00135 QString m_defaultGenre; 00136 int m_defaultYear; 00137 int m_defaultRating; 00138 bool m_haveDefaults; 00139 }; 00140 00142 00143 class ImportCoverArtDialog : public MythScreenType 00144 { 00145 00146 Q_OBJECT 00147 00148 public: 00149 00150 ImportCoverArtDialog(MythScreenStack *parent, const QString &sourceDir, 00151 Metadata *metadata); 00152 ~ImportCoverArtDialog(); 00153 00154 bool Create(void); 00155 bool keyPressEvent(QKeyEvent *); 00156 00157 public slots: 00158 void copyPressed(void); 00159 void prevPressed(void); 00160 void nextPressed(void); 00161 void selectorChanged(void); 00162 00163 private: 00164 void scanDirectory(void); 00165 void updateStatus(void); 00166 void updateTypeSelector(void); 00167 00168 QStringList m_filelist; 00169 QString m_sourceDir; 00170 Metadata *m_metadata; 00171 int m_currentFile; 00172 QString m_saveFilename; 00173 00174 // 00175 // GUI stuff 00176 // 00177 MythUIText *m_filenameText; 00178 MythUIText *m_currentText; 00179 MythUIText *m_statusText; 00180 MythUIText *m_destinationText; 00181 00182 MythUIImage *m_coverartImage; 00183 MythUIButtonList *m_typeList; 00184 00185 MythUIButton *m_nextButton; 00186 MythUIButton *m_prevButton; 00187 MythUIButton *m_copyButton; 00188 MythUIButton *m_exitButton; 00189 }; 00190 00191 #endif
1.6.3