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

0001 /**
0002  * \file iplatformtools.h
0003  * Interface for platform specific tools.
0004  *
0005  * \b Project: Kid3
0006  * \author Urs Fleisch
0007  * \date 30 Mar 2013
0008  *
0009  * Copyright (C) 2013-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 <QStringList>
0030 #include "icoreplatformtools.h"
0031 
0032 class QWidget;
0033 class QIcon;
0034 
0035 /**
0036  * Interface for platform specific tools.
0037  */
0038 class KID3_GUI_EXPORT IPlatformTools : public ICorePlatformTools {
0039 public:
0040   /**
0041    * Destructor.
0042    */
0043   ~IPlatformTools() override;
0044 
0045   /**
0046    * Display help for a topic.
0047    *
0048    * @param anchor anchor in help document
0049    */
0050   virtual void displayHelp(const QString& anchor) = 0;
0051 
0052   /**
0053    * Get a themed icon by name.
0054    * @param name name of icon
0055    * @return icon.
0056    */
0057   virtual QIcon iconFromTheme(const QString& name) const = 0;
0058 
0059   /**
0060    * Display error dialog with item list.
0061    * @param parent parent widget
0062    * @param text text
0063    * @param strlist list of items
0064    * @param caption caption
0065    */
0066   virtual void errorList(QWidget* parent, const QString& text,
0067       const QStringList& strlist, const QString& caption) = 0;
0068 
0069   /**
0070    * Display warning dialog with yes, no, cancel buttons.
0071    * @param parent parent widget
0072    * @param text text
0073    * @param caption caption
0074    * @return QMessageBox::Yes, QMessageBox::No or QMessageBox::Cancel.
0075    */
0076   virtual int warningYesNoCancel(QWidget* parent, const QString& text,
0077       const QString& caption) = 0;
0078 
0079   /**
0080    * Display warning dialog with item list.
0081    * @param parent parent widget
0082    * @param text text
0083    * @param strlist list of items
0084    * @param caption caption
0085    * @return QMessageBox::Yes or QMessageBox::No.
0086    */
0087   virtual int warningYesNoList(QWidget* parent, const QString& text,
0088       const QStringList& strlist, const QString& caption) = 0;
0089 
0090   /**
0091    * Display dialog to select existing files.
0092    * @param parent parent widget
0093    * @param caption caption
0094    * @param dir directory
0095    * @param filter filter
0096    * @param selectedFilter the selected filter is returned here
0097    * @return selected files, empty if canceled.
0098    */
0099   virtual QStringList getOpenFileNames(QWidget* parent,
0100       const QString& caption, const QString& dir, const QString& filter,
0101       QString* selectedFilter) = 0;
0102 
0103   /**
0104    * Display warning dialog.
0105    * @param parent parent widget
0106    * @param text text
0107    * @param details detailed message
0108    * @param caption caption
0109    */
0110   virtual void warningDialog(QWidget* parent,
0111       const QString& text, const QString& details, const QString& caption) = 0;
0112 
0113   /**
0114    * Display warning dialog with options to continue or cancel.
0115    * @param parent parent widget
0116    * @param text text
0117    * @param strlist list of items
0118    * @param caption caption
0119    * @return true if continue was selected.
0120    */
0121   virtual bool warningContinueCancelList(QWidget* parent,
0122    const QString& text, const QStringList& strlist, const QString& caption) = 0;
0123 };