* Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
*
* Contact:
+ * jihye kim <jihye424.kim@samsung.com>
* GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
#include "mainwindow.h"
#include "emul_state.h"
+#ifdef CONFIG_WIN32
+#define TITLE_FONT_SIZE_1 11
+#define TITLE_FONT_SIZE_2 22
+#define TITLE_FONT_SIZE_3 "11"
+#define TEXT_FONT_SIZE 8
+#elif defined(CONFIG_DARWIN)
+#define TITLE_FONT_SIZE_1 14
+#define TITLE_FONT_SIZE_2 25
+#define TITLE_FONT_SIZE_3 "14"
+#define TEXT_FONT_SIZE 12
+#else
+#define TITLE_FONT_SIZE_1 12
+#define TITLE_FONT_SIZE_2 23
+#define TITLE_FONT_SIZE_3 "12"
+#define TEXT_FONT_SIZE 10
+#endif
+
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent, Qt::Dialog | Qt::WindowStaysOnTopHint)
{
setWindowTitle(ABOUT_TITLE);
-
- // remove ? button
+ /* remove ? button */
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
+ setStyleSheet("background-color: white");
- QVBoxLayout *baseLayout = new QVBoxLayout(this);
- baseLayout->setMargin(0);
- baseLayout->setSpacing(5);
-
- /* upside */
- QHBoxLayout *upsideLayout = new QHBoxLayout();
- upsideLayout->setMargin(0);
- upsideLayout->setSpacing(0);
-
+ /* top side - title image */
QLabel *imageLabel = new QLabel(this);
QString sdkImagePath = QDir(QCoreApplication::applicationDirPath() +
QDir::separator() + SDK_EMULATOR_IMAGES_PATH + SDK_ABOUT_IMAGE_FILE).absolutePath();
- QPixmap sdkImage(sdkImagePath);
- if (sdkImage.isNull() == false) {
- imageLabel->setPixmap(sdkImage);
- } else {
+
+ QPixmap sdkImage(430, 90);
+ sdkImage.fill(Qt::blue);
+ if (!sdkImage.load(sdkImagePath)) {
qWarning() << "failed to load image from" << sdkImagePath;
}
- upsideLayout->addWidget(imageLabel);
+ imageLabel->setPixmap(sdkImage);
+
+ /* make title text */
+ makeTitleText(imageLabel);
+
+ /* bottom side */
+ QFrame *line = new QFrame();
+ line->setStyleSheet("color: rgb(173, 173, 173)");
+ line->setFrameShape(QFrame::HLine);
+ line->setLineWidth(1);
+ line->setFrameShadow(QFrame::Plain);
+
+ QHBoxLayout *downsideLayout = new QHBoxLayout();
+ downsideLayout->setAlignment(Qt::AlignRight);
+ downsideLayout->setContentsMargins(20,18, 20, 18);
+ QPushButton *closeBtn = new QPushButton("Close", this);
+ closeBtn->setMinimumSize(QSize(86, 24));
+ closeBtn->setStyleSheet(
+ "QPushButton {"
+ "border: 2px solid #008AEE;"
+ "border-radius: 0px;"
+ "background-color: #E1E1E1;"
+ "background-radius: 0px;"
+ "outline: none;"
+ "}"
+ "QPushButton:hover {"
+ "background-color: #CDE9FF;"
+ "}"
+ "QPushButton:pressed {"
+ "background-color: #008AEE;"
+ "}");
+
+ connect(closeBtn, SIGNAL(clicked()), this, SLOT(close()));
+ downsideLayout->addWidget(closeBtn);
+
+ QVBoxLayout *baseLayout = new QVBoxLayout(this);
+ baseLayout->setMargin(0);
+ baseLayout->setSpacing(0);
+ baseLayout->addWidget(imageLabel);
+
+ /* center side */
+ baseLayout->addLayout(makeAboutText());
+
+ baseLayout->addWidget(line);
+ baseLayout->addLayout(downsideLayout);
+}
- /* Emulator platform version*/
+void AboutDialog::makeTitleText(QWidget *widget)
+{
+ /* Emulator platform version */
QString platformVersion = QString(get_platform_version()).section('-', 1).trimmed();
+ QLabel *sdk_name = new QLabel();
+ QLabel *title = new QLabel();
+ sdk_name->setStyleSheet("background-color: rgba(255,255,255,0%)");
+ title->setStyleSheet("background-color: rgba(255,255,255,0%)");
+ sdk_name->setText("<font color=\"white\">" + QString(SDK_OFFICIAL_NAME) + "</font>");
+
+ title->setText("<font color=\"white\">" + QString("Emulator ")
+ + "<span style=\"font-size:" + TITLE_FONT_SIZE_3 + "pt\">"+ QString("for " + platformVersion)
+ + "</span>" + "</font>");
+
+ QFont font = sdk_name->font();
+ font.setFamily("Arial");
+ font.setPointSize(TITLE_FONT_SIZE_1);
+ sdk_name->setFont(font);
+
+ font = title->font();
+ font.setFamily("Arial");
+ font.setPointSize(TITLE_FONT_SIZE_2);
+ font.setBold(true);
+ title->setFont(font);
+
+ sdk_name->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+ title->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
+
+ QVBoxLayout *box = new QVBoxLayout(widget);
+ QVBoxLayout *titleLayout = new QVBoxLayout();
+ titleLayout->setSpacing(0);
+ titleLayout->setMargin(0);
+
+ titleLayout->addWidget(sdk_name);
+ titleLayout->addWidget(title);
+
+ box->setContentsMargins(28,20,50,17);
+ box->addLayout(titleLayout);
+}
+
+QLayout * AboutDialog::makeAboutText()
+{
/* SDK version */
QString versionFilePath = QDir(QCoreApplication::applicationDirPath() +
QDir::separator() + SDK_ROOT_PATH + SDK_VERSION_FILE).absolutePath();
QSettings versionFile(versionFilePath, QSettings::IniFormat);
- QString sdkVer = versionFile.value(SDK_VERSION_FILE_KEY).toString();
- if (sdkVer.isEmpty() == true) {
+
+ QString sdkVerTxt = versionFile.value(SDK_VERSION_FILE_KEY).toString();
+ if (sdkVerTxt.isEmpty() == true) {
qWarning() << "failed to load SDK version file from" << versionFilePath;
- sdkVer = GENERIC_TEXT_UNDEFINED;
+ sdkVerTxt = GENERIC_TEXT_UNDEFINED;
}
/* Package version */
- QString pkgVer = QString(pkginfo_version).section(':', 1);
-
- /*
- QString SnapshotName = "Undefined";
- QFile file("../../../install-manager/installmanager.conf");
- if (file.open(QIODevice::ReadOnly | QIODevice::Text) == true) {
- QTextStream in(&file);
- while (!in.atEnd()) {
- QString line = in.readLine();
- if (line.startsWith("Snapshot-Path", Qt::CaseInsensitive) == true) {
- QStringList snapshotPath = line.split(":", QString::SkipEmptyParts)[1].split("/");
- SnapshotName = snapshotPath.last().trimmed();
- qDebug() << "Snapshot Name :" << SnapshotName;
- }
- }
-
- file.close();
- } else {
- qWarning("failed to load snapshot name");
- }
- */
-
- QString aboutText =
- "<b>" + QString(EMULATOR_TITLE) + " for " + platformVersion + "</b><p>" +
- ABOUT_SDK_VERSION_TEXT + " : " + sdkVer + "<br>" +
- ABOUT_PKG_VERSION_TEXT + " : " + pkgVer + "<br>" +
- /* "Snapshot : " + SnapshotName + "<br>" + */
- ABOUT_BUILD_DATE_TEXT + " : " + QString(build_date) + "<p><br>" +
- ABOUT_VISIT_TEXT + " <a href=\"" + SDK_OFFICIAL_URL + "\">" +
- SDK_OFFICIAL_URL + "</a>";
-
- QLabel *textLabel = new QLabel(this);
- textLabel->setStyleSheet("background-color: white");
- textLabel->setTextFormat(Qt::RichText);
- //textLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
- textLabel->setOpenExternalLinks(true);
- textLabel->setMargin(10);
- textLabel->setText(aboutText);
- upsideLayout->addWidget(textLabel);
-
- baseLayout->addLayout(upsideLayout);
-
- /* downside */
- QHBoxLayout *downsideLayout = new QHBoxLayout();
- downsideLayout->setAlignment(Qt::AlignRight);
- downsideLayout->setMargin(10);
-
- QPushButton *okBtn = new QPushButton("OK", this);
- connect(okBtn, SIGNAL(clicked()), this, SLOT(close()));
- downsideLayout->addWidget(okBtn);
-
- baseLayout->addLayout(downsideLayout);
+ QString pkgVerTxt = QString(pkginfo_version).section(':', 1);
+ QString siteTxt = "<a href=\"" + QString(SDK_OFFICIAL_URL) + "\">"
+ SDK_OFFICIAL_URL + "</a>";
+
+ QLabel *sdkVerTitle = new QLabel(ABOUT_SDK_VERSION_TEXT);
+ QLabel *sdkVer = new QLabel(sdkVerTxt);
+ QLabel *pkgVerTitle = new QLabel(ABOUT_PKG_VERSION_TEXT);
+ QLabel *pkgVer = new QLabel(pkgVerTxt);
+ QLabel *buildDateTitle = new QLabel(ABOUT_BUILD_DATE_TEXT);
+ QLabel *buildDate = new QLabel(QString(build_date));
+ QLabel *siteTitle = new QLabel(ABOUT_VISIT_TEXT);
+ QLabel *site = new QLabel();
+ site->setTextFormat(Qt::RichText);
+ site->setOpenExternalLinks(true);
+ site->setText(siteTxt);
+
+ QFont titleFont = sdkVerTitle->font();
+ titleFont.setPointSize(TEXT_FONT_SIZE);
+ titleFont.setBold(true);
+ sdkVerTitle->setFont(titleFont);
+ pkgVerTitle->setFont(titleFont);
+ buildDateTitle->setFont(titleFont);
+ siteTitle->setFont(titleFont);
+
+ QFont txtFont = sdkVer->font();
+ txtFont.setPointSize(TEXT_FONT_SIZE);
+ sdkVer->setFont(txtFont);
+ pkgVer->setFont(txtFont);
+ buildDate->setFont(txtFont);
+ site->setFont(txtFont);
+
+ QGridLayout *gridLayout = new QGridLayout();
+ gridLayout->setVerticalSpacing(17);
+ gridLayout->setHorizontalSpacing(40);
+ gridLayout->addWidget(sdkVerTitle, 0, 0, 1, 1);
+ gridLayout->addWidget(sdkVer, 0, 1, 1, 1);
+ gridLayout->addWidget(pkgVerTitle, 1, 0, 1, 1);
+ gridLayout->addWidget(pkgVer, 1, 1, 1, 1);
+ gridLayout->addWidget(buildDateTitle, 2, 0, 1, 1);
+ gridLayout->addWidget(buildDate, 2, 1, 1, 1);
+ gridLayout->addWidget(siteTitle, 3, 0, 1, 1);
+ gridLayout->addWidget(site, 3, 1, 1, 1);
+
+ gridLayout->setColumnMinimumWidth(0, 110);
+ gridLayout->setColumnMinimumWidth(1, 190);
+ gridLayout->setColumnStretch(1, 190);
+
+ QVBoxLayout *layout = new QVBoxLayout();
+ layout->setContentsMargins(28, 22, 0, 22);
+ layout->addLayout(gridLayout);
+ return (QLayout *)layout;
}
-
/* override */
void AboutDialog::showEvent(QShowEvent *event)
{