source: smplayer/trunk/src/sharedialog.cpp@ 170

Last change on this file since 170 was 170, checked in by Silvan Scherrer, 11 years ago

SMPlayer: updated trunk to 14.9.0

File size: 3.7 KB
Line 
1/* smplayer, GUI front-end for mplayer.
2 Copyright (C) 2006-2014 Ricardo Villalba <rvm@users.sourceforge.net>
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17*/
18
19#include "sharedialog.h"
20#include <QDesktopServices>
21#include <QUrl>
22
23ShareDialog::ShareDialog( QWidget* parent, Qt::WindowFlags f )
24 : QDialog(parent, f)
25 , actions_taken(0)
26{
27 setupUi(this);
28
29 donate_button->setIcon(QPixmap(":/icons-png/paypal.png"));
30 donate_button->setIconSize(QSize(64,64));
31 donate_button->setText(tr("Donate with Paypal"));
32 donate_button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
33
34 facebook_button->setIcon(QPixmap(":/icons-png/social_facebook.png"));
35 facebook_button->setIconSize(QSize(64,64));
36 facebook_button->setText("Facebook");
37 facebook_button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
38
39 twitter_button->setIcon(QPixmap(":/icons-png/social_twitter.png"));
40 twitter_button->setIconSize(QSize(64,64));
41 twitter_button->setText("Twitter");
42 twitter_button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
43
44 intro_label->setText("<html><head/><body><p align=\"center\"><span style=\" font-size:16pt;\">" +
45 tr("You can support SMPlayer by sending a donation or sharing it with your friends.") + "</span></p></body></html>");
46
47 setMinimumSize(QSize(435, 226));
48
49 adjustSize();
50 //layout()->setSizeConstraint(QLayout::SetFixedSize);
51
52 share_url = "http://smplayer.sourceforge.net";
53}
54
55ShareDialog::~ShareDialog() {
56}
57
58bool ShareDialog::isRemindChecked() {
59 return remind_check->isChecked();
60}
61
62void ShareDialog::showRemindCheck(bool b) {
63 check_widget->setVisible(b);
64 adjustSize();
65}
66
67void ShareDialog::on_donate_button_clicked() {
68 qDebug("ShareDialog::on_donate_button_clicked");
69 actions_taken |= Donate;
70 QDesktopServices::openUrl(QUrl("http://smplayer.sourceforge.net/donate.php"));
71}
72
73void ShareDialog::on_facebook_button_clicked() {
74 qDebug("ShareDialog::on_facebook_button_clicked");
75 actions_taken |= Facebook;
76 QDesktopServices::openUrl(QUrl("http://www.facebook.com/sharer.php?u=" + share_url /* + "&t=" + share_text */ ));
77}
78
79void ShareDialog::on_twitter_button_clicked() {
80 qDebug("ShareDialog::on_twitter_button_clicked");
81 actions_taken |= Twitter;
82
83 QString text = tr("SMPlayer is a free media player for PC. It plays all formats and can even download Youtube videos.",
84 "This text is to be published on twitter and the translation should not be more than 99 characters long");
85
86 qDebug("ShareDialog::on_twitter_button_clicked: length: %d", text.length());
87 if (text.length() > 99) {
88 qDebug("ShareDialog::on_twitter_button_clicked: the translation text is too long (%d), it shouldn't be longer than 99 characters. Using the English text.", text.length());
89 text = "SMPlayer is a free media player for PC. It plays all formats and can even download Youtube videos.";
90 }
91 //text = text.replace("SMPlayer", "#SMPlayer");
92 text = QUrl::toPercentEncoding(text);
93 QString url = "http://twitter.com/intent/tweet?text=" + text + "&url=" + QUrl::toPercentEncoding(share_url) + "/&via=smplayer_dev";
94 QDesktopServices::openUrl(QUrl::fromEncoded(url.toLatin1()));
95}
96
97#include "moc_sharedialog.cpp"
Note: See TracBrowser for help on using the repository browser.