1 /* BEGIN_COMMON_COPYRIGHT_HEADER 2 * (c)LGPL2+ 3 * 4 * Flacon - audio File Encoder 5 * https://github.com/flacon/flacon 6 * 7 * Copyright: 2012-2013 8 * Alexander Sokoloff <sokoloff.a@gmail.com> 9 * 10 * This library is free software; you can redistribute it and/or 11 * modify it under the terms of the GNU Lesser General Public 12 * License as published by the Free Software Foundation; either 13 * version 2.1 of the License, or (at your option) any later version. 14 15 * This library is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 * Lesser General Public License for more details. 19 20 * You should have received a copy of the GNU Lesser General Public 21 * License along with this library; if not, write to the Free Software 22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 23 * 24 * END_COMMON_COPYRIGHT_HEADER */ 25 26 #ifndef MAINWINDOW_H 27 #define MAINWINDOW_H 28 29 #include <QMainWindow> 30 #include "ui_mainwindow.h" 31 #include "types.h" 32 #include <QPointer> 33 #include "converter.h" 34 35 namespace Ui { 36 class MainWindow; 37 } 38 39 class Project; 40 class Converter; 41 class Scanner; 42 43 class MainWindow : public QMainWindow, private Ui::MainWindow, private Messages::Handler 44 { 45 Q_OBJECT 46 47 public: 48 explicit MainWindow(QWidget *parent = nullptr); 49 ~MainWindow(); 50 51 public slots: 52 void addFileOrDir(const QString &fileName); 53 void startConvertAll(); 54 void startConvertSelected(); 55 void stopConvert(); 56 57 signals: 58 void downloadStarted(Disc *disc); 59 void downloadFinished(Disc *disc); 60 61 private slots: 62 void setPattern(); 63 void setOutDir(); 64 void setOutProfile(); 65 void setCodePage(); 66 67 void setControlsEnable(); 68 void refreshEdits(); 69 70 void openAddFileDialog(); 71 72 void setCueForDisc(Disc *disc); 73 void setAudioForDisc(Disc *disc, int audioFileNum); 74 void setCoverImage(Disc *disc); 75 void downloadDiscInfo(Disc *disc); 76 77 void removeDiscs(); 78 79 void setStartTrackNum(); 80 void setTrackTag(); 81 void setDiscTag(); 82 void setDiscTagInt(); 83 84 void configure(); 85 void configureEncoder(); 86 87 void downloadInfo(); 88 void openScanDialog(); 89 90 void openAboutDialog(); 91 void checkUpdates(); 92 93 void trackViewMenu(const QPoint &pos); 94 void showDiskAudioFileMenu(Disc *disc, const QPoint &pos); 95 void openEditTagsDialog(); 96 97 protected: 98 void closeEvent(QCloseEvent *) override; 99 void dragEnterEvent(QDragEnterEvent *event) override; 100 void dropEvent(QDropEvent *event) override; 101 void showEvent(QShowEvent *event) override; 102 void keyPressEvent(QKeyEvent *event) override; 103 bool event(QEvent *event) override; 104 105 private: 106 QPointer<Conv::Converter> mConverter; 107 Scanner * mScanner; 108 QString getOpenFileFilter(bool includeAudio, bool includeCue); 109 110 void polishView(); 111 void initActions(); 112 void refreshOutProfileCombo(); 113 114 void loadSettings(); 115 void saveSettings(); 116 117 void startConvert(const Conv::Converter::Jobs &jobs); 118 119 QIcon loadMainIcon(); 120 121 void showErrorMessage(const QString &message) override; 122 void fillAudioMenu(Disc *disc, QMenu &menu); 123 }; 124 125 #endif // MAINWINDOW_H 126