Root/src/linkapp.h

Source at commit 00d3c3b57008bddf8770c51271db9d766acaf854 created 7 years 5 months ago.
By Maarten ter Huurne, Gave Layer class a protected constructor
1/***************************************************************************
2 * Copyright (C) 2006 by Massimiliano Torromeo *
3 * massimiliano.torromeo@gmail.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20
21#ifndef LINKAPP_H
22#define LINKAPP_H
23
24#include "link.h"
25
26#include <memory>
27#include <string>
28
29class GMenu2X;
30class Launcher;
31class Surface;
32
33/**
34Parses links files.
35
36    @author Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
37*/
38class LinkApp : public Link {
39private:
40    std::string sclock;
41    int iclock;
42    std::string exec, params, workdir, manual, selectordir, selectorfilter;
43    bool selectorbrowser, deletable, editable;
44
45    std::string file;
46
47    bool dontleave;
48#ifdef HAVE_LIBOPK
49    bool isOPK;
50    std::string opkMount, opkFile, category, metadata;
51#endif
52
53    void start();
54
55protected:
56    virtual const std::string &searchIcon();
57
58public:
59#ifdef HAVE_LIBOPK
60    const std::string &getCategory() { return category; }
61    bool isOpk() { return isOPK; }
62    const std::string &getOpkFile() { return opkFile; }
63
64    LinkApp(GMenu2X& gmenu2x, std::string const& linkfile, bool deletable,
65                struct OPK *opk = NULL, const char *metadata = NULL);
66#else
67    LinkApp(GMenu2X& gmenu2x, std::string const& linkfile, bool deletable);
68    bool isOpk() { return false; }
69#endif
70
71    virtual void loadIcon();
72
73    bool consoleApp = false;
74
75    const std::string &getManual();
76    void setManual(const std::string &manual);
77    const std::string &getSelectorDir();
78    void setSelectorDir(const std::string &selectordir);
79    bool getSelectorBrowser();
80    void setSelectorBrowser(bool value);
81    const std::string &getSelectorFilter();
82    void setSelectorFilter(const std::string &selectorfilter);
83
84    int clock();
85    const std::string &clockStr(int maxClock);
86    void setClock(int mhz);
87
88    bool save();
89    void showManual();
90    void selector(int startSelection=0, const std::string &selectorDir="");
91    bool targetExists();
92    bool isDeletable() { return deletable; }
93    bool isEditable() { return editable; }
94
95    const std::string &getFile() { return file; }
96    void renameFile(const std::string &name);
97
98private:
99    void drawLaunch(Surface& s);
100    std::unique_ptr<Launcher> prepareLaunch(const std::string &selectedFile);
101
102    friend class LaunchLayer;
103};
104
105#endif
106

Archive Download this file



interactive