diff --git a/core/audex.h b/core/audex.h index 1c0787b..de62be8 100644 --- a/core/audex.h +++ b/core/audex.h @@ -1,246 +1,246 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef AUDEX_HEADER #define AUDEX_HEADER #include #include #include #include #include #include #include "models/profilemodel.h" #include "models/cddamodel.h" #include "utils/patternparser.h" #include "utils/playlist.h" #include "utils/cddaextractthread.h" #include "utils/wavefilewriter.h" #include "utils/encoderwrapper.h" #include "utils/tmpdir.h" #include "utils/upload.h" #include "utils/hashlist.h" #include "utils/parameters.h" #include "utils/cuesheetwriter.h" #include "utils/discidcalculator.h" #include "preferences.h" class AudexJob : public QObject { Q_OBJECT public: - AudexJob(QObject *parent = 0) : QObject(parent) { + explicit AudexJob(QObject *parent = 0) : QObject(parent) { source_filename = ""; target_filename = ""; _trackno = 0; } ~AudexJob() { } void setSourceFilename(const QString& n) { source_filename = n; } QString sourceFilename() const { return source_filename; } void setTargetFilename(const QString& n) { target_filename = n; } QString targetFilename() const { return target_filename; } void setTrackNo(const int t) { _trackno = t; } int trackNo() const { return _trackno; } private: QString source_filename; QString target_filename; int _trackno; }; class AudexJobs : public QObject { Q_OBJECT public: - AudexJobs(QObject *parent = 0) : QObject(parent) { + explicit AudexJobs(QObject *parent = 0) : QObject(parent) { job_in_progress = false; } ~AudexJobs() { for (int i = 0; i < cache.count(); i++) { //make really sure all files are away QFile file(cache.at(i)->sourceFilename()); if (file.exists()) file.remove(); delete cache.at(i); } } AudexJob* orderJob() { if (job_queue.isEmpty()) { return NULL; } else { job_in_progress = true; return job_queue.dequeue(); } } void reportJobFinished() { job_in_progress = false; } bool jobInProgress() { return job_in_progress; } bool pendingJobs() { return (job_queue.count() > 0); } public slots: void addNewJob(const QString& sourceFilename, const QString& targetFilename, const int trackno) { AudexJob *j = new AudexJob(); j->setSourceFilename(sourceFilename); j->setTargetFilename(targetFilename); j->setTrackNo(trackno); job_queue.enqueue(j); cache.append(j); emit newJobAvailable(); } signals: void newJobAvailable(); private: QQueue job_queue; QList cache; bool job_in_progress; }; class Audex : public QObject { Q_OBJECT public: Audex(QWidget* parent, ProfileModel *profile_model, CDDAModel *cdda_model); ~Audex(); bool prepare(); public slots: void start(); void cancel(); const QStringList& extractProtocol(); const QStringList& encoderProtocol(); private slots: void start_extract(); void finish_extract(); void start_encode(); void finish_encode(); void calculate_speed_extract(); void calculate_speed_encode(); void progress_extract(int percent_of_track, int sector, int overall_sectors_read); void progress_encode(int percent); void write_to_wave(const QByteArray& data); void slot_error(const QString& message, const QString& details = QString()); void slot_warning(const QString& message); void slot_info(const QString& message); void check_if_thread_still_running(); signals: void changedExtractTrack(int no, int total, const QString& artist, const QString& title); void changedEncodeTrack(int no, int total, const QString& filename); void progressExtractTrack(int percent); void progressExtractOverall(int percent); void progressEncodeTrack(int percent); void progressEncodeOverall(int percent); void speedExtract(double times); void speedEncode(double times); void finished(bool successful); void timeout(); void error(const QString& message, const QString& details = QString()); void warning(const QString& message); void info(const QString& message); private: QWidget *parent; ProfileModel *profile_model; CDDAModel *cdda_model; EncoderWrapper *encoder_wrapper; CDDAExtractThread *cdda_extract_thread; AudexJobs *jobs; WaveFileWriter *wave_file_writer; TmpDir *tmp_dir; QString p_profile_name; QString p_suffix; bool p_single_file; bool construct_target_filename(QString& targetFilename, int trackno, int cdno, int nooftracks, int gindex, const QString& artist, const QString& title, const QString& tartist, const QString& ttitle, const QString& date, const QString& genre, const QString& ext, const QString& basepath, bool fat_compatible, bool replacespaceswithunderscores, bool _2digitstracknum, bool overwrite_existing_files, bool is_first_track); bool construct_target_filename_for_singlefile(QString& targetFilename, int cdno, int nooftracks, const QString& artist, const QString& title, const QString& date, const QString& genre, const QString& ext, const QString& basepath, bool overwrite_existing_files); bool check(); QString tmp_path; QString target_dir; bool _finished; bool _finished_successful; void request_finish(bool successful); void execute_finish(); int process_counter; bool timeout_done; int timeout_counter; /*PROCESS 1: EXTRACTING*/ QString ex_track_source_filename; QString ex_track_target_filename; int ex_track_index; int ex_track_count; QTimer *timer_extract; int current_sector; int last_measuring_point_sector; int overall_frames; /*PROCESS 2: ENCODING*/ QString en_track_filename; QString en_track_target_filename; int en_track_index; int en_track_count; QTimer *timer_encode; int current_encoder_percent; int last_measuring_point_encoder_percent; bool p_prepare_dir(QString& filename, const QString& targetDirIfRelative, const bool overwrite = false); bool p_mkdir(const QString& absoluteFilePath); qreal p_size_of_all_files(const QStringList& filenames) const; }; #endif diff --git a/dialogs/cddaheaderdatadialog.h b/dialogs/cddaheaderdatadialog.h index 448061d..e1d74bc 100644 --- a/dialogs/cddaheaderdatadialog.h +++ b/dialogs/cddaheaderdatadialog.h @@ -1,57 +1,57 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef CDDAHEADERDATADIALOG_H #define CDDAHEADERDATADIALOG_H #include #include #include #include #include "models/cddamodel.h" #include "utils/discidcalculator.h" #include "ui_cddaheaderdatawidgetUI.h" class CDDAHeaderDataDialog : public QDialog { Q_OBJECT public: - CDDAHeaderDataDialog(CDDAModel *cddaModel, QWidget *parent = 0); + explicit CDDAHeaderDataDialog(CDDAModel *cddaModel, QWidget *parent = 0); ~CDDAHeaderDataDialog(); private slots: void save(); void trigger_changed(); void enable_checkbox_multicd(bool enabled); void slotAccepted(); void slotApplied(); private: Ui::CDDAHeaderDataWidgetUI ui; CDDAModel *cdda_model; QPushButton *okButton; QPushButton *applyButton; }; #endif diff --git a/dialogs/commandwizarddialog.h b/dialogs/commandwizarddialog.h index fdee180..d9f7e81 100644 --- a/dialogs/commandwizarddialog.h +++ b/dialogs/commandwizarddialog.h @@ -1,76 +1,76 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef COMMANDWIZARDDIALOG_H #define COMMANDWIZARDDIALOG_H #include #include #include #include #include "utils/patternparser.h" #include "ui_commandwizardwidgetUI.h" class CommandWizardDialog : public QDialog { Q_OBJECT public: - CommandWizardDialog(const QString& command, QWidget *parent = 0); + explicit CommandWizardDialog(const QString& command, QWidget *parent = 0); ~CommandWizardDialog(); QString command; private slots: void trigger_changed(); void about_commandline_schemes(); void about_parameters(); void insAlbumArtist(); void insAlbumTitle(); void insTrackArtist(); void insTrackTitle(); void insTrackNo(); void insCDNo(); void insDate(); void insGenre(); void insCoverFile(); void insNoOfTracks(); void insInFile(); void insOutFile(); void update_example(); void slotAccepted(); void slotApplied(); private: Ui::CommandWizardWidgetUI ui; bool save(); QPushButton *okButton; QPushButton *applyButton; }; #endif diff --git a/dialogs/coverbrowserdialog.h b/dialogs/coverbrowserdialog.h index 62afdcc..c5828bd 100644 --- a/dialogs/coverbrowserdialog.h +++ b/dialogs/coverbrowserdialog.h @@ -1,79 +1,79 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef COVERBROWSERDIALOG_H #define COVERBROWSERDIALOG_H #include #include #include #include #include #include "preferences.h" #include "utils/coverfetcher.h" #include "dialogs/errordialog.h" #include "ui_coverbrowserwidgetUI.h" class CoverBrowserDialog : public QDialog { Q_OBJECT public: - CoverBrowserDialog(QWidget *parent = 0); + explicit CoverBrowserDialog(QWidget *parent = 0); ~CoverBrowserDialog(); inline int count() { return cover_fetcher.count(); } public slots: void fetchThumbnails(const QString& searchstring, const int fetchCount = 0); void startFetchCover(const int no); signals: void coverFetched(const QByteArray& cover); void allCoverThumbnailsFetched(); void nothingFetched(); private slots: void select_this(QListWidgetItem* item); void enable_select_button(); void add_item(const QByteArray& cover, const QString& caption, int no); void all_fetched(); void nothing_fetched(); void cover_fetched(const QByteArray& cover); void error(const QString& description, const QString& solution); void slotAccepted(); private: Ui::CoverBrowserWidgetUI ui; CoverFetcher cover_fetcher; QPushButton *okButton; void setup(); }; #endif diff --git a/dialogs/patternwizarddialog.h b/dialogs/patternwizarddialog.h index 7893675..880f3d5 100644 --- a/dialogs/patternwizarddialog.h +++ b/dialogs/patternwizarddialog.h @@ -1,71 +1,71 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef PATTERNWIZARDDIALOG_H #define PATTERNWIZARDDIALOG_H #include #include #include #include #include "utils/patternparser.h" #include "ui_patternwizardwidgetUI.h" class PatternWizardDialog : public QDialog { Q_OBJECT public: - PatternWizardDialog(const QString& pattern, QWidget *parent = 0); + explicit PatternWizardDialog(const QString& pattern, QWidget *parent = 0); ~PatternWizardDialog(); QString pattern; private slots: void trigger_changed(); void about_filename_schemes(); void about_parameters(); void insAlbumArtist(); void insAlbumTitle(); void insTrackArtist(); void insTrackTitle(); void insTrackNo(); void insCDNo(); void insDate(); void insGenre(); void insSuffix(); void insNoOfTracks(); void update_example(); void slotAccepted(); void slotApplied(); private: Ui::PatternWizardWidgetUI ui; bool save(); QPushButton *applyButton; }; #endif diff --git a/dialogs/profiledatacuesheetdialog.h b/dialogs/profiledatacuesheetdialog.h index db8efeb..5d0387b 100644 --- a/dialogs/profiledatacuesheetdialog.h +++ b/dialogs/profiledatacuesheetdialog.h @@ -1,58 +1,58 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef PROFILEDATACUESHEETDIALOG_H #define PROFILEDATACUESHEETDIALOG_H #include #include #include #include "simplepatternwizarddialog.h" #include "ui_profiledatacuesheetwidgetUI.h" class ProfileDataCueSheetDialog : public QDialog { Q_OBJECT public: - ProfileDataCueSheetDialog(const QString& pattern, QWidget *parent = 0); + explicit ProfileDataCueSheetDialog(const QString& pattern, QWidget *parent = 0); ~ProfileDataCueSheetDialog(); QString pattern; protected slots: void pattern_wizard(); private slots: void trigger_changed(); void slotAccepted(); void slotApplied(); private: Ui::ProfileDataCueSheetWidgetUI ui; QPushButton *applyButton; bool save(); }; #endif diff --git a/dialogs/profiledatasinglefiledialog.h b/dialogs/profiledatasinglefiledialog.h index 8d1dee7..a5b75e8 100644 --- a/dialogs/profiledatasinglefiledialog.h +++ b/dialogs/profiledatasinglefiledialog.h @@ -1,58 +1,58 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef PROFILEDATASINGLEFILEDIALOG_H #define PROFILEDATASINGLEFILEDIALOG_H #include #include #include #include "simplepatternwizarddialog.h" #include "ui_profiledatasinglefilewidgetUI.h" class ProfileDataSingleFileDialog : public QDialog { Q_OBJECT public: - ProfileDataSingleFileDialog(const QString& pattern, QWidget *parent = 0); + explicit ProfileDataSingleFileDialog(const QString& pattern, QWidget *parent = 0); ~ProfileDataSingleFileDialog(); QString pattern; protected slots: void pattern_wizard(); private slots: void trigger_changed(); void slotAccepted(); void slotApplied(); private: Ui::ProfileDataSingleFileWidgetUI ui; QPushButton *applyButton; bool save(); }; #endif diff --git a/mainwindow.h b/mainwindow.h index eac1c83..c9c2f95 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -1,136 +1,136 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "utils/error.h" #include "utils/cuesheetwriter.h" #include "models/cddamodel.h" #include "models/profilemodel.h" #include "preferences.h" #include "widgets/generalsettingswidget.h" #include "widgets/devicewidget.h" #include "widgets/profilewidget.h" #include "widgets/remoteserversettingswidget.h" #include "widgets/cddaheaderwidget.h" #include "dialogs/extractingprogressdialog.h" #include "dialogs/errordialog.h" #include "utils/encoderassistant.h" class MainWindow : public KXmlGuiWindow { Q_OBJECT public: - MainWindow(QWidget *parent = 0); + explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: bool firstStart(); private Q_SLOTS: void eject(); void cddb_lookup(); void cddb_submit(); void rip(); void configure(); void new_audio_disc_detected(); void audio_disc_removed(); void cddb_lookup_start(); void cddb_lookup_done(const bool successful); void update_layout(); void enable_layout(bool enabled); void enable_submit(bool enabled = true); void disable_submit(); void configuration_updated(const QString& dialog_name); void current_profile_updated_from_ui(int row); void update_profile_action(int index); void update_profile_action(); void split_titles(); void swap_artists_and_titles(); void capitalize(); void auto_fill_artists(); void toggle(const QModelIndex &idx); void resizeColumns(); void select_all(); void select_none(); void invert_selection(); void cdda_context_menu(const QPoint& pos); void selection_changed(const int num_selected); private: CDDAModel *cdda_model; ProfileModel *profile_model; QLabel *profile_label; KComboBox *profile_combobox; void setup_actions(); void setup_layout(); QTreeView *cdda_tree_view; QDockWidget *cdda_header_dock; CDDAHeaderWidget *cdda_header_widget; bool layout_enabled; int current_profile_index; void set_profile(int profile_index); }; #endif diff --git a/models/cddamodel.h b/models/cddamodel.h index d42865c..d847fa7 100644 --- a/models/cddamodel.h +++ b/models/cddamodel.h @@ -1,219 +1,219 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef CDDAMODEL_H #define CDDAMODEL_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "utils/cddadevices.h" #include "utils/cddaparanoia.h" #include "utils/cachedimage.h" #include "utils/error.h" #define CDDA_MODEL_COLUMN_RIP_LABEL i18n("Rip") #define CDDA_MODEL_COLUMN_TRACK_LABEL i18n("Track") #define CDDA_MODEL_COLUMN_ARTIST_LABEL i18n("Artist") #define CDDA_MODEL_COLUMN_TITLE_LABEL i18n("Title") #define CDDA_MODEL_COLUMN_LENGTH_LABEL i18n("Length") enum CDDAColumms { CDDA_MODEL_COLUMN_RIP_INDEX = 0, CDDA_MODEL_COLUMN_TRACK_INDEX, CDDA_MODEL_COLUMN_ARTIST_INDEX, CDDA_MODEL_COLUMN_TITLE_INDEX, CDDA_MODEL_COLUMN_LENGTH_INDEX, CDDA_MODEL_COLUMN_COUNT }; #define CDDA_MODEL_INTERNAL_ROLE 1982 /** kde audio disc model **/ class CDDAModel : public QAbstractTableModel { Q_OBJECT public: - CDDAModel(QObject *parent = 0); + explicit CDDAModel(QObject *parent = 0); ~CDDAModel(); inline CDDAParanoia *paranoia() const { return pn; } inline const QString& device() const { return _device; } int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; Qt::ItemFlags flags(const QModelIndex &index) const; void setArtist(const QString& a); const QString artist() const; void setTitle(const QString& t); const QString title() const; //category must be cddb compatible //(blues, classical, country, data, //folk, jazz, misc, newage, reggae, //rock, soundtrack) void setCategory(const QString& c); const QString category() const; void setGenre(const QString& g); const QString genre() const; void setYear(const QString& year); const QString year() const; void setExtendedData(const QStringList& e); const QStringList extendedData() const; void setCDNum(const int n); int cdNum() const; void setTrackOffset(const int n); int trackOffset() const; int guessMultiCD(QString& newTitle) const; void setMultiCD(const bool multi); bool isMultiCD() const; void setCustomData(const QString& type, const QVariant& data); const QVariant customData(const QString& type) const; void setCustomDataPerTrack(const int n, const QString& type, const QVariant& data); const QVariant getCustomDataPerTrack(const int n, const QString& type); CachedImage* cover() const; const QImage coverImage() const; quint16 coverChecksum() const; bool setCover(const QByteArray& data); bool setCover(const QString& filename); bool saveCoverToFile(const QString& filename); bool isCoverEmpty() const; void clearCover(); const QString coverSupportedMimeTypeList() const; bool guessVarious() const; void setVarious(bool various); bool isVarious(); void swapArtistAndTitleOfTracks(); void swapArtistAndTitle(); void splitTitleOfTracks(const QString& divider); void capitalizeTracks(); void capitalizeHeader(); void setTitleArtistsFromHeader(); int numOfTracks() const; int numOfAudioTracks() const; int numOfAudioTracksInSelection() const; int length() const; int lengthOfAudioTracks() const; int lengthOfAudioTracksInSelection() const; int lengthOfTrack(int n) const; const QList discSignature() const; bool isAudioTrack(int n) const; void clear(); inline bool empty() { return _empty; } inline const QSet& selectedTracks() const { return sel_tracks; } void toggle(int row); bool isTrackInSelection(int n) const; void invertSelection(); void selectAll(); void selectNone(); bool isModified() const; void confirm(); Error lastError() const; public slots: void lookupCDDB(); bool submitCDDB(); void eject(); signals: void audioDiscDetected(); void audioDiscRemoved(); void cddbLookupStarted(); void cddbLookupDone(const bool successful); void cddbDataModified(); void cddbDataSubmited(const bool successful); void hasSelection(bool has_selection); void selectionChanged(const int num_selected); private slots: void new_audio_disc_available(const QString& udi); void audio_disc_removed(const QString& udi); void disc_information_modified(); void lookup_cddb_done(KCDDB::Result result); private: QString _device; QString _udi; CDDAParanoia *pn; CDDADevices *devices; KCDDB::Client *cddb; KCDDB::CDInfo cd_info; CachedImage *_cover; bool modified; bool _empty; // no metadata available yet Error error; bool cddb_transaction_pending; QSet sel_tracks; void _toggle(const unsigned int track); const QString capitalize(const QString &s); void set_default_values(); void modify(); }; #endif diff --git a/models/profilemodel.h b/models/profilemodel.h index c4e33c1..f4f1308 100644 --- a/models/profilemodel.h +++ b/models/profilemodel.h @@ -1,248 +1,248 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef PROFILEMODEL_HEADER #define PROFILEMODEL_HEADER #include #include #include #include #include #include #include #include "utils/error.h" #include "utils/encoderassistant.h" #define DEFAULT_PROFILEINDEX -1 #define DEFAULT_NAME "" #define DEFAULT_ICON "audio-x-generic" #define DEFAULT_ENCODER_SELECTED 0 #define DEFAULT_ENCODER_PARAMETERS "" #define DEFAULT_PATTERN "$" VAR_ALBUM_ARTIST"/$" VAR_ALBUM_TITLE"/$" VAR_TRACK_NO" - $" VAR_TRACK_TITLE".$" VAR_SUFFIX #define DEFAULT_FAT32 false #define DEFAULT_UNDERSCORE false #define DEFAULT_2DIGITSTRACKNUM true #define DEFAULT_SC true #define DEFAULT_SC_SCALE false #define DEFAULT_SC_SIZE QSize(600, 600) #define DEFAULT_SC_FORMAT "JPEG" #define DEFAULT_SC_NAME "$" VAR_ALBUM_TITLE".$" VAR_SUFFIX #define DEFAULT_PL true #define DEFAULT_PL_FORMAT "M3U" #define DEFAULT_PL_NAME "$" VAR_ALBUM_TITLE".$" VAR_SUFFIX #define DEFAULT_PL_ABS_FILE_PATH false #define DEFAULT_PL_UTF8 true #define DEFAULT_INF false #define DEFAULT_INF_TEXT QStringList() #define DEFAULT_INF_NAME "info" #define DEFAULT_INF_SUFFIX "nfo" #define DEFAULT_HL false #define DEFAULT_HL_FORMAT "SFV" #define DEFAULT_HL_NAME "checksums.$" VAR_SUFFIX #define DEFAULT_CUE false #define DEFAULT_CUE_NAME "$" VAR_ALBUM_ARTIST" - $" VAR_ALBUM_TITLE".$" VAR_SUFFIX #define DEFAULT_SF false #define DEFAULT_SF_NAME "$" VAR_ALBUM_ARTIST"/$" VAR_ALBUM_TITLE"/$" VAR_ALBUM_ARTIST" - $" VAR_ALBUM_TITLE".$" VAR_SUFFIX enum ProfileColumns { PROFILE_MODEL_COLUMN_PROFILEINDEX_INDEX = 0, PROFILE_MODEL_COLUMN_NAME_INDEX, PROFILE_MODEL_COLUMN_ICON_INDEX, PROFILE_MODEL_COLUMN_ENCODER_SELECTED_INDEX, PROFILE_MODEL_COLUMN_PATTERN_INDEX, PROFILE_MODEL_COLUMN_FAT32COMPATIBLE_INDEX, PROFILE_MODEL_COLUMN_UNDERSCORE_INDEX, PROFILE_MODEL_COLUMN_2DIGITSTRACKNUM_INDEX, PROFILE_MODEL_COLUMN_SC_INDEX, PROFILE_MODEL_COLUMN_SC_SCALE_INDEX, PROFILE_MODEL_COLUMN_SC_SIZE_INDEX, PROFILE_MODEL_COLUMN_SC_FORMAT_INDEX, PROFILE_MODEL_COLUMN_SC_NAME_INDEX, PROFILE_MODEL_COLUMN_PL_INDEX, PROFILE_MODEL_COLUMN_PL_FORMAT_INDEX, PROFILE_MODEL_COLUMN_PL_NAME_INDEX, PROFILE_MODEL_COLUMN_PL_ABS_FILE_PATH_INDEX, PROFILE_MODEL_COLUMN_PL_UTF8_INDEX, PROFILE_MODEL_COLUMN_INF_INDEX, PROFILE_MODEL_COLUMN_INF_TEXT_INDEX, PROFILE_MODEL_COLUMN_INF_NAME_INDEX, PROFILE_MODEL_COLUMN_INF_SUFFIX_INDEX, PROFILE_MODEL_COLUMN_HL_INDEX, PROFILE_MODEL_COLUMN_HL_FORMAT_INDEX, PROFILE_MODEL_COLUMN_HL_NAME_INDEX, PROFILE_MODEL_COLUMN_CUE_INDEX, PROFILE_MODEL_COLUMN_CUE_NAME_INDEX, PROFILE_MODEL_COLUMN_SF_INDEX, PROFILE_MODEL_COLUMN_SF_NAME_INDEX, PROFILE_MODEL_COLUMN_ENCODER_LAME_PARAMETERS_INDEX, PROFILE_MODEL_COLUMN_ENCODER_OGGENC_PARAMETERS_INDEX, PROFILE_MODEL_COLUMN_ENCODER_FLAC_PARAMETERS_INDEX, PROFILE_MODEL_COLUMN_ENCODER_FAAC_PARAMETERS_INDEX, PROFILE_MODEL_COLUMN_ENCODER_WAVE_PARAMETERS_INDEX, PROFILE_MODEL_COLUMN_ENCODER_CUSTOM_PARAMETERS_INDEX, PROFILE_MODEL_COLUMN_NUM }; #define PROFILE_MODEL_PROFILEINDEX_KEY "profile_key" #define PROFILE_MODEL_NAME_KEY "name" #define PROFILE_MODEL_ICON_KEY "icon" #define PROFILE_MODEL_ENCODER_SELECTED_KEY "current_encoder" #define PROFILE_MODEL_PATTERN_KEY "pattern" #define PROFILE_MODEL_FAT32COMPATIBLE_KEY "fat32_compatible" #define PROFILE_MODEL_UNDERSCORE_KEY "underscore" #define PROFILE_MODEL_2DIGITSTRACKNUM_KEY "2_digits_tracknum" #define PROFILE_MODEL_SC_KEY "sc" #define PROFILE_MODEL_SC_SCALE_KEY "sc_scale" #define PROFILE_MODEL_SC_SIZE_KEY "sc_size" #define PROFILE_MODEL_SC_FORMAT_KEY "sc_format" #define PROFILE_MODEL_SC_NAME_KEY "sc_name" #define PROFILE_MODEL_PL_KEY "pl" #define PROFILE_MODEL_PL_FORMAT_KEY "pl_format" #define PROFILE_MODEL_PL_NAME_KEY "pl_name" #define PROFILE_MODEL_PL_ABS_FILE_PATH_KEY "pl_abs_file_path" #define PROFILE_MODEL_PL_UTF8_KEY "pl_utf8" #define PROFILE_MODEL_INF_KEY "inf" #define PROFILE_MODEL_INF_TEXT_KEY "inf_text" #define PROFILE_MODEL_INF_NAME_KEY "inf_name" #define PROFILE_MODEL_INF_SUFFIX_KEY "inf_suffix" #define PROFILE_MODEL_HL_KEY "hl" #define PROFILE_MODEL_HL_FORMAT_KEY "hl_format" #define PROFILE_MODEL_HL_NAME_KEY "hl_name" #define PROFILE_MODEL_CUE_KEY "cue" #define PROFILE_MODEL_CUE_NAME_KEY "cue_name" #define PROFILE_MODEL_SF_KEY "sf" #define PROFILE_MODEL_SF_NAME_KEY "sf_name" #define PROFILE_MODEL_COLUMN_ENCODER_LAME_PARAMETERS_KEY "lame_parameters" #define PROFILE_MODEL_COLUMN_ENCODER_OGGENC_PARAMETERS_KEY "oggenc_parameters" #define PROFILE_MODEL_COLUMN_ENCODER_FLAC_PARAMETERS_KEY "flac_parameters" #define PROFILE_MODEL_COLUMN_ENCODER_FAAC_PARAMETERS_KEY "faac_parameters" #define PROFILE_MODEL_COLUMN_ENCODER_WAVE_PARAMETERS_KEY "wave_parameters" #define PROFILE_MODEL_COLUMN_ENCODER_CUSTOM_PARAMETERS_KEY "custom_parameters" #define LABEL_MOBILE_QUALITY i18n(" (Mobile Quality)") #define LABEL_NORMAL_QUALITY i18n(" (Normal Quality)") #define LABEL_EXTREME_QUALITY i18n(" (Extreme Quality)") typedef QMap Profile; /** audex profile model **/ class ProfileModel : public QAbstractTableModel { Q_OBJECT public: - ProfileModel(QObject *parent = 0); + explicit ProfileModel(QObject *parent = 0); ~ProfileModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex()); bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex()); int currentProfileIndex() const; int currentProfileRow() const; int getRowByIndex(int profile_index) const; void clear(); bool nameExists(const QString& name) const; bool indexExists(int profile_index) const; int getNewIndex() const; void sortItems(); /**BEGIN: EncoderAssistant related */ void autoCreate(); //scans the system for encoders and create standard profiles EncoderAssistant::Encoder getSelectedEncoderFromCurrentIndex(); const Parameters getSelectedEncoderParametersFromCurrentIndex(); const QString getSelectedEncoderPatternFromCurrentIndex(); const QString getSelectedEncoderSuffixFromCurrentIndex(); const QString getSelectedEncoderNameAndVersion(); /**END: EncoderAssistant related */ Error lastError() const; public slots: void commit(); void revert(); int copy(const int profileRow); bool saveProfilesToFile(const QString& filename); bool loadProfilesFromFile(const QString& filename); void setCurrentProfileIndex(int profile_index); int setRowAsCurrentProfileIndex(int row); //returns profile index signals: void profilesRemovedOrInserted(); void currentProfileIndexChanged(int index); private: const Profile p_new_profile(); QList p_cache; int p_current_profile_index; Error p_error; void p_new_name(QString& name); void p_save(KConfig *config); void p_load(KConfig *config); }; #endif diff --git a/utils/3rdparty/crc32.h b/utils/3rdparty/crc32.h index d71af72..d3a6ef5 100644 --- a/utils/3rdparty/crc32.h +++ b/utils/3rdparty/crc32.h @@ -1,48 +1,48 @@ /*************************************************************************** crc32.h - description ------------------- copyright : (C) 2003 by Csaba Karai e-mail : krusader@users.sourceforge.net web site : http://krusader.sourceforge.net --------------------------------------------------------------------------- Description *************************************************************************** A db dD d8888b. db db .d8888. .d8b. d8888b. d88888b d8888b. 88 ,8P' 88 `8D 88 88 88' YP d8' `8b 88 `8D 88' 88 `8D 88,8P 88oobY' 88 88 `8bo. 88ooo88 88 88 88ooooo 88oobY' 88`8b 88`8b 88 88 `Y8b. 88~~~88 88 88 88~~~~~ 88`8b 88 `88. 88 `88. 88b d88 db 8D 88 88 88 .8D 88. 88 `88. YP YD 88 YD ~Y8888P' `8888Y' YP YP Y8888D' Y88888P 88 YD H e a d e r F i l e *************************************************************************** * * * 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 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef __CRC32_H__ #define __CRC32_H__ class CRC32 { private: unsigned long crc_accum; static unsigned long crc_table[ 256 ]; static bool crc_initialized; public: - CRC32( unsigned long initialValue = (unsigned long)-1 ); + explicit CRC32( unsigned long initialValue = (unsigned long)-1 ); void update( const unsigned char *buffer, int bufferLen ); unsigned long result(); }; #endif /* __CRC32_H__ */ diff --git a/utils/cachedimage.h b/utils/cachedimage.h index 43f1bfb..4ee48bb 100644 --- a/utils/cachedimage.h +++ b/utils/cachedimage.h @@ -1,81 +1,81 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef CACHEDIMAGE_H #define CACHEDIMAGE_H #include #include #include #include #include #include #include #include "utils/error.h" class CachedImage { public: CachedImage(); - CachedImage(const QByteArray& data); - CachedImage(const QString& filename); + explicit CachedImage(const QByteArray& data); + explicit CachedImage(const QString& filename); CachedImage(const CachedImage& other); CachedImage& operator=(const CachedImage& other); bool operator==(const CachedImage& other) const; bool operator!=(const CachedImage& other) const; ~CachedImage(); Error lastError() const; bool isEmpty() const; const QByteArray formatRaw() const; int dataSize(const QByteArray& format = "", const QSize& size = QSize()); const QByteArray coverRaw() const; const QSize size() const; const QImage coverImage() const; quint16 checksum() const; const QString supportedMimeTypeList(); const QList supportedFormats(); bool load(const QByteArray& data); bool load(const QString& filename); void clear(); bool save(const QString& filename, const QSize& size = QSize()); private: QByteArray _format; QByteArray _data; QSize _size; bool compare_format(const QByteArray& f1, const QByteArray& f2) const; bool _save(QIODevice *device, const QByteArray& format = "", const QSize& size = QSize()); QString mime_cache; Error _error; }; #endif diff --git a/utils/cddadevices.h b/utils/cddadevices.h index 2179bbb..14e0950 100644 --- a/utils/cddadevices.h +++ b/utils/cddadevices.h @@ -1,86 +1,86 @@ /* * AUDEX CDDA EXTRACTOR * * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . * */ #ifndef CDDADEVICES_H #define CDDADEVICES_H #include #include #include #include #include #include #include #include #include #include #include #include #include struct OpticalAudioDisc { QString name; Solid::Device device; }; class CDDADevices : public QObject { Q_OBJECT public: - CDDADevices(QObject *parent = 0); + explicit CDDADevices(QObject *parent = 0); ~CDDADevices(); const QString blockDevice(const QString& udi) const; const QStringList udiList() const; int discCount() const; public slots: void scanBus(); void eject(const QString& udi); //set display name void setName(const QString& udi, const QString& name); signals: void audioDiscDetected(const QString& udi); void audioDiscRemoved(const QString& udi); private slots: void p_solid_device_added(const QString& udi); void p_solid_device_removed(const QString& udi); private: QHash p_discs; bool p_is_optical_audio_disc(const Solid::Device& device) const; void p_clear(); }; #endif diff --git a/utils/cddaparanoia.h b/utils/cddaparanoia.h index 7b53183..2c156cc 100644 --- a/utils/cddaparanoia.h +++ b/utils/cddaparanoia.h @@ -1,123 +1,123 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef CDDAPARANOIA_HEADER #define CDDAPARANOIA_HEADER #include #include #include #include extern "C" { #include #include } // from cdda_interface.h #define CD_FRAMESIZE_RAW 2352 #define CDROM_FRAMESIZE_RAW 2048 #define PREGAP 150 // from cdda_paranoia.h #define PARANOIA_CB_READ 0 #define PARANOIA_CB_VERIFY 1 #define PARANOIA_CB_FIXUP_EDGE 2 #define PARANOIA_CB_FIXUP_ATOM 3 #define PARANOIA_CB_SCRATCH 4 #define PARANOIA_CB_REPAIR 5 #define PARANOIA_CB_SKIP 6 #define PARANOIA_CB_DRIFT 7 #define PARANOIA_CB_BACKOFF 8 #define PARANOIA_CB_OVERLAP 9 #define PARANOIA_CB_FIXUP_DROPPED 10 #define PARANOIA_CB_FIXUP_DUPED 11 #define PARANOIA_CB_READERR 12 class CDDAParanoia : public QObject { Q_OBJECT public: - CDDAParanoia(QObject *parent = 0); + explicit CDDAParanoia(QObject *parent = 0); ~CDDAParanoia(); bool setDevice(const QString& device = "/dev/cdrom"); QString device() const; void setParanoiaMode(int mode); /* default: 3 */ void setNeverSkip(bool b); void setMaxRetries(int m); /* default: 20 */ qint16* paranoiaRead(void (*callback)(long, int)); int paranoiaSeek(long sector, int mode); int firstSectorOfTrack(int track); int lastSectorOfTrack(int track); int firstSectorOfDisc(); int lastSectorOfDisc(); void sampleOffset(const int offset); int numOfTracks(); int numOfAudioTracks(); int length(); int numOfFrames(); //whole disc int lengthOfAudioTracks(); //length of all audio tracks int numOfFramesOfAudioTracks(); /*sum skipped (because it is an audio track) frames usually used to calculate overall percent*/ int numOfSkippedFrames(int n = 100); int lengthOfTrack(int n); int numOfFramesOfTrack(int n); double sizeOfTrack(int n); //in MiB int frameOffsetOfTrack(int n); bool isAudioTrack(int n); // First element is first track after lead-in, list of offsets, last element offset of lead-out // PREGAP is 150 frames = 2 seconds QList discSignature(const qint32 pregap = PREGAP); void reset(); signals: void error(const QString& message, const QString& details = QString()); private: QMutex mutex; QString _device; cdrom_drive *paranoia_drive; cdrom_paranoia *paranoia; int paranoia_mode; bool paranoia_never_skip; int paranoia_max_retries; bool _paranoia_init(); void _paranoia_free(); }; #endif diff --git a/utils/coverfetcher.h b/utils/coverfetcher.h index 450a432..354fbfa 100644 --- a/utils/coverfetcher.h +++ b/utils/coverfetcher.h @@ -1,95 +1,95 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef COVERFETCHER_HEADER #define COVERFETCHER_HEADER #include #include #include #include #include #include #include class CoverFetcher : public QObject { Q_OBJECT public: - CoverFetcher(QObject *parent = 0); + explicit CoverFetcher(QObject *parent = 0); ~CoverFetcher(); void startFetchThumbnails(const QString& searchstring, const int fetchNo = 8); void stopFetchThumbnails(); void startFetchCover(const int no); const QByteArray thumbnail(int index); const QString caption(int index); const QString tbnid(int index); inline int count() { return cover_names.count(); } enum Status { NOS, SEARCHING, FETCHING_THUMBNAIL, FETCHING_COVER }; inline Status status() const { return _status; } signals: void fetchedThumbnail(const QByteArray& thumbnail, const QString& caption, int no); void allCoverThumbnailsFetched(); void fetchedCover(const QByteArray& cover); void nothingFetched(); void statusChanged(Status status); void error(const QString& description, const QString& solution = QString()); void warning(const QString& description); void info(const QString& description); private slots: void fetched_html_data(KJob* job); void fetched_external_ip(KJob* job); private: int fetch_no; QStringList cover_urls_thumbnails; QStringList cover_urls; QStringList cover_names; QStringList cover_tbnids; QList cover_thumbnails; void clear() { cover_thumbnails.clear(); } KIO::TransferJob* job; Status _status; int f_i; QString external_ip; QString search_string; void parse_html_response(const QString& html); bool fetch_cover_thumbnail(); bool fetch_cover(const int no); }; #endif diff --git a/utils/cuesheetwriter.h b/utils/cuesheetwriter.h index 0140534..63969bd 100644 --- a/utils/cuesheetwriter.h +++ b/utils/cuesheetwriter.h @@ -1,49 +1,49 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef CUESHEETWRITER_H #define CUESHEETWRITER_H #include #include #include #include #include "config.h" #include "../models/cddamodel.h" #define FRAMES2SEC(frames) ((frames) / 75) class CueSheetWriter : public QObject { Q_OBJECT public: - CueSheetWriter(CDDAModel *model); + explicit CueSheetWriter(CDDAModel *model); ~CueSheetWriter(); QStringList cueSheet(const QString& binFilename) const; QStringList cueSheet(const QStringList& filenames) const; private: CDDAModel *model; QString p_filetype(const QString& filename) const; }; #endif diff --git a/utils/encoderwrapper.h b/utils/encoderwrapper.h index ec1df53..9d1c623 100644 --- a/utils/encoderwrapper.h +++ b/utils/encoderwrapper.h @@ -1,85 +1,85 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef ENCODERWRAPPER_HEADER #define ENCODERWRAPPER_HEADER #include #include #include #include #include "utils/cachedimage.h" #include "utils/patternparser.h" class EncoderWrapper : public QObject { Q_OBJECT public: - EncoderWrapper(QObject* parent = 0, const QString& commandPattern = "", const QString& encoderName = "", const bool deleteFractionFiles = true); + explicit EncoderWrapper(QObject* parent = 0, const QString& commandPattern = "", const QString& encoderName = "", const bool deleteFractionFiles = true); ~EncoderWrapper(); bool isProcessing(); const QStringList& protocol(); public slots: bool encode(int n, int cdno, int trackoffset, int nooftracks, const QString& artist, const QString& album, const QString& tartist, const QString& ttitle, const QString& genre, const QString& date, const QString& suffix, CachedImage *cover, bool fat_compatible, const QString& tmppath, const QString& input, const QString& output); void cancel(); private slots: void parseOutput(); void processFinished(int exitCode, QProcess::ExitStatus exitStatus); void processError(QProcess::ProcessError err); signals: void progress(int percent_of_track); void finished(); void error(const QString& message, const QString& details = QString()); void warning(const QString& message); void info(const QString& message); private: QString command_pattern; QString encoder_name; bool delete_fraction_files; QString encoder; QStringList _protocol; QString processing_filename; bool termination; int processing; KProcess proc; int not_found_counter; }; #endif diff --git a/utils/error.h b/utils/error.h index 8c54134..e9b96ee 100644 --- a/utils/error.h +++ b/utils/error.h @@ -1,73 +1,73 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef ERROR_H #define ERROR_H class Error { public: enum ErrorType { ERROR, WARNING }; - Error(const QString& message = "", const QString& details = "", const ErrorType errorType = Error::ERROR, QObject *parent = 0) { + explicit Error(const QString& message = "", const QString& details = "", const ErrorType errorType = Error::ERROR, QObject *parent = 0) { Q_UNUSED(parent); m = message; d = details; e = errorType; } Error(const Error& other) { m = other.m; d = other.d; e = other.e; } Error& operator=(const Error& other) { m = other.m; d = other.d; e = other.e; return *this; } ~Error() { } ErrorType errorType() const { return e; } bool isValid() const { return (!m.isEmpty()); } const QString message() const { return m; } const QString details() const { return d; } private: ErrorType e; QString m; QString d; }; typedef QList ErrorList; #endif diff --git a/utils/patternparser.h b/utils/patternparser.h index 0a3cb93..6d0bdef 100644 --- a/utils/patternparser.h +++ b/utils/patternparser.h @@ -1,196 +1,196 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef PATTERNPARSER_H #define PATTERNPARSER_H #include #include #include #include #include #include #include #include #include #include "config.h" #include "utils/cachedimage.h" #define IS_TRUE(val) ( ((val.toLower()=="true")||(val=="1")||(val.toLower()=="on")) ? true : false) #define VAR_FILENAME_PATTERN "filenamepattern" #define VAR_COMMAND_PATTERN "commandpattern" #define VAR_SIMPLE_PATTERN "simplepattern" #define VAR_TEXT_PATTERN "textpattern" #define VAR_ALBUM_ARTIST "artist" #define VAR_ALBUM_TITLE "title" #define VAR_TRACK_ARTIST "tartist" #define VAR_TRACK_TITLE "ttitle" #define VAR_TRACK_NO "trackno" #define VAR_CD_NO "cdno" #define VAR_DATE "date" #define VAR_GENRE "genre" #define VAR_SUFFIX "suffix" #define VAR_ENCODER "encoder" #define VAR_INPUT_FILE "i" #define VAR_OUTPUT_FILE "o" #define VAR_COVER_FILE "cover" #define VAR_DISCID "discid" #define VAR_CD_SIZE "size" #define VAR_CD_LENGTH "length" #define VAR_TODAY "today" #define VAR_NOW "now" #define VAR_LINEBREAK "br" #define VAR_AUDEX "audex" #define VAR_NO_OF_TRACKS "nooftracks" #define STANDARD_EMBED_COVER_FORMAT "jpg" class SaxHandler : public QXmlDefaultHandler { public: SaxHandler(); ~SaxHandler(); bool startElement(const QString& namespaceURI, const QString &localName, const QString& qName, const QXmlAttributes& atts); bool endElement(const QString& namespaceURI, const QString& localName, const QString& qName); bool characters(const QString& ch); bool fatalError(const QXmlParseException& exception); void setInputFile(const QString& input) { this->input = input; } void setOutputFile(const QString& output) { this->output = output; } void setTrackNo(const int trackno) { this->trackno = trackno; } void setCDNo(const int cdno) { this->cdno = cdno; } void setTrackOffset(const int trackoffset) { this->trackoffset = trackoffset; } void setArtist(const QString& artist) { this->artist = artist; } void setTitle(const QString& title) { this->title = title; } void setTrackArtist(const QString& tartist) { this->tartist = tartist; } void setTrackTitle(const QString& ttitle) { this->ttitle = ttitle; } void setDate(const QString& date) { this->date = date; } void setGenre(const QString& genre) { this->genre = genre; } void setSuffix(const QString& suffix) { this->suffix = suffix; } void setCover(CachedImage *cover) { this->cover = cover; } void setFAT32Compatible(const bool fat32compatible) { this->fat32compatible = fat32compatible; } void setReplaceSpacesWithUnderscores(const bool replacespaceswithunderscores) { this->replacespaceswithunderscores = replacespaceswithunderscores; } void set2DigitsTrackNum(const bool _2digitstracknum) { this->_2digitstracknum = _2digitstracknum; } void setTMPPath(const QString& tmppath) { this->tmppath = tmppath; } void setDiscid(const quint32 discid) { this->discid = discid; } void setSize(const qreal size) { this->size = size; } void setLength(const int length) { this->length = length; } void setNoOfTracks(const int nooftracks) { this->nooftracks = nooftracks; } void setDemoMode(const bool demomode) { this->demomode = demomode; } void setEncoder(const QString& encoder) { this->encoder = encoder; } inline const QString text() const { return p_text; } private: QString pattern; QString input; QString output; int trackno; int cdno; int trackoffset; QString artist; QString title; QString tartist; QString ttitle; QString date; QString genre; QString suffix; CachedImage *cover; bool fat32compatible; bool replacespaceswithunderscores; bool _2digitstracknum; QString tmppath; quint32 discid; qreal size; int length; int nooftracks; QString encoder; bool demomode; /*TEMP*/bool found_suffix; QString p_text; QString p_element; bool is_filename_pattern; bool is_command_pattern; bool is_simple_pattern; bool is_text_pattern; const QString make_compatible(const QString& string); const QString make_compatible_2(const QString& string); const QString make_fat32_compatible(const QString& string); const QString replace_spaces_with_underscores(const QString& string); const QString replace_char_list(const QXmlAttributes& atts, const QString& string); }; class PatternParser : public QObject { Q_OBJECT public: - PatternParser(QObject *parent = 0); + explicit PatternParser(QObject *parent = 0); ~PatternParser(); const QString parseFilenamePattern(const QString& pattern, int trackno, int cdno, int trackoffset, int nooftracks, const QString& artist, const QString& title, const QString& tartist, const QString& ttitle, const QString& date, const QString& genre, const QString& suffix, bool fat32compatible, bool replacespaceswithunderscores, bool _2digitstracknum); const QString parseCommandPattern(const QString& pattern, const QString& input, const QString& output, int trackno, int cdno, int trackoffset, int nooftracks, const QString& artist, const QString& title, const QString& tartist, const QString& ttitle, const QString& date, const QString& genre, const QString& suffix, CachedImage *cover, bool fat32compatible, const QString& tmppath, const QString& encoder, const bool demomode = false); const QString parseSimplePattern(const QString& pattern, int cdno, int nooftracks, const QString& artist, const QString& title, const QString& date, const QString& genre, const QString& suffix, bool fat32compatible); void parseInfoText(QStringList& text, const QString& artist, const QString& title, const QString& date, const QString& genre, const quint32 discid, const qreal size, const int length, const int nooftracks); signals: void error(const QString& message, const QString& details = QString()); private: const QString p_xmlize_pattern(const QString& pattern); }; #endif diff --git a/utils/playlist.h b/utils/playlist.h index c304854..a3f2e0d 100644 --- a/utils/playlist.h +++ b/utils/playlist.h @@ -1,115 +1,115 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef PLAYLIST_HEADER #define PLAYLIST_HEADER #include #include #include #include #include #include #include class PlaylistItem { public: PlaylistItem() { p_length = 0; } PlaylistItem(const PlaylistItem& other) { p_filename = other.p_filename; p_artist = other.p_artist; p_title = other.p_title; p_length = other.p_length; } PlaylistItem& operator=(const PlaylistItem& other) { p_filename = other.p_filename; p_artist = other.p_artist; p_title = other.p_title; p_length = other.p_length; return *this; } ~PlaylistItem() { } bool const operator==(const PlaylistItem& other) { return (p_filename==other.p_filename && p_title==other.p_title && p_artist==other.p_artist && p_length==other.p_length); } void clear() { p_filename.clear(); p_artist.clear(); p_title.clear(); p_length = 0; } void setFilename(const QString& filename) { p_filename = filename; } const QString filename() { return p_filename; } void setArtist(const QString& artist) { p_artist = artist; } const QString artist() { return p_artist; } void setTitle(const QString& title) { p_title = title; } const QString title() { return p_title; } void setLength(const int length) { p_length = length; } int length() { return p_length; } private: QString p_filename; QString p_artist; QString p_title; int p_length; //sec }; typedef QList PlaylistItemList; class Playlist { public: Playlist(); - Playlist(const QByteArray& playlist); + explicit Playlist(const QByteArray& playlist); ~Playlist(); void addPlaylist(const QByteArray& playlist); void clear(); void appendItem(const PlaylistItem& item); //if playlistPath is set, then filename paths will be relative to playlistPath QByteArray toM3U(const QString& playlistPath = "", const bool utf8 = false) const; QByteArray toPLS(const QString& playlistPath = "", const bool utf8 = false) const; QByteArray toXSPF() const; private: PlaylistItemList p_playlist; //guess the playlist format: m3u, pls, xspf const QString p_playlist_format(const QByteArray& playlist); void p_add_M3U(const QByteArray& playlist); void p_add_PLS(const QByteArray& playlist); void p_add_XSPF(const QByteArray& playlist); const PlaylistItem p_parse_m3u_metadata_line(const QString& line); }; #endif diff --git a/utils/tmpdir.h b/utils/tmpdir.h index ec10757..79da88a 100644 --- a/utils/tmpdir.h +++ b/utils/tmpdir.h @@ -1,56 +1,56 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef TMPDIR_H #define TMPDIR_H #include #include #include #include #include #include #include "utils/pid.h" class TmpDir : public QObject { Q_OBJECT public: - TmpDir(const QString& appName, const QString& sub = ""); + explicit TmpDir(const QString& appName, const QString& sub = ""); ~TmpDir(); const QString tmpPath(); inline const QString tmpPathBase() const { return p_tmp_path_base; } inline bool error() const { return p_error; } quint64 freeSpace() const; private: QString p_tmp_path_base; //e.g. /var/tmp QString p_tmp_path_app; //e.g. /var/tmp/audex.1234 QString p_tmp_path; //e.g. /car/tmp/audex.1234/sub bool p_error; bool p_create_dir(const QString &dirName); bool p_remove_dir(const QString &dirName); }; #endif diff --git a/utils/upload.h b/utils/upload.h index 24fff77..4d33f82 100644 --- a/utils/upload.h +++ b/utils/upload.h @@ -1,51 +1,51 @@ /* AUDEX CDDA EXTRACTOR * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.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 of the License, 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. If not, see . */ #ifndef UPLOAD_H #define UPLOAD_H #include #include #include #include #include #include #include #include class Upload : public QObject { Q_OBJECT public: - Upload(const QUrl &url, QObject *parent = 0); + explicit Upload(const QUrl &url, QObject *parent = 0); ~Upload(); void upload(const QString& targetpath, const QStringList& filelist); signals: void error(const QString& message, const QString& solution = QString()); void warning(const QString& message); void info(const QString& message); private: QUrl base_url; }; #endif