2010-12-31 19:13:28 +01:00
|
|
|
/* This file is part of Clementine.
|
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
|
|
|
|
|
|
|
Clementine 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 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine 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 Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SCRIPTDIALOG_H
|
|
|
|
#define SCRIPTDIALOG_H
|
|
|
|
|
|
|
|
#include <QDialog>
|
2011-01-01 19:37:08 +01:00
|
|
|
#include <QFont>
|
|
|
|
#include <QFontMetrics>
|
|
|
|
#include <QStyledItemDelegate>
|
2010-12-31 19:13:28 +01:00
|
|
|
|
|
|
|
class ScriptManager;
|
|
|
|
class Ui_ScriptDialog;
|
|
|
|
|
2011-01-01 19:37:08 +01:00
|
|
|
class ScriptDelegate : public QStyledItemDelegate {
|
|
|
|
public:
|
|
|
|
ScriptDelegate(QObject* parent = 0);
|
|
|
|
|
|
|
|
static const int kIconSize;
|
|
|
|
static const int kPadding;
|
|
|
|
static const int kItemHeight;
|
|
|
|
static const int kLinkSpacing;
|
|
|
|
|
|
|
|
void paint(QPainter* painter, const QStyleOptionViewItem& option,
|
|
|
|
const QModelIndex& index) const;
|
|
|
|
QSize sizeHint(const QStyleOptionViewItem& option,
|
|
|
|
const QModelIndex& index) const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
QFont bold_;
|
|
|
|
QFontMetrics bold_metrics_;
|
|
|
|
|
|
|
|
QFont link_;
|
|
|
|
};
|
|
|
|
|
2010-12-31 19:13:28 +01:00
|
|
|
class ScriptDialog : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ScriptDialog(QWidget* parent = 0);
|
|
|
|
~ScriptDialog();
|
|
|
|
|
2011-01-19 00:10:22 +01:00
|
|
|
static const char* kSettingsGroup;
|
|
|
|
|
2010-12-31 19:13:28 +01:00
|
|
|
void SetManager(ScriptManager* manager);
|
|
|
|
|
2011-01-01 19:37:08 +01:00
|
|
|
private slots:
|
|
|
|
void DataChanged(const QModelIndex& top_left, const QModelIndex& bottom_right);
|
|
|
|
void CurrentChanged(const QModelIndex& index);
|
2011-01-02 02:07:19 +01:00
|
|
|
void LogLineAdded(const QString& html);
|
2011-01-01 19:37:08 +01:00
|
|
|
|
|
|
|
void Enable();
|
|
|
|
void Disable();
|
|
|
|
void Settings();
|
2011-01-15 17:20:16 +01:00
|
|
|
void Reload();
|
2011-01-01 19:37:08 +01:00
|
|
|
|
2011-01-19 00:10:22 +01:00
|
|
|
void InstallFromFile();
|
|
|
|
void InstallFromFileLoaded();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void ReloadSettings();
|
|
|
|
|
2010-12-31 19:13:28 +01:00
|
|
|
private:
|
|
|
|
Ui_ScriptDialog* ui_;
|
|
|
|
|
|
|
|
ScriptManager* manager_;
|
2011-01-19 00:10:22 +01:00
|
|
|
|
|
|
|
QString last_open_dir_;
|
2010-12-31 19:13:28 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SCRIPTDIALOG_H
|