2010-02-04 13:33:47 +02:00
|
|
|
/***************************************************************************
|
2011-10-23 17:13:02 +03:00
|
|
|
* Copyright (C) 2006 by Massimiliano Torromeo *
|
|
|
|
* massimiliano.torromeo@gmail.com *
|
2010-02-04 13:33:47 +02:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
***************************************************************************/
|
2011-10-23 17:13:02 +03:00
|
|
|
|
2010-02-04 13:33:47 +02:00
|
|
|
#ifndef LINKAPP_H
|
|
|
|
#define LINKAPP_H
|
|
|
|
|
2011-10-23 17:13:02 +03:00
|
|
|
#include "link.h"
|
|
|
|
|
2014-08-10 03:09:34 +03:00
|
|
|
#include <memory>
|
2010-02-04 13:33:47 +02:00
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class GMenu2X;
|
2014-08-10 03:09:34 +03:00
|
|
|
class Launcher;
|
2014-08-10 15:21:14 +03:00
|
|
|
class Surface;
|
2010-02-04 13:33:47 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
Parses links files.
|
|
|
|
|
|
|
|
@author Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
|
|
|
|
*/
|
|
|
|
class LinkApp : public Link {
|
|
|
|
private:
|
2011-11-19 15:47:55 +02:00
|
|
|
std::string sclock;
|
|
|
|
int iclock;
|
2014-07-14 00:01:20 +03:00
|
|
|
std::string exec, params, workdir, manual, selectordir, selectorfilter;
|
2012-10-17 01:51:55 +03:00
|
|
|
bool selectorbrowser, editable;
|
2010-02-04 13:33:47 +02:00
|
|
|
|
2011-10-23 17:43:56 +03:00
|
|
|
std::string file;
|
2010-07-27 22:26:02 +03:00
|
|
|
|
|
|
|
bool dontleave;
|
2012-10-07 22:50:07 +03:00
|
|
|
#ifdef HAVE_LIBOPK
|
|
|
|
bool isOPK;
|
2013-12-06 00:32:15 +02:00
|
|
|
std::string opkMount, opkFile, category, metadata;
|
2012-10-07 22:50:07 +03:00
|
|
|
#endif
|
2010-02-04 13:33:47 +02:00
|
|
|
|
2011-12-30 17:54:36 +02:00
|
|
|
void start();
|
2011-12-23 16:51:54 +02:00
|
|
|
|
2013-08-12 06:04:20 +03:00
|
|
|
protected:
|
|
|
|
virtual const std::string &searchIcon();
|
|
|
|
|
2010-02-04 13:33:47 +02:00
|
|
|
public:
|
2012-10-07 22:50:07 +03:00
|
|
|
#ifdef HAVE_LIBOPK
|
2012-10-09 02:41:57 +03:00
|
|
|
const std::string &getCategory() { return category; }
|
2012-10-23 07:33:27 +03:00
|
|
|
bool isOpk() { return isOPK; }
|
2013-07-16 20:36:18 +03:00
|
|
|
const std::string &getOpkFile() { return opkFile; }
|
2012-10-09 02:41:57 +03:00
|
|
|
|
2013-12-06 00:32:15 +02:00
|
|
|
LinkApp(GMenu2X *gmenu2x, const char* linkfile,
|
|
|
|
struct OPK *opk = NULL, const char *metadata = NULL);
|
2012-10-07 22:50:07 +03:00
|
|
|
#else
|
2013-09-06 02:20:54 +03:00
|
|
|
LinkApp(GMenu2X *gmenu2x, const char* linkfile);
|
2013-08-12 01:13:18 +03:00
|
|
|
bool isOpk() { return false; }
|
2012-10-07 22:50:07 +03:00
|
|
|
#endif
|
|
|
|
|
2013-08-02 22:20:10 +03:00
|
|
|
virtual void loadIcon();
|
2011-10-23 17:43:56 +03:00
|
|
|
|
2014-08-08 02:35:51 +03:00
|
|
|
bool consoleApp = false;
|
2012-04-13 20:21:49 +03:00
|
|
|
|
2011-10-23 17:43:56 +03:00
|
|
|
const std::string &getExec();
|
|
|
|
void setExec(const std::string &exec);
|
|
|
|
const std::string &getParams();
|
|
|
|
void setParams(const std::string ¶ms);
|
|
|
|
const std::string &getManual();
|
|
|
|
void setManual(const std::string &manual);
|
|
|
|
const std::string &getSelectorDir();
|
|
|
|
void setSelectorDir(const std::string &selectordir);
|
2010-02-04 13:33:47 +02:00
|
|
|
bool getSelectorBrowser();
|
|
|
|
void setSelectorBrowser(bool value);
|
2011-10-23 17:43:56 +03:00
|
|
|
const std::string &getSelectorFilter();
|
|
|
|
void setSelectorFilter(const std::string &selectorfilter);
|
2010-02-04 13:33:47 +02:00
|
|
|
|
|
|
|
int clock();
|
2011-10-23 17:43:56 +03:00
|
|
|
const std::string &clockStr(int maxClock);
|
2010-02-04 13:33:47 +02:00
|
|
|
void setClock(int mhz);
|
|
|
|
|
|
|
|
bool save();
|
|
|
|
void showManual();
|
2011-10-23 17:43:56 +03:00
|
|
|
void selector(int startSelection=0, const std::string &selectorDir="");
|
2010-02-04 13:33:47 +02:00
|
|
|
bool targetExists();
|
2012-10-17 01:51:55 +03:00
|
|
|
bool isEditable() { return editable; }
|
2010-07-27 22:26:02 +03:00
|
|
|
|
2011-10-23 17:43:56 +03:00
|
|
|
const std::string &getFile() { return file; }
|
|
|
|
void renameFile(const std::string &name);
|
2013-08-16 11:41:16 +03:00
|
|
|
|
2014-08-10 03:09:34 +03:00
|
|
|
private:
|
|
|
|
void drawLaunch(Surface& s);
|
|
|
|
std::unique_ptr<Launcher> prepareLaunch(const std::string &selectedFile);
|
|
|
|
|
|
|
|
friend class LaunchLayer;
|
2010-02-04 13:33:47 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|