summaryrefslogtreecommitdiffstats
path: root/pica-client
diff options
context:
space:
mode:
authorAnton Sviridenko <anton@picapica.im>2012-10-10 06:30:15 -0700
committerAnton Sviridenko <anton@picapica.im>2012-10-10 06:30:15 -0700
commiteaa580893b18da9a638eff939a3584f0df17d7ae (patch)
tree5b250a5b0f752885be91b58025e955cd7b26a393 /pica-client
parent035f1d1e2f1810630bf5cf866136c1785f0f3dde (diff)
parent8310921c1574535ef430d364511a12847e4aa05f (diff)
downloadpica-pica-eaa580893b18da9a638eff939a3584f0df17d7ae.tar.gz
pica-pica-eaa580893b18da9a638eff939a3584f0df17d7ae.zip
Merge pull request #4 from ottoshmidt/urlinabout
Hyperlink layout of URL in About message box.
Diffstat (limited to 'pica-client')
-rw-r--r--pica-client/picaactioncenter.cpp38
-rw-r--r--pica-client/picaactioncenter.h3
2 files changed, 39 insertions, 2 deletions
diff --git a/pica-client/picaactioncenter.cpp b/pica-client/picaactioncenter.cpp
index 8bedb0f..8d36a4b 100644
--- a/pica-client/picaactioncenter.cpp
+++ b/pica-client/picaactioncenter.cpp
@@ -3,8 +3,11 @@
#include "mainwindow.h"
#include "skynet.h"
#include <QApplication>
-
#include <QMessageBox>
+#include <QPalette>
+#include <QDesktopServices>
+#include <QEvent>
+#include <QMouseEvent>
PicaActionCenter::PicaActionCenter(QObject *parent) :
QObject(parent)
@@ -16,6 +19,20 @@ PicaActionCenter::PicaActionCenter(QObject *parent) :
aboutAct = new QAction(tr("A&bout"),this);
aboutAct->setStatusTip(tr("About Pica Pica Messenger"));
connect(aboutAct,SIGNAL(triggered()),this,SLOT(about()));
+ link = new QLabel;
+ link->installEventFilter(this);
+}
+
+bool PicaActionCenter::eventFilter(QObject *obj, QEvent *ev)
+{
+ QMouseEvent *mEvent = (QMouseEvent*)ev;
+
+ if (obj == link && mEvent->button() == Qt::LeftButton &&
+ ev->type() == QEvent::MouseButtonRelease) {
+ QDesktopServices::openUrl(QUrl(link->text()));
+ }
+
+ ev->accept();
}
void PicaActionCenter::about()
@@ -25,10 +42,27 @@ void PicaActionCenter::about()
#else
#define VERSION_STRING ""
#endif
+
QMessageBox mbx;
mbx.setWindowIcon(picapica_ico_sit);
mbx.setIconPixmap(picapica_ico_sit.pixmap(32));
- mbx.setText(tr("Pica Pica Messenger "VERSION_STRING"\n(c) 2012 Anton Sviridenko\n http://picapica.im\n\n\Contributors:\nDaniil Ustinov - bugfixes"));
+ QString author = "Pica Pica Messenger "VERSION_STRING"\n"
+ "(c) 2012 Anton Sviridenko";
+
+ link->setParent(&mbx);
+ link->setText("http://picapica.im");
+ int x = author.count("\n") + 1;
+ float f = mbx.font().pointSize();
+ link->move(60, f * 2 * x);
+ link->resize(150, 30);
+ link->setForegroundRole(QPalette::Link);
+ QCursor cursor;
+ cursor.setShape(Qt::PointingHandCursor);
+ link->setCursor(cursor);
+
+ QString contrib = "\n\n\nContributors:\nDaniil Ustinov - bugfixes";
+ mbx.setText(tr(QString(author + contrib).toStdString().c_str()));
+
mbx.exec();
}
diff --git a/pica-client/picaactioncenter.h b/pica-client/picaactioncenter.h
index a406743..c768afa 100644
--- a/pica-client/picaactioncenter.h
+++ b/pica-client/picaactioncenter.h
@@ -3,6 +3,7 @@
#include <QObject>
#include <QAction>
+#include <QLabel>
class PicaActionCenter : public QObject
{
@@ -16,6 +17,8 @@ public:
private:
QAction *aboutAct;
QAction *exitAct;
+ QLabel *link;
+ bool eventFilter(QObject *obj, QEvent *ev);
signals: