Changeset View
Changeset View
Standalone View
Standalone View
src/titler/titlewidget.cpp
Context not available. | |||||
28 | #include <KMessageBox> | 28 | #include <KMessageBox> | ||
---|---|---|---|---|---|
29 | #include <KRecentDirs> | 29 | #include <KRecentDirs> | ||
30 | #include <klocalizedstring.h> | 30 | #include <klocalizedstring.h> | ||
31 | #include <kns3/downloaddialog.h> | ||||
31 | 32 | | |||
32 | #include "kdenlive_debug.h" | 33 | #include "kdenlive_debug.h" | ||
33 | #include <QCryptographicHash> | 34 | #include <QCryptographicHash> | ||
Context not available. | |||||
68 | const int SHADOWEFFECT = 2; | 69 | const int SHADOWEFFECT = 2; | ||
69 | const int TYPEWRITEREFFECT = 3; | 70 | const int TYPEWRITEREFFECT = 3; | ||
70 | 71 | | |||
72 | void TitleWidget::refreshTemplateBoxContents() | ||||
73 | { | ||||
74 | templateBox->clear(); | ||||
75 | templateBox->addItem(QString()); | ||||
76 | for (const TitleTemplate &t : titletemplates) { | ||||
77 | templateBox->addItem(t.icon, t.name, t.file); | ||||
78 | } | ||||
79 | } | ||||
80 | | ||||
71 | TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, const QString &projectTitlePath, Monitor *monitor, QWidget *parent) | 81 | TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, const QString &projectTitlePath, Monitor *monitor, QWidget *parent) | ||
72 | : QDialog(parent) | 82 | : QDialog(parent) | ||
73 | , Ui::TitleWidget_UI() | 83 | , Ui::TitleWidget_UI() | ||
Context not available. | |||||
415 | m_buttonSave->setToolTip(i18n("Save As") + QLatin1Char(' ') + m_buttonSave->shortcut().toString()); | 425 | m_buttonSave->setToolTip(i18n("Save As") + QLatin1Char(' ') + m_buttonSave->shortcut().toString()); | ||
416 | connect(m_buttonSave, SIGNAL(triggered()), this, SLOT(saveTitle())); | 426 | connect(m_buttonSave, SIGNAL(triggered()), this, SLOT(saveTitle())); | ||
417 | 427 | | |||
428 | m_buttonDownload = m_toolbar->addAction(QIcon::fromTheme(QStringLiteral("edit-download")), i18n("Download New Title Templates...")); | ||||
429 | m_buttonDownload->setCheckable(false); | ||||
430 | m_buttonDownload->setShortcut(Qt::ALT + Qt::Key_D); | ||||
431 | m_buttonDownload->setToolTip(i18n("Download New Title Templates...") + QLatin1Char(' ') + m_buttonDownload->shortcut().toString()); | ||||
432 | connect(m_buttonDownload, &QAction::triggered, this, &TitleWidget::downloadTitleTemplates); | ||||
433 | | ||||
418 | layout->addWidget(m_toolbar); | 434 | layout->addWidget(m_toolbar); | ||
419 | 435 | | |||
420 | // initialize graphic scene | 436 | // initialize graphic scene | ||
Context not available. | |||||
520 | refreshTitleTemplates(m_projectTitlePath); | 536 | refreshTitleTemplates(m_projectTitlePath); | ||
521 | } | 537 | } | ||
522 | // templateBox->setIconSize(QSize(60,60)); | 538 | // templateBox->setIconSize(QSize(60,60)); | ||
523 | templateBox->clear(); | 539 | refreshTemplateBoxContents(); | ||
524 | templateBox->addItem(QString()); | | |||
525 | for (const TitleTemplate &t : titletemplates) { | | |||
526 | templateBox->addItem(t.icon, t.name, t.file); | | |||
527 | } | | |||
528 | lastDocumentHash = QCryptographicHash::hash(xml().toString().toLatin1(), QCryptographicHash::Md5).toHex(); | 540 | lastDocumentHash = QCryptographicHash::hash(xml().toString().toLatin1(), QCryptographicHash::Md5).toHex(); | ||
529 | } | 541 | } | ||
530 | 542 | | |||
Context not available. | |||||
1921 | } | 1933 | } | ||
1922 | } | 1934 | } | ||
1923 | 1935 | | |||
1936 | void TitleWidget::downloadTitleTemplates() | ||||
1937 | { | ||||
1938 | if (getNewStuff(QStringLiteral(":data/kdenlive_titles.knsrc")) > 0) { | ||||
1939 | refreshTitleTemplates(m_projectTitlePath); | ||||
1940 | refreshTemplateBoxContents(); | ||||
1941 | } | ||||
1942 | } | ||||
1943 | | ||||
1944 | int TitleWidget::getNewStuff(const QString &configFile) | ||||
1945 | { | ||||
1946 | KNS3::Entry::List entries; | ||||
1947 | QPointer<KNS3::DownloadDialog> dialog = new KNS3::DownloadDialog(configFile); | ||||
1948 | if (dialog->exec() != 0) { | ||||
1949 | entries = dialog->changedEntries(); | ||||
1950 | } | ||||
1951 | for (const KNS3::Entry &entry : entries) { | ||||
1952 | if (entry.status() == KNS3::Entry::Installed) { | ||||
1953 | qCDebug(KDENLIVE_LOG) << "// Installed files: " << entry.installedFiles(); | ||||
1954 | } | ||||
1955 | } | ||||
1956 | delete dialog; | ||||
1957 | return entries.size(); | ||||
1958 | } | ||||
1959 | | ||||
1924 | QDomDocument TitleWidget::xml() | 1960 | QDomDocument TitleWidget::xml() | ||
1925 | { | 1961 | { | ||
1926 | QDomDocument doc = m_titledocument.xml(m_startViewport, m_endViewport); | 1962 | QDomDocument doc = m_titledocument.xml(m_startViewport, m_endViewport); | ||
Context not available. |