Commit 7f16e414 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Add a working recent files list

parent c85a2f79
......@@ -23,15 +23,20 @@
#include <QCheckBox>
#include <QDebug>
#include <KoPart.h>
#include <KoApplication.h>
#include <kcomponentdata.h>
#include <klocale.h>
#include <kconfig.h>
#include <kglobal.h>
#include <kconfiggroup.h>
#include <kfileitem.h>
#include <kis_factory2.h>
KisSplashScreen::KisSplashScreen(const QString &version, const QPixmap &pixmap, QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, Qt::SplashScreen | Qt::FramelessWindowHint | f)
, version(version)
, pixmap(pixmap)
{
setupUi(this);
......@@ -46,22 +51,54 @@ KisSplashScreen::KisSplashScreen(const QString &version, const QPixmap &pixmap,
chkShowAtStartup->setChecked(hideSplash);
lblLinks->setTextFormat(Qt::RichText);
lblLinks->setText("<html>"
"<head/>"
"<body>"
"<p align=\"center\"><b>Links</b></p>"
"<p><a href=\"http://krita.org/support-krita#general\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Donations</span></a></p>"
"<p><a href=\"http://www.zazzle.com/kritashop\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Shop</span></a></p>"
"<p><a href=\"http://krita.org/resources\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Getting Started</span></a></p>"
"<p><a href=\"http://krita.org\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Website</span></a></p>"
"<p><a href=\"http://kritastudio.com\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Commercial Support</span></a></p>"
"<p><a href=\"http://forum.kde.org/viewforum.php?f=136\"><span style=\" text-decoration: underline; color:#FFFFFF;\">User Community</span></a></p>"
"<p><a href=\"https://projects.kde.org/projects/calligra\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Source Code</span></a></p>"
"<p><a href=\"http://store.steampowered.com/app/280680/\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Get Krita on Steam</span></a></p>"
"</body>"
"</html>");
lblLinks->setText(i18n("<html>"
"<head/>"
"<body>"
"<p align=\"center\"><b>Links</b></p>"
"<p><a href=\"http://krita.org/support-krita#general\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Donations</span></a></p>"
"<p><a href=\"http://www.zazzle.com/kritashop\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Shop</span></a></p>"
"<p><a href=\"http://krita.org/resources\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Getting Started</span></a></p>"
"<p><a href=\"http://krita.org\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Website</span></a></p>"
"<p><a href=\"http://kritastudio.com\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Commercial Support</span></a></p>"
"<p><a href=\"http://forum.kde.org/viewforum.php?f=136\"><span style=\" text-decoration: underline; color:#FFFFFF;\">User Community</span></a></p>"
"<p><a href=\"https://projects.kde.org/projects/calligra\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Source Code</span></a></p>"
"<p><a href=\"http://store.steampowered.com/app/280680/\"><span style=\" text-decoration: underline; color:#FFFFFF;\">Get Krita on Steam</span></a></p>"
"</body>"
"</html>"));
lblVersion->setText(i18n("Version: %1", version));
KConfigGroup cfg2(KisFactory2::componentData().config(), "RecentFiles");
int i = 1;
QString recent = i18n("<html>"
"<head/>"
"<body>"
"<p align=\"center\"><b>Recent Files</b></p>");
QString path;
do {
path = cfg2.readPathEntry(QString("File%1").arg(i), QString());
if (!path.isEmpty()) {
QString name = cfg2.readPathEntry(QString("Name%1").arg(i), QString());
KUrl url(path);
if (name.isEmpty())
name = url.fileName();
if (!url.isLocalFile() || QFile::exists(url.toLocalFile())) {
recent += QString("<p><a href=\"%1\"><span style=\"color:#FFFFFF;\">%2</span></a></p>").arg(path).arg(name);
}
}
i++;
} while (!path.isEmpty() || i <= 8);
recent += "</body>"
"</html>";
lblRecent->setText(recent);
connect(lblRecent, SIGNAL(linkActivated(QString)), SLOT(linkClicked(QString)));
}
......@@ -87,3 +124,11 @@ void KisSplashScreen::toggleShowAtStartup(bool toggle)
KConfigGroup cfg(KGlobal::config(), "SplashScreen");
cfg.writeEntry("HideSplashAfterStartup", toggle);
}
void KisSplashScreen::linkClicked(const QString &link)
{
if (koApp && koApp->partList().size() > 0) {
koApp->partList().first()->openExistingFile(KUrl(link));
}
close();
}
......@@ -19,15 +19,17 @@
#define KIS_SPLASH_SCREEN_H
#include <QWidget>
#include "ui_wdgsplash.h"
class QPixmap;
class KUrl;
class KisSplashScreen : public QWidget, public Ui::WdgSplash
{
Q_OBJECT
public:
explicit KisSplashScreen(const QString &version, const QPixmap &pixmap, QWidget *parent = 0, Qt::WindowFlags f = 0);
explicit KisSplashScreen(const QString &m_version, const QPixmap &m_pixmap, QWidget *parent = 0, Qt::WindowFlags f = 0);
void repaint();
......@@ -36,10 +38,8 @@ public:
private slots:
void toggleShowAtStartup(bool toggle);
void linkClicked(const QString &link);
private:
QString version;
QPixmap pixmap;
};
#endif // KIS_SPLASH_SCREEN_H
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>440</width>
<height>579</height>
<height>381</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -356,7 +356,7 @@
<number>10</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>2</number>
</property>
<item>
<widget class="QLabel" name="lblLinks">
......@@ -395,19 +395,29 @@
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>2</number>
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
......@@ -445,10 +455,6 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>bnClose</tabstop>
<tabstop>chkShowAtStartup</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment