File indexing completed on 2024-05-05 04:48:47
0001 /**************************************************************************************** 0002 * Copyright (c) 2008-2010 Soren Harward <stharward@gmail.com> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify it under * 0005 * the terms of the GNU General Public License as published by the Free Software * 0006 * Foundation; either version 2 of the License, or (at your option) any later * 0007 * version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0010 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0011 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0012 * * 0013 * You should have received a copy of the GNU General Public License along with * 0014 * this program. If not, see <http://www.gnu.org/licenses/>. * 0015 ****************************************************************************************/ 0016 0017 #ifndef APG_PRESET 0018 #define APG_PRESET 0019 0020 #include "core/meta/forward_declarations.h" 0021 0022 #include "AmarokSharedPointer.h" 0023 0024 #include <QDomElement> 0025 #include <QObject> 0026 #include <QSharedData> 0027 #include <ThreadWeaver/Job> 0028 0029 namespace ThreadWeaver { 0030 class Job; 0031 } 0032 0033 class ConstraintNode; 0034 0035 namespace APG { 0036 class Preset : public QObject, public QSharedData { 0037 Q_OBJECT 0038 0039 public: 0040 static AmarokSharedPointer<Preset> createFromXml( QDomElement& ); 0041 static AmarokSharedPointer<Preset> createNew(); 0042 ~Preset() override; 0043 0044 QString title() const { return m_title; } 0045 void setTitle( const QString& t ) { m_title = t; } 0046 0047 ConstraintNode* constraintTreeRoot() const { return m_constraintTreeRoot; } 0048 void setConstraintTreeRoot( ConstraintNode* c ) { m_constraintTreeRoot = c; } 0049 0050 QDomElement* toXml( QDomDocument& ) const; 0051 0052 public Q_SLOTS: 0053 void generate( int ); 0054 0055 Q_SIGNALS: 0056 void lock( bool ); 0057 0058 private Q_SLOTS: 0059 void queueSolver(); 0060 void solverFinished( ThreadWeaver::JobPointer ); 0061 0062 private: 0063 Preset( const QString&, QDomElement& ); 0064 Preset( const QString& ); 0065 0066 QString m_title; 0067 0068 ConstraintNode* m_constraintTreeRoot; 0069 }; 0070 typedef AmarokSharedPointer<Preset> PresetPtr; 0071 } 0072 #endif