Adding upstream version 0.9.0+20150806.

Signed-off-by: Andrew Lee's avatarAndrew Lee (李健秋) <ajqlee@debian.org>
parent 9e35c4f8
cmake_minimum_required(VERSION 2.8.11)
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
project(lxqt-about)
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
include(GNUInstallDirs)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CPP_FILES
aboutdialog/lxqtaboutdialog.cpp
aboutdialog/technicalinfo.cpp
translatorsinfo/translatorsinfo.cpp
main.cpp
)
find_package(Qt5Widgets REQUIRED QUIET)
find_package(Qt5DBus REQUIRED QUIET)
find_package(Qt5X11Extras REQUIRED QUIET)
set(UI_FILES
aboutdialog/lxqtaboutdialog.ui
)
find_package(lxqt REQUIRED QUIET)
include(${LXQT_USE_FILE})
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${LXQT_INCLUDE_DIR}
)
include(LXQtCompilerSettings NO_POLICY_SCOPE)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(APP_SHARE_DIR share/lxqt/${PROJECT_NAME})
# Translations **********************************
include(LXQtTranslate)
lxqt_translate_ts(QM_FILES
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
SOURCES
${H_FILES}
${CPP_FILES}
${UI_FILES}
INSTALL_DIR
"${LXQT_TRANSLATIONS_DIR}/${PROJECT_NAME}"
)
lxqt_app_translation_loader(QM_LOADER ${PROJECT_NAME})
# Translations **********************************
include(LXQtTranslateDesktop)
lxqt_translate_desktop(DESKTOP_FILES
SOURCES
resources/lxqt-about.desktop.in
)
#************************************************
include(translatorsinfo/CMakeLists.txt)
get_translatorsinfo_qrc(translatorsinfo_qrc)
add_executable(${PROJECT_NAME}
${CPP_FILES}
${QM_FILES}
${DESKTOP_FILES}
${translatorsinfo_qrc}
${QM_LOADER}
)
target_link_libraries(${PROJECT_NAME}
Qt5::Widgets
Qt5::DBus
Qt5::X11Extras
${LXQT_LIBRARIES}
lxqt
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION bin)
install(FILES ${CONFIG_FILES} DESTINATION ${APP_SHARE_DIR})
install(FILES ${DESKTOP_FILES} DESTINATION share/applications)
install(TARGETS
${PROJECT_NAME}
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
COMPONENT Runtime
)
install(FILES
${DESKTOP_FILES}
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
COMPONENT Runtime
)
# building tarball with CPack -------------------------------------------------
include(InstallRequiredSystemLibraries)
......
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXQt - The Lightweight Desktop Environment
* http://lxqt.org
*
* Copyright: 2010-2011 Razor team
* Authors:
* Petr Vanek <petr@scribus.info>
*
* This program or library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* END_COMMON_COPYRIGHT_HEADER */
#include "lxqtaboutdialog.h"
#include "ui_lxqtaboutdialog.h"
#include "lxqtaboutdialog_p.h"
#include "technicalinfo.h"
#include "translatorsinfo/translatorsinfo.h"
#include <QDebug>
#include <QDate>
#include <QClipboard>
AboutDialogPrivate::AboutDialogPrivate()
{
setupUi(this);
QString css="<style TYPE='text/css'> "
"body { font-family: sans-serif;} "
".name { font-size: 16pt; } "
"a { white-space: nowrap ;} "
"h2 { font-size: 10pt;} "
"li { line-height: 120%;} "
".techInfoKey { white-space: nowrap ; margin: 0 20px 0 16px; } "
"</style>"
;
iconLabel->setFixedSize(48, 48);
iconLabel->setScaledContents(true);
iconLabel->setPixmap(QPixmap(QString(LXQT_SHARE_DIR) + "/graphics/lxqt_logo.png"));
nameLabel->setText(css + titleText());
aboutBrowser->setHtml(css + aboutText());
aboutBrowser->viewport()->setAutoFillBackground(false);
autorsBrowser->setHtml(css + authorsText());
autorsBrowser->viewport()->setAutoFillBackground(false);
thanksBrowser->setHtml(css + thanksText());
thanksBrowser->viewport()->setAutoFillBackground(false);
translationsBrowser->setHtml(css + translationsText());
translationsBrowser->viewport()->setAutoFillBackground(false);
TechnicalInfo info;
techBrowser->setHtml(info.html());
techBrowser->viewport()->setAutoFillBackground(false);
connect(techCopyToClipboardButton, SIGNAL(clicked()), this, SLOT(copyToCliboardTechInfo()));
this->setAttribute(Qt::WA_DeleteOnClose);
show();
}
QString AboutDialogPrivate::titleText() const
{
return QString("<div class=name>%1</div><div class=ver>%2</div>").arg("LXQt",
tr("Version: %1").arg(LXQT_VERSION));
}
QString AboutDialogPrivate::aboutText() const
{
return QString(
"<p>%1</p>"
"<p>%2</p>"
"<p>%3</p>"
"<p>%4</p>"
"<p>%5</p>")
.arg(
tr("Advanced, easy-to-use, and fast desktop environment based on Qt technologies.",
"About dialog, 'About' tab text"),
tr("LXQt would not have been possible without the <a %1>Razor-qt</a> project and its many contributors.",
"About dialog, 'About' tab text").arg("href=\"http://razor-qt.org\""),
tr("Copyright: %1-%2 %3", "About dialog, 'About' tab text")
.arg("2010", QDate::currentDate().toString("yyyy"), "LXQt team"),
tr("Homepage: %1", "About dialog, 'About' tab text")
.arg("<a href=\"http://lxqt.org\">http://lxqt.org</a>"),
tr("License: %1", "About dialog, 'About' tab text")
.arg("<a href=\"http://www.gnu.org/licenses/lgpl-2.1.html\">GNU Lesser General Public License version 2.1 or later</a>"
" and partly under the "
"<a href=\"http://www.gnu.org/licenses/gpl-2.0.html\">GNU General Public License version 2</a>")
);
}
QString AboutDialogPrivate::authorsText() const
{
return QString("<p>%1</p><p>%2</p>").arg(
tr("LXQt is developed by the <a %1>LXQt Team and contributors</a>.", "About dialog, 'Authors' tab text")
.arg(" href=\"https://github.com/lxde/lxde-qt\""),
tr("If you are interested in working with our development team, <a %1>join us</a>.", "About dialog, 'Authors' tab text")
.arg("href=\"http://lxqt.org\"")
);
}
QString AboutDialogPrivate::thanksText() const
{
return QString(
"%1"
"<ul>"
"<li>Alexey Nosov (for the A-MeGo theme)</li>"
"<li>Alexander Zakher (the Razor-qt name)</li>"
"<li>Andy Fitzsimon (logo/icon)</li>"
"<li>Eugene Pivnev (QtDesktop)</li>"
"<li>Paul Gnther (desktop backgrounds)</li>"
"<li>Manuel Meier (for ideas)</li>"
"<li>KDE &lt;<a href=\"http://kde.org/\">http://kde.org/</a>&gt;</li>"
).arg(tr("Special thanks to:", "About dialog, 'Thanks' tab text"));
}
QString AboutDialogPrivate::translationsText() const
{
TranslatorsInfo translatorsInfo;
return QString("%1<p><ul>%2</ul>").arg(
tr("LXQt is translated into many languages thanks to the work of the translation teams all over the world.", "About dialog, 'Translations' tab text"),
translatorsInfo.asHtml()
);
}
AboutDialog::AboutDialog()
{
d_ptr = new AboutDialogPrivate();
}
void AboutDialogPrivate::copyToCliboardTechInfo()
{
TechnicalInfo info;
QClipboard *clipboard = QApplication::clipboard();
clipboard->setText(info.text());
}
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXQt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2010-2011 Razor team
* Authors:
* Petr Vanek <petr@scribus.info>
*
* This program or library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef LXQTRABOUTDIALOG_H
#define LXQTRABOUTDIALOG_H
#include <QDialog>
class AboutDialogPrivate;
/**
* @brief displays a simple about dialog
*/
class AboutDialog: public QDialog
{
Q_OBJECT
public:
AboutDialog();
private:
AboutDialogPrivate * d_ptr;
};
#endif // LXQTRABOUTDIALOG_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>about</class>
<widget class="QDialog" name="about">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>633</width>
<height>416</height>
</rect>
</property>
<property name="windowTitle">
<string> About LXQt</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>21</number>
</property>
<property name="bottomMargin">
<number>16</number>
</property>
<item>
<widget class="QLabel" name="iconLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeIncrement">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string notr="true">&lt;h1&gt;LXQt&lt;/h1&gt;&lt;p&gt;Version: %1&lt;/p&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string comment="About dialog, Tab title ">About</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QTextBrowser" name="aboutBrowser">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string comment="About dialog, Tab title">Authors</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QTextBrowser" name="autorsBrowser">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_4">
<attribute name="title">
<string comment="About dialog, Tab title">Thanks</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QTextBrowser" name="thanksBrowser">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="translationsTab">
<attribute name="title">
<string comment="About dialog, Tab title">Translations</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTextBrowser" name="translationsBrowser">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string comment="About dialog, Tab title">Technical Info</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QTextBrowser" name="techBrowser">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="techCopyToClipboardButton">
<property name="text">
<string>Copy to clipboard</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>about</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>303</x>
<y>273</y>
</hint>
<hint type="destinationlabel">
<x>437</x>
<y>290</y>
</hint>
</hints>
</connection>
</connections>
</ui>
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXQt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2010-2011 Razor team
* Authors:
* Petr Vanek <petr@scribus.info>
*
* This program or library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* END_COMMON_COPYRIGHT_HEADER */
#ifndef LXQT_ABOUTDIALOG_P_H
#define LXQT_ABOUTDIALOG_P_H
#include "ui_lxqtaboutdialog.h"
#include <QDialog>
/**
* @brief prepares the data to show and fills the form, then shows.
*/
class AboutDialogPrivate: public QDialog, public Ui_about
{
Q_OBJECT
public:
AboutDialogPrivate();
QString titleText() const;
QString aboutText() const;
QString authorsText() const;
QString thanksText() const;
QString translationsText() const;
public slots:
void copyToCliboardTechInfo();
};
#endif // LXQT_ABOUTDIALOG_P_H
/* BEGIN_COMMON_COPYRIGHT_HEADER
* (c)LGPL2+
*
* LXQt - a lightweight, Qt based, desktop toolset
* http://razor-qt.org
*
* Copyright: 2012 Razor team
* Authors:
* Alexander Sokoloff <sokoloff.a@gmail.com>
*
* This program or library is free software; you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*
* END_COMMON_COPYRIGHT_HEADER */
#include "technicalinfo.h"
#include <LXQt/Translator>
#include <XdgDirs>
using namespace LxQt;
class TechInfoTable
{
public:
TechInfoTable(const QString &title);
void add(const QString &name, const QVariant &value);
QString html() const;
QString text(int nameFieldWidth) const;
int maxNameLength() const;
private:
QString mTitle;
QList<QPair<QString,QString> > mRows;
};
TechInfoTable::TechInfoTable(const QString &title)
{
mTitle = title;
}
void TechInfoTable::add(const QString &name, const QVariant &value)
{
QPair<QString,QString> row;
row.first = name;
row.second = value.toString();
mRows.append(row);
}
QString TechInfoTable::html() const
{
QString res;
res = "<style TYPE='text/css'> "
".techInfoKey { white-space: nowrap ; margin: 0 20px 0 16px; } "
"</style>";
res += QString("<b>%1</b>").arg(mTitle);
res += "<table width='100%'>";
QPair<QString,QString> row;
foreach(row, mRows)
{
res += QString("<tr>"
"<td class=techInfoTd width='1%'>"
"<div class=techInfoKey>%1</div>"
"</td>"
"<td>%2</td>"
"</tr>").arg(row.first, row.second);
}
res += "</table>";
return res;
}
QString TechInfoTable::text(int nameFieldWidth) const
{
QString res;
res += QString("%1\n").arg(mTitle);
QPair<QString,QString> row;
foreach(row, mRows)
{
res += QString(" %1 %2\n")
.arg(row.first + ":", -nameFieldWidth)
.arg(row.second);
}
return res;
}
int TechInfoTable::maxNameLength() const
{
int res = 0;
QPair<QString,QString> row;
foreach (row, mRows)
res = qMax(res, row.first.length());
return res;
}
QString TechnicalInfo::html() const
{
QString res;
foreach (TechInfoTable* item, mItems)
{
res += item->html();
res += "<br><br>";
}
return res;
}
QString TechnicalInfo::text() const
{
int nameWidth = 0;
foreach (TechInfoTable* item, mItems)
nameWidth = qMax(nameWidth, item->maxNameLength());
QString res;
foreach (TechInfoTable* item, mItems)
{
res += item->text(nameWidth + 2);
res += "\n\n";
}
return res;
}
TechInfoTable *TechnicalInfo::newTable(const QString &title)
{
TechInfoTable *table = new TechInfoTable(title);
mItems.append(table);
return table;
}
TechnicalInfo::~TechnicalInfo()
{
qDeleteAll(mItems);
}
TechnicalInfo::TechnicalInfo()
{
TechInfoTable *table;