2007-06-17 02:25:16 +02:00
|
|
|
/******************************************************************************
|
2007-11-02 16:30:53 +01:00
|
|
|
* Copyright 2007 by Riccardo Iaconelli <riccardo@kde.org> *
|
2007-06-17 02:25:16 +02:00
|
|
|
* *
|
|
|
|
* This library is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU Library General Public *
|
|
|
|
* License as published by the Free Software Foundation; either *
|
|
|
|
* version 2 of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This library 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 *
|
|
|
|
* Library General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Library General Public License *
|
|
|
|
* along with this library; see the file COPYING.LIB. If not, write to *
|
|
|
|
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, *
|
|
|
|
* Boston, MA 02110-1301, USA. *
|
|
|
|
*******************************************************************************/
|
|
|
|
|
|
|
|
#ifndef PACKAGEMETADATA_H
|
|
|
|
#define PACKAGEMETADATA_H
|
|
|
|
|
2007-07-15 00:40:00 +02:00
|
|
|
#include <QtCore/QString>
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2007-06-17 02:33:44 +02:00
|
|
|
#include <plasma/plasma_export.h>
|
2007-06-17 02:29:53 +02:00
|
|
|
|
2007-06-17 02:25:16 +02:00
|
|
|
namespace Plasma
|
|
|
|
{
|
|
|
|
|
2007-06-17 02:29:53 +02:00
|
|
|
class PLASMA_EXPORT PackageMetadata
|
2007-06-17 02:25:16 +02:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* Default constructor
|
|
|
|
**/
|
|
|
|
PackageMetadata();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs a metadata object using the values in the file at path
|
|
|
|
*
|
|
|
|
* @param path path to a metadata.desktop file
|
|
|
|
**/
|
|
|
|
PackageMetadata(const QString& path);
|
|
|
|
~PackageMetadata();
|
|
|
|
|
2007-07-20 06:14:13 +02:00
|
|
|
bool isComplete() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes out the metadata to filename, which should be a .desktop
|
|
|
|
* file. It writes out the information in a format that is compatible
|
|
|
|
* with KPluginInfo
|
|
|
|
* @see KPluginInfo
|
|
|
|
*
|
|
|
|
* @arg filename path to the file to write to
|
|
|
|
**/
|
2007-07-20 06:14:13 +02:00
|
|
|
void write(const QString& filename) const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Reads in metadata from a file, which should be a .desktop
|
|
|
|
* file. It writes out the information in a format that is compatible
|
|
|
|
* with KPluginInfo
|
|
|
|
* @see KPluginInfo
|
|
|
|
*
|
|
|
|
* @arg filename path to the file to write to
|
|
|
|
**/
|
|
|
|
void read(const QString& filename);
|
|
|
|
|
2007-07-20 06:14:13 +02:00
|
|
|
QString name() const;
|
|
|
|
QString description() const;
|
|
|
|
QString serviceType() const;
|
|
|
|
QString author() const;
|
|
|
|
QString email() const;
|
|
|
|
QString version() const;
|
|
|
|
QString website() const;
|
|
|
|
QString license() const;
|
|
|
|
QString mainFile() const;
|
|
|
|
QString application() const;
|
|
|
|
QString requiredVersion() const;
|
|
|
|
QString releaseNotes() const;
|
|
|
|
QString filenameToSave() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
// filename
|
2007-07-20 06:14:13 +02:00
|
|
|
QString icon() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2007-08-03 14:38:57 +02:00
|
|
|
/**
|
|
|
|
* @return the name of the screenshot file, screenshot.png by default
|
|
|
|
*/
|
|
|
|
QString screenshot() const;
|
|
|
|
|
2007-06-17 02:25:16 +02:00
|
|
|
/**
|
|
|
|
* Path to a PNG file containing a preview image.
|
|
|
|
* This might be a screenshot, for instance.
|
|
|
|
*
|
|
|
|
* @return path to a local image file, or QString() if no
|
|
|
|
* preview is available
|
|
|
|
**/
|
2007-07-20 06:14:13 +02:00
|
|
|
QString preview() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
2007-07-20 06:14:13 +02:00
|
|
|
QString type() const;
|
2007-06-17 02:25:16 +02:00
|
|
|
|
|
|
|
void setName(const QString &);
|
|
|
|
void setDescription(const QString &);
|
2007-07-20 06:14:13 +02:00
|
|
|
void setServiceType(const QString &);
|
2007-06-17 02:25:16 +02:00
|
|
|
void setAuthor(const QString &);
|
|
|
|
void setEmail(const QString &);
|
|
|
|
void setVersion(const QString &);
|
|
|
|
void setWebsite(const QString &);
|
|
|
|
void setLicense(const QString &);
|
|
|
|
void setMainFile(const QString &);
|
|
|
|
void setApplication(const QString &);
|
|
|
|
void setRequiredVersion(const QString &);
|
|
|
|
void setReleaseNotes(const QString &);
|
|
|
|
void setFilenameToSave(const QString &);
|
|
|
|
// filename
|
|
|
|
void setIcon(const QString &);
|
|
|
|
|
2007-08-03 14:38:57 +02:00
|
|
|
/**
|
|
|
|
* Sets the name of the screenshot file.
|
|
|
|
*
|
|
|
|
* @param file the name of the file
|
|
|
|
*/
|
|
|
|
void setScreenshot(const QString &file);
|
|
|
|
|
2007-06-17 02:25:16 +02:00
|
|
|
/**
|
|
|
|
* Sets the path for the file containing a preview image.
|
|
|
|
* This might be a screenshot, for instance.
|
|
|
|
* A PNG is expected.
|
|
|
|
*
|
|
|
|
* @args path path to the preview image file
|
|
|
|
**/
|
|
|
|
void setPreview(const QString & path);
|
|
|
|
|
|
|
|
void setType(const QString& type);
|
|
|
|
|
|
|
|
private:
|
|
|
|
class Private;
|
|
|
|
Private * const d;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|