mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
[GreaseMonkey] Added "Edit in text editor" button to script info.
This commit is contained in:
parent
4d33b04310
commit
4b0552e3ef
@ -152,6 +152,8 @@ void GM_Script::watchedFileChanged(const QString &file)
|
||||
|
||||
m_manager->removeScript(this, false);
|
||||
m_manager->addScript(this);
|
||||
|
||||
emit scriptChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,9 @@ public:
|
||||
|
||||
bool match(const QString &urlString);
|
||||
|
||||
signals:
|
||||
void scriptChanged();
|
||||
|
||||
private slots:
|
||||
void watchedFileChanged(const QString &file);
|
||||
|
||||
|
@ -19,23 +19,47 @@
|
||||
#include "ui_gm_settingsscriptinfo.h"
|
||||
#include "../gm_script.h"
|
||||
|
||||
GM_SettingsScriptInfo::GM_SettingsScriptInfo(GM_Script* script, QWidget* parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::GM_SettingsScriptInfo)
|
||||
#include <QDesktopServices>
|
||||
|
||||
GM_SettingsScriptInfo::GM_SettingsScriptInfo(GM_Script* script, QWidget* parent)
|
||||
: QDialog(parent)
|
||||
, ui(new Ui::GM_SettingsScriptInfo)
|
||||
, m_script(script)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setWindowTitle(tr("Script Details of %1").arg(script->name()));
|
||||
loadScript();
|
||||
|
||||
ui->name->setText(script->fullName());
|
||||
ui->version->setText(script->version());
|
||||
ui->url->setText(script->downloadUrl().toString());
|
||||
ui->startAt->setText(script->startAt() == GM_Script::DocumentStart ? "document-start" : "document-end");
|
||||
ui->description->setText(script->description());
|
||||
ui->include->setText(script->include().join("<br/>"));
|
||||
ui->exclude->setText(script->exclude().join("<br/>"));
|
||||
connect(m_script, SIGNAL(scriptChanged()), this, SLOT(loadScript()));
|
||||
connect(ui->editInEditor, SIGNAL(clicked()), this, SLOT(editInTextEditor()));
|
||||
}
|
||||
|
||||
void GM_SettingsScriptInfo::editInTextEditor()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(m_script->fileName()));
|
||||
}
|
||||
|
||||
void GM_SettingsScriptInfo::loadScript()
|
||||
{
|
||||
setWindowTitle(tr("Script Details of %1").arg(m_script->name()));
|
||||
|
||||
ui->name->setText(m_script->name());
|
||||
ui->nspace->setText(m_script->nameSpace());
|
||||
ui->version->setText(m_script->version());
|
||||
ui->url->setText(m_script->downloadUrl().toString());
|
||||
ui->startAt->setText(m_script->startAt() == GM_Script::DocumentStart ? "document-start" : "document-end");
|
||||
ui->description->setText(m_script->description());
|
||||
ui->include->setText(m_script->include().join("<br/>"));
|
||||
ui->exclude->setText(m_script->exclude().join("<br/>"));
|
||||
|
||||
ui->version->setVisible(!m_script->version().isEmpty());
|
||||
ui->labelVersion->setVisible(!m_script->version().isEmpty());
|
||||
|
||||
ui->url->setVisible(!m_script->downloadUrl().isEmpty());
|
||||
ui->labelUrl->setVisible(!m_script->downloadUrl().isEmpty());
|
||||
}
|
||||
|
||||
GM_SettingsScriptInfo::~GM_SettingsScriptInfo()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -35,8 +35,14 @@ public:
|
||||
explicit GM_SettingsScriptInfo(GM_Script* script, QWidget* parent = 0);
|
||||
~GM_SettingsScriptInfo();
|
||||
|
||||
private slots:
|
||||
void editInTextEditor();
|
||||
void loadScript();
|
||||
|
||||
private:
|
||||
Ui::GM_SettingsScriptInfo* ui;
|
||||
|
||||
GM_Script* m_script;
|
||||
};
|
||||
|
||||
#endif // GM_SETTINGSSCRIPTINFO_H
|
||||
|
@ -10,60 +10,10 @@
|
||||
<height>408</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>URL:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Start at:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
<string>Runs at:</string>
|
||||
@ -73,15 +23,11 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Does not run at:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="5" column="1">
|
||||
<widget class="QTextBrowser" name="description"/>
|
||||
</item>
|
||||
<item row="7" column="1">
|
||||
<widget class="QTextBrowser" name="exclude"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="SqueezeLabelV2" name="name">
|
||||
@ -93,27 +39,37 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="startAt">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string/>
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="labelVersion">
|
||||
<property name="text">
|
||||
<string>Version:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="text">
|
||||
<string>Start at:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="SqueezeLabelV2" name="url">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="version">
|
||||
<property name="text">
|
||||
<string/>
|
||||
@ -123,26 +79,94 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QTextBrowser" name="description"/>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QTextBrowser" name="include"/>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="startAt">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="SqueezeLabelV2" name="url">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="labelUrl">
|
||||
<property name="text">
|
||||
<string>URL:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QTextBrowser" name="exclude"/>
|
||||
<widget class="QTextBrowser" name="include"/>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string>Does not run at:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Namespace:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="nspace"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="editInEditor">
|
||||
<property name="text">
|
||||
<string>Edit in text editor</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -75,7 +75,7 @@ bool StatusBarIconsPlugin::testPlugin()
|
||||
return (QupZilla::VERSION == QLatin1String("1.5.0"));
|
||||
}
|
||||
|
||||
QTranslator *StatusBarIconsPlugin::getTranslator(const QString &locale)
|
||||
QTranslator* StatusBarIconsPlugin::getTranslator(const QString &locale)
|
||||
{
|
||||
QTranslator* translator = new QTranslator(this);
|
||||
translator->load(locale, ":/sbi/locale/");
|
||||
|
Loading…
Reference in New Issue
Block a user