code format
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#include "aboutwindow.h"
|
||||
#include "ui_aboutwindow.h"
|
||||
|
||||
#include "qad_types.h"
|
||||
#include "qpiconfig.h"
|
||||
#include "ui_aboutwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QFile>
|
||||
#if QT_VERSION < 0x050000
|
||||
@@ -23,44 +25,41 @@ AboutWindow::AboutWindow(QWidget * parent): QDialog(parent), ui(new Ui::AboutWin
|
||||
#ifdef ANDROID
|
||||
QDialog::setStyleSheet("font: 12pt \"DejaVu Sans\";");
|
||||
#endif
|
||||
if (!stylesheet.isEmpty())
|
||||
QDialog::setStyleSheet(stylesheet);
|
||||
if (!stylesheet.isEmpty()) QDialog::setStyleSheet(stylesheet);
|
||||
ui->setupUi(this);
|
||||
ui->labelAuthors->setOpenExternalLinks(true);
|
||||
QImage logo_im = logo;
|
||||
if (logo_im.isNull())
|
||||
logo_im.load(":/icons/splash.png");
|
||||
if (logo_im.isNull()) logo_im.load(":/icons/splash.png");
|
||||
setWindowTitle(QApplication::applicationName() + " - " + tr("About"));
|
||||
QIcon ic = QApplication::windowIcon();
|
||||
if (ic.isNull()) {
|
||||
QWidgetList tlw = QApplication::topLevelWidgets();
|
||||
foreach (QWidget * w, tlw)
|
||||
foreach(QWidget * w, tlw)
|
||||
if (!w->windowIcon().isNull()) {
|
||||
ic = w->windowIcon();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ic.isNull())
|
||||
ic = QIcon(QPixmap::fromImage(logo_im));
|
||||
if (ic.isNull()) ic = QIcon(QPixmap::fromImage(logo_im));
|
||||
setWindowIcon(ic);
|
||||
QFormLayout * lay = (QFormLayout*)(ui->groupVersions->layout());
|
||||
foreach (SSPair p, versions) {
|
||||
QFormLayout * lay = (QFormLayout *)(ui->groupVersions->layout());
|
||||
foreach(SSPair p, versions) {
|
||||
lay->addRow(p.first, new QLabel(p.second));
|
||||
}
|
||||
lay = (QFormLayout*)(ui->groupBuild->layout());
|
||||
foreach (SSPair p, builds) {
|
||||
lay = (QFormLayout *)(ui->groupBuild->layout());
|
||||
foreach(SSPair p, builds) {
|
||||
lay->addRow(p.first, new QLabel(p.second));
|
||||
}
|
||||
ui->imageView->setPixmap(QPixmap::fromImage(logo_im));
|
||||
ui->labelComment->setText(comment);
|
||||
ui->labelComment->setOpenExternalLinks(true);
|
||||
ui->labelComment->setHidden(comment.isEmpty());
|
||||
//ui->labelArch->setText(QSysInfo::currentCpuArchitecture());
|
||||
// ui->labelArch->setText(QSysInfo::currentCpuArchitecture());
|
||||
ui->labelAuthors->setText(authors());
|
||||
connect(ui->buttonQt, SIGNAL(clicked()), qApp, SLOT(aboutQt()));
|
||||
#ifdef MOBILE_VIEW
|
||||
ui->layoutMain->insertWidget(0, ui->imageView);
|
||||
//ui->verticalSpacer->changeSize(1, 1, QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
// ui->verticalSpacer->changeSize(1, 1, QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
#endif
|
||||
#ifdef MOBILE_VIEW
|
||||
ui->layoutMain->addSpacerItem(new QSpacerItem(1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding));
|
||||
@@ -70,18 +69,17 @@ AboutWindow::AboutWindow(QWidget * parent): QDialog(parent), ui(new Ui::AboutWin
|
||||
r = QApplication::desktop()->geometry();
|
||||
# else
|
||||
QScreen * scr =
|
||||
# if QT_VERSION >= 0x050A00
|
||||
QApplication::screenAt(QCursor::pos());
|
||||
# else
|
||||
QApplication::screens()[0];
|
||||
# endif
|
||||
# if QT_VERSION >= 0x050A00
|
||||
QApplication::screenAt(QCursor::pos());
|
||||
# else
|
||||
QApplication::screens()[0];
|
||||
# endif
|
||||
if (scr) {
|
||||
r.setSize(scr->availableSize() / 2);
|
||||
r.moveCenter(scr->availableGeometry().center());
|
||||
}
|
||||
# endif
|
||||
if (r.isValid())
|
||||
setGeometry(r);
|
||||
if (r.isValid()) setGeometry(r);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -103,7 +101,7 @@ void AboutWindow::setLogo(QString path) {
|
||||
|
||||
void AboutWindow::addVersion(QString name, QString version) {
|
||||
if (!name.endsWith(":")) name.append(":");
|
||||
foreach (const SSPair & p, versions) {
|
||||
foreach(const SSPair & p, versions) {
|
||||
if (p.first == name) return;
|
||||
}
|
||||
version.prepend("<b>");
|
||||
@@ -117,7 +115,7 @@ void AboutWindow::addVersion(QString name, QString version) {
|
||||
|
||||
void AboutWindow::addBuildInfo(QString name, QString value) {
|
||||
if (!name.endsWith(":")) name.append(":");
|
||||
foreach (const SSPair & p, builds) {
|
||||
foreach(const SSPair & p, builds) {
|
||||
if (p.first == name) return;
|
||||
}
|
||||
builds << SSPair(name, value);
|
||||
@@ -143,13 +141,13 @@ void AboutWindow::show() {
|
||||
int AboutWindow::exec() {
|
||||
#ifdef MOBILE_VIEW
|
||||
showFullScreen();
|
||||
//setWindowState(Qt::WindowFullScreen);
|
||||
// setWindowState(Qt::WindowFullScreen);
|
||||
#endif
|
||||
return QDialog::exec();
|
||||
}
|
||||
|
||||
|
||||
void AboutWindow::changeEvent(QEvent *e) {
|
||||
void AboutWindow::changeEvent(QEvent * e) {
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
@@ -202,14 +200,13 @@ QString AboutWindow::authors() {
|
||||
} else {
|
||||
QPIConfig conf(&fc);
|
||||
QPIConfig::Branch br = conf.allLeaves();
|
||||
foreach (QPIConfig::Entry * e, br) {
|
||||
foreach(QPIConfig::Entry * e, br) {
|
||||
l = e->toString().trimmed();
|
||||
if (!l.contains("<")) continue;
|
||||
QString name, mail;
|
||||
name = l.left(l.indexOf("<"));
|
||||
mail = l.mid(name.size() + 1);
|
||||
if (mail.endsWith(">"))
|
||||
mail.chop(1);
|
||||
if (mail.endsWith(">")) mail.chop(1);
|
||||
name = name.trimmed();
|
||||
mail = mail.trimmed();
|
||||
addAuthor(ret, name, mail);
|
||||
@@ -217,4 +214,3 @@ QString AboutWindow::authors() {
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user