1 /**
2  * \file numbertracksdialog.h
3  * Number tracks dialog.
4  *
5  * \b Project: Kid3
6  * \author Urs Fleisch
7  * \date 25 May 2006
8  *
9  * Copyright (C) 2006-2018  Urs Fleisch
10  *
11  * This file is part of Kid3.
12  *
13  * Kid3 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * Kid3 is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #pragma once
28 
29 #include <QDialog>
30 #include "frame.h"
31 
32 class QSpinBox;
33 class QComboBox;
34 class QCheckBox;
35 
36 /**
37  * Number tracks dialog.
38  */
39 class NumberTracksDialog : public QDialog {
40   Q_OBJECT
41 public:
42   /**
43    * Constructor.
44    *
45    * @param parent parent widget
46    */
47   explicit NumberTracksDialog(QWidget* parent);
48 
49   /**
50    * Destructor.
51    */
52   virtual ~NumberTracksDialog() override = default;
53 
54   /**
55    * Get start number.
56    */
57   int getStartNumber() const;
58 
59   /**
60    * Get destination.
61    *
62    * @return TagV1, TagV2 or TagV2V1 if ID3v1, ID2v2 or both are destination
63    */
64   Frame::TagVersion getDestination() const;
65 
66   /**
67    * Set the total number of tracks.
68    *
69    * @param numTracks number of tracks
70    * @param enable    true to enable setting of total
71    */
72   void setTotalNumberOfTracks(int numTracks, bool enable);
73 
74   /**
75    * Get the total number of tracks.
76    *
77    * @param enable true is returned here if total number of tracks is checked
78    *
79    * @return number of tracks entered
80    */
81   int getTotalNumberOfTracks(bool* enable) const;
82 
83   /**
84    * Check if track numbering is enabled.
85    * @return true if enabled.
86    */
87   bool isTrackNumberingEnabled() const;
88 
89   /**
90    * Check if counter has to be reset for each directory.
91    * @return true if enabled.
92    */
93   bool isDirectoryCounterResetEnabled() const;
94 
95 private slots:
96   /**
97    * Save the local settings to the configuration.
98    */
99   void saveConfig();
100 
101   /**
102    * Show help.
103    */
104   void showHelp();
105 
106 private:
107   /** check box to enable track numbering */
108   QCheckBox* m_numberTracksCheckBox;
109   /** spinbox with starting track number */
110   QSpinBox* m_trackSpinBox;
111   /** combobox with destination */
112   QComboBox* m_destComboBox;
113   /** checkbox to reset counter for each directory*/
114   QCheckBox* m_resetCounterCheckBox;
115   /** total number of tracks checkbox */
116   QCheckBox* m_totalNumTracksCheckBox;
117   /** spinbox with total number of tracks */
118   QSpinBox* m_totalNumTrackSpinBox;
119 };
120