// (at your option) any later version.
//
// EmuFront is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// but WITHOUT ANY WARRANTY{} without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// along with EmuFront. If not, see <http://www.gnu.org/licenses/>.
#include "executable.h"
+#include "setup.h"
-Executable::Executable()
+Executable::Executable() : EmuFrontObject() { }
+
+Executable::Executable(int id, QString name)
+ : EmuFrontObject(id, name) {}
+
+Executable::Executable(int id, QString name, QString executable,
+ QString options, Setup*, int type)
+ : EmuFrontObject(id, name), executable(executable),
+ options(options), setup(setup), type(type)
+{}
+
+Executable::Executable(const Executable &e)
+ : EmuFrontObject(e.id, e.name), executable(e.executable),
+ options(e.options), type(e.type)
+{
+ Setup *s = e.setup;
+ setup = new Setup(*s);
+}
+
+Executable::~Executable()
+{
+ delete setup;
+}
+
+Executable& Executable::operator =(const Executable &e)
{
+ if (this == &e) return *this;
+ id = e.id;
+ name = e.name;
+ executable = e.executable;
+ options = e.options;
+ type = e.type;
+ Setup *s = e.setup;
+ if (setup) delete setup;
+ setup = new Setup(*s);
+ return (*this);
}
+
+QString Executable::getExecutable() const
+{ return executable; }
+
+void Executable::setExecutable(QString e)
+{ executable = e; }
+
+QString Executable::getOptions() const
+{ return options; }
+
+void Executable::setOptions(QString o)
+{ options = o; }
+
+Setup* Executable::getSetup() const
+{ return setup; }
+
+void Executable::setSetup(Setup* s)
+{ setup = s; }
+
+int Executable::getType() const
+{ return type; }
+
+void Executable::setType(int t)
+{ type = t; }
#ifndef EXECUTABLE_H
#define EXECUTABLE_H
-#include "emufrontfileobject.h"
+#include "emufrontobject.h"
-class Executable : public EmuFrontFileObject
+class Setup;
+
+class Executable : public EmuFrontObject
{
public:
Executable();
+ Executable(int id, QString name);
+ Executable(int id, QString name, QString executable, QString options, Setup*, int type);
+ Executable(const Executable &);
+ ~Executable();
+ Executable& operator =(const Executable &);
+ QString getExecutable() const;
+ void setExecutable(QString);
+ QString getOptions() const;
+ void setOptions(QString);
+ Setup* getSetup() const;
+ void setSetup(Setup*);
+ int getType() const;
+ void setType(int);
+private:
+ QString executable;
+ QString options;
+ Setup *setup;
+ int type;
};
#endif // EXECUTABLE_H
ret = query.exec("CREATE TABLE IF NOT EXISTS executable "
"(id INTEGER PRIMARY KEY, "
"name TEXT, "
+ "executable TEXT, "
"options TEXT, "
"type INTEGER, "
- "setupid INTEGER REFERENCES setup(id),"
- "fileid INTEGER REFERENCES file(id))");
+ "setupid INTEGER REFERENCES setup(id))");
/*qDebug() << "Creating TABLE filetype";
ret = query.exec("CREATE TABLE filetype IF NOT EXISTS"
"BEGIN "
" UPDATE platform SET platform.fileid=NULL WHERE platform.fileid = old.id;"
" UPDATE mediatype SET mediatype.fileid=NULL WHERE mediatype.fileid = old.id;"
- " UPDATE executable SET executable.fileid=NULL WHERE executable.fileid = old.id;"
+ " DELETE FROM mediaimagecontainer WHERE fileid = old.id;"
" DELETE FROM mediaimagecontainer_mediaimage WHERE mediaimagecontainer_mediaimage.fileid = old.id;"
- " DELETE FROM mediaimagecontainer WHERE mediaimagecontainer.fileid = old.id;"
"END;"
);
}