File indexing completed on 2024-05-12 17:22:30

0001 // This file is part of the SpeedCrunch project
0002 // Copyright (C) 2007 Ariya Hidayat <ariya@kde.org>
0003 // Copyright (C) 2008-2009, 2016 @heldercorreia
0004 // Copyright (C) 2009 Andreas Scherer <andreas_coder@freenet.de>
0005 //
0006 // This program is free software; you can redistribute it and/or
0007 // modify it under the terms of the GNU General Public License
0008 // as published by the Free Software Foundation; either version 2
0009 // of the License, or (at your option) any later version.
0010 //
0011 // This program is distributed in the hope that it will be useful,
0012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 // GNU General Public License for more details.
0015 //
0016 // You should have received a copy of the GNU General Public License
0017 // along with this program; see the file COPYING.  If not, write to
0018 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0019 // Boston, MA 02110-1301, USA.
0020 
0021 #ifndef CORE_CONSTANTS_H
0022 #define CORE_CONSTANTS_H
0023 
0024 #include <QObject>
0025 #include <QStringList>
0026 
0027 #include <memory>
0028 
0029 struct Constant {
0030     QString category;
0031     QString name;
0032     QString unit;
0033     QString value;
0034 };
0035 
0036 class Constants : public QObject {
0037     Q_OBJECT
0038 
0039 public:
0040     ~Constants(); //  For unique_ptr, define after Private is complete.
0041     static Constants* instance();
0042     const QStringList& categories() const;
0043     const QList<Constant>& list() const;
0044 
0045 public slots:
0046     void retranslateText();
0047 
0048 private:
0049     struct Private;
0050     std::unique_ptr<Private> d;
0051 
0052     Constants();
0053     Q_DISABLE_COPY(Constants)
0054 };
0055 
0056 #endif
0057