File indexing completed on 2025-02-23 04:34:23

0001 /**
0002  * \file chaptereditor.h
0003  * Editor for chapter frames.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 18 Sep 2015
0008  *
0009  * Copyright (C) 2015-2024  Urs Fleisch
0010  *
0011  * This file is part of Kid3.
0012  *
0013  * Kid3 is free software; you can redistribute it and/or modify
0014  * it under the terms of the GNU General Public License as published by
0015  * the Free Software Foundation; either version 2 of the License, or
0016  * (at your option) any later version.
0017  *
0018  * Kid3 is distributed in the hope that it will be useful,
0019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0021  * GNU General Public License for more details.
0022  *
0023  * You should have received a copy of the GNU General Public License
0024  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
0025  */
0026 
0027 #pragma once
0028 
0029 #include <QWidget>
0030 
0031 class QTimeEdit;
0032 class QLineEdit;
0033 
0034 /**
0035  * Editor for chapter frames.
0036  */
0037 class ChapterEditor : public QWidget {
0038   Q_OBJECT
0039 public:
0040   /**
0041    * Constructor.
0042    *
0043    * @param parent parent widget
0044    */
0045   explicit ChapterEditor(QWidget* parent = nullptr);
0046 
0047   /**
0048    * Destructor.
0049    */
0050   ~ChapterEditor() override = default;
0051 
0052   /**
0053    * Set start and end time of chapter.
0054    * @param startTimeMs start time in ms
0055    * @param endTimeMs end time in ms
0056    * @param startOffset offset of first byte of chapter in file,
0057    *                    ignored if all ones
0058    * @param endOffset offset of byte after last chapter byte,
0059    *                  ignored if all ones
0060    */
0061   void setValues(quint32 startTimeMs, quint32 endTimeMs,
0062                  quint32 startOffset, quint32 endOffset);
0063 
0064   /**
0065    * Get start and end time of chapter.
0066    * @param startTimeMs the start time in ms is returned here
0067    * @param endTimeMs the end time in ms is returned here
0068    * @param startOffset the offset of the first byte of chapter in file is
0069    *                    returned here, ignored if all ones
0070    * @param endOffset the offset of the byte after the last chapter byte is
0071    *                  returned here, ignored if all ones
0072    */
0073   void getValues(quint32& startTimeMs, quint32& endTimeMs,
0074                  quint32& startOffset, quint32& endOffset) const;
0075 
0076 private:
0077   QTimeEdit* m_startTimeEdit;
0078   QTimeEdit* m_endTimeEdit;
0079   QLineEdit* m_startOffsetEdit;
0080   QLineEdit* m_endOffsetEdit;
0081 };