File indexing completed on 2022-10-04 17:30:20

0001 // SPDX-License-Identifier: GPL-2.0-or-later
0002 // SPDX-FileCopyrightText: 2007 Dominik Seichter <domseichter@web.de>
0003 
0004 #ifndef NUMBER_DIALOG_H
0005 #define NUMBER_DIALOG_H
0006 
0007 #include <QDialog>
0008 
0009 #include "ui_numberwidget.h"
0010 
0011 class QDialogButtonBox;
0012 
0013 /**
0014  * This is a dialog with advanced numbering settings
0015  *  - start index
0016  *  - stepping
0017  *  - reset counter on each new directory
0018  *  - skip numbers list
0019  *
0020  */
0021 class NumberDialog : public QDialog
0022 {
0023     Q_OBJECT
0024 public:
0025     NumberDialog(int start, int step, bool reset, const QList<int> &skip, QWidget *parent = nullptr);
0026 
0027     /**
0028      * @returns the start index the user has selected
0029      */
0030     inline int startIndex() const;
0031 
0032     /**
0033      * @returns the stepping value for counters the user has selected
0034      */
0035     inline int numberStepping() const;
0036 
0037     /**
0038      * @returns true if the counter should be reset for each new directory
0039      */
0040     inline bool resetCounter() const;
0041 
0042     /**
0043      * @returns the list of number that should be skipped in counters
0044      */
0045     QList<int> skipNumbers() const;
0046 
0047 private Q_SLOTS:
0048 
0049     void slotAddNumber();
0050     void slotRemoveNumber();
0051 
0052     void slotEnableControls();
0053 
0054 private:
0055     Ui::NumberWidget    m_widget;
0056     QDialogButtonBox   *m_buttons;
0057 };
0058 
0059 inline int NumberDialog::startIndex() const
0060 {
0061     return m_widget.spinStart->value();
0062 }
0063 
0064 inline int NumberDialog::numberStepping() const
0065 {
0066     return m_widget.spinStep->value();
0067 }
0068 
0069 inline bool NumberDialog::resetCounter() const
0070 {
0071     return m_widget.checkReset->isChecked();
0072 }
0073 
0074 #endif // NUMBER_DIALOG_H