File indexing completed on 2022-11-29 20:25:16

0001 /***************************************************************************
0002                        numberdialog.h  -  description
0003                              -------------------
0004     begin                : The May 24 2007
0005     copyright            : (C) 2007 by Dominik Seichter
0006     email                : domseichter@web.de
0007 ***************************************************************************/
0008 
0009 /***************************************************************************
0010  *                                                                         *
0011  *   This program is free software; you can redistribute it and/or modify  *
0012  *   it under the terms of the GNU General Public License as published by  *
0013  *   the Free Software Foundation; either version 2 of the License, or     *
0014  *   (at your option) any later version.                                   *
0015  *                                                                         *
0016  ***************************************************************************/
0017 
0018 #ifndef NUMBER_DIALOG_H
0019 #define NUMBER_DIALOG_H
0020 
0021 #include <QDialog>
0022 
0023 #include "ui_numberwidget.h"
0024 
0025 class QDialogButtonBox;
0026 
0027 /**
0028  * This is a dialog with advanced numbering settings
0029  *  - start index
0030  *  - stepping
0031  *  - reset counter on each new directory
0032  *  - skip numbers list
0033  *
0034  */
0035 class NumberDialog : public QDialog
0036 {
0037     Q_OBJECT
0038 public:
0039     NumberDialog(int start, int step, bool reset, QList<int> skip, QWidget *parent = nullptr);
0040 
0041     /**
0042      * @returns the start index the user has selected
0043      */
0044     inline int startIndex() const;
0045 
0046     /**
0047      * @returns the stepping value for counters the user has selected
0048      */
0049     inline int numberStepping() const;
0050 
0051     /**
0052      * @returns true if the counter should be reset for each new directory
0053      */
0054     inline bool resetCounter() const;
0055 
0056     /**
0057      * @returns the list of number that should be skipped in counters
0058      */
0059     QList<int> skipNumbers() const;
0060 
0061 private Q_SLOTS:
0062 
0063     void slotAddNumber();
0064     void slotRemoveNumber();
0065 
0066     void slotEnableControls();
0067 
0068 private:
0069     Ui::NumberWidget    m_widget;
0070     QDialogButtonBox   *m_buttons;
0071 };
0072 
0073 inline int NumberDialog::startIndex() const
0074 {
0075     return m_widget.spinStart->value();
0076 }
0077 
0078 inline int NumberDialog::numberStepping() const
0079 {
0080     return m_widget.spinStep->value();
0081 }
0082 
0083 inline bool NumberDialog::resetCounter() const
0084 {
0085     return m_widget.checkReset->isChecked();
0086 }
0087 
0088 #endif // NUMBER_DIALOG_H