File indexing completed on 2021-12-21 13:26:59

0001 /* AUDEX CDDA EXTRACTOR
0002  * Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.com)
0003  * <https://userbase.kde.org/Audex>
0004  *
0005  * This program is free software: you can redistribute it and/or modify
0006  * it under the terms of the GNU General Public License as published by
0007  * the Free Software Foundation, either version 3 of the License, or
0008  * (at your option) any later version.
0009  *
0010  * This program is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0013  * GNU General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU General Public License
0016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef MAINWINDOW_H
0020 #define MAINWINDOW_H
0021 
0022 #include <QComboBox>
0023 #include <QDockWidget>
0024 #include <QInputDialog>
0025 #include <QLabel>
0026 #include <QObject>
0027 #include <QTreeView>
0028 
0029 #include <KActionCollection>
0030 #include <KCModuleLoader>
0031 #include <KCddb/Cdinfo>
0032 #include <KCddb/Client>
0033 #include <KCddb/Kcddb>
0034 #include <KComboBox>
0035 #include <KConfigDialog>
0036 #include <KLocalizedString>
0037 #include <KMessageBox>
0038 #include <KStandardAction>
0039 #include <KTextEdit>
0040 #include <KXmlGuiWindow>
0041 #include <QLineEdit>
0042 #include <QPushButton>
0043 #include <QStatusBar>
0044 
0045 #include "utils/cuesheetwriter.h"
0046 #include "utils/error.h"
0047 
0048 #include "models/cddamodel.h"
0049 #include "models/profilemodel.h"
0050 
0051 #include "preferences.h"
0052 #include "widgets/cddaheaderwidget.h"
0053 #include "widgets/devicewidget.h"
0054 #include "widgets/generalsettingswidget.h"
0055 #include "widgets/profilewidget.h"
0056 #include "widgets/remoteserversettingswidget.h"
0057 
0058 #include "dialogs/errordialog.h"
0059 #include "dialogs/extractingprogressdialog.h"
0060 
0061 #include "utils/encoderassistant.h"
0062 
0063 class MainWindow : public KXmlGuiWindow
0064 {
0065     Q_OBJECT
0066 
0067 public:
0068     explicit MainWindow(QWidget *parent = nullptr);
0069     ~MainWindow() override;
0070 
0071 private:
0072     bool firstStart();
0073 
0074 private Q_SLOTS:
0075     void eject();
0076     void cddb_lookup();
0077     void cddb_submit();
0078     void rip();
0079     void configure();
0080 
0081     void new_audio_disc_detected();
0082     void audio_disc_removed();
0083 
0084     void cddb_lookup_start();
0085     void cddb_lookup_done(const bool successful);
0086 
0087     void update_layout();
0088 
0089     void enable_layout(bool enabled);
0090     void enable_submit(bool enabled = true);
0091     void disable_submit();
0092 
0093     void configuration_updated(const QString &dialog_name);
0094 
0095     void current_profile_updated_from_ui(int row);
0096     void update_profile_action(int index);
0097     void update_profile_action();
0098 
0099     void split_titles();
0100     void swap_artists_and_titles();
0101     void capitalize();
0102     void auto_fill_artists();
0103     void toggle(const QModelIndex &idx);
0104     void resizeColumns();
0105 
0106     void select_all();
0107     void select_none();
0108     void invert_selection();
0109 
0110     void cdda_context_menu(const QPoint &pos);
0111 
0112     void selection_changed(const int num_selected);
0113 
0114 private:
0115     CDDAModel *cdda_model;
0116     ProfileModel *profile_model;
0117 
0118     QLabel *profile_label;
0119     KComboBox *profile_combobox;
0120 
0121     void setup_actions();
0122     void setup_layout();
0123 
0124     QTreeView *cdda_tree_view;
0125 
0126     QDockWidget *cdda_header_dock;
0127     CDDAHeaderWidget *cdda_header_widget;
0128 
0129     bool layout_enabled;
0130 
0131     int current_profile_index;
0132     void set_profile(int profile_index);
0133 };
0134 
0135 #endif