Commit 8e955b44 authored by Ming Rui Zhang's avatar Ming Rui Zhang

changelog: show generated change logs at every fresh install

Change-Id: Iedefc63495920502a00bcb8c3a81d92db0ae321e
parent b4988375
/***************************************************************************
* Copyright (C) 2015-2017 by Savoir-faire Linux *
* Copyright (C) 2015-2019 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -23,17 +24,39 @@
#include "version.h"
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
PopupWidget(
parent,
RingTheme::lightGrey_,
PopupDialog::SpikeLabelAlignment::None),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
this->setFixedSize(this->width(),this->height());
ui->creditsWidget->hide();
ui->gitVersionLabel->setText(QString("%1: %2").arg(isBeta ? tr("beta version") : tr("version"), QString(VERSION_STRING)));
ui->gitVersionLabel->setText(QString("%1: %2")
.arg(isBeta ? tr("(BETA) version") : tr("version"), QString(VERSION_STRING)));
ui->creditsBrowser->setHtml("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">"
ui->logTextEdit->insertHtml(Utils::getChangeLog());
}
AboutDialog::~AboutDialog()
{
delete ui;
}
void
AboutDialog::on_changelogButton_clicked()
{
ui->logTextEdit->clear();
ui->logTextEdit->insertHtml(Utils::getChangeLog());
}
void
AboutDialog::on_creditsButton_clicked()
{
ui->logTextEdit->clear();
ui->logTextEdit->insertHtml("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">"
"p, li { white-space: pre-wrap; }"
"</style></head><body style=\" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;\">"
......@@ -85,22 +108,3 @@ AboutDialog::AboutDialog(QWidget *parent) :
+ tr("Based on the SFLPhone project") + "</p>"
"<p align=\"center\" style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>");
}
AboutDialog::~AboutDialog()
{
delete ui;
}
void
AboutDialog::on_aboutButton_clicked()
{
ui->aboutWidget->setVisible(true);
ui->creditsWidget->setVisible(false);
}
void
AboutDialog::on_creditsButton_clicked()
{
ui->creditsWidget->setVisible(true);
ui->aboutWidget->setVisible(false);
}
/***************************************************************************
* Copyright (C) 2015-2017 by Savoir-faire Linux *
* Copyright (C) 2015-2019 by Savoir-faire Linux *
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
......@@ -18,13 +19,13 @@
#pragma once
#include <QDialog>
#include "widgethelpers.h"
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
class AboutDialog : public PopupWidget
{
Q_OBJECT
......@@ -32,12 +33,10 @@ public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
//UI SLOTS
private slots:
void on_aboutButton_clicked();
void on_changelogButton_clicked();
void on_creditsButton_clicked();
private:
Ui::AboutDialog *ui;
};
This diff is collapsed.
......@@ -39,6 +39,7 @@
#include "pixbufmanipulator.h"
#include "ringthemeutils.h"
#include "settingskey.h"
#include "aboutdialog.h"
#include "globalinstances.h"
......@@ -219,6 +220,12 @@ CallWidget::CallWidget(QWidget* parent) :
connect(LRCInstance::renderer(), &RenderManager::videoDeviceListChanged,
this, &CallWidget::slotVideoDeviceListChanged);
connect(ui->changelogButton, &QAbstractButton::clicked,
[this] {
AboutDialog aboutDialog(this);
aboutDialog.getContainer()->exec();
});
// set first view to welcome view
ui->stackedWidget->setCurrentWidget(ui->welcomePage);
ui->btnConversations->setChecked(true);
......
......@@ -501,7 +501,7 @@
<string/>
</property>
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="welcomePage">
<property name="sizePolicy">
......@@ -960,6 +960,80 @@ Copy and share it with your friends!
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_11">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_3">
<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="changelogButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>About</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
......
......@@ -92,4 +92,9 @@ Get-ChildItem -Path $clientTSPath -Include *.qm -Recurse | ForEach-Object {
Copy-Item -Path $_.FullName -Destination $CopyDir -Force Recurse
}
write-host "copy completed" -NoNewline -ForegroundColor Green
write-host "copy completed" -ForegroundColor Green
write-host "Generate change log html" -ForegroundColor Green
$command = 'pandoc -f markdown -t html5 -o changelog.html changelog.md'
iex "& $command"
write-host "Conversion completed" -NoNewline -ForegroundColor Green
\ No newline at end of file
TEMPLATE = app
TARGET = jami-qt

CONFIG += c++17
QT += widgets xml multimedia multimediawidgets network webenginewidgets svg
......
......@@ -27,6 +27,7 @@
#include "runguard.h"
#include "utils.h"
#include "splashscreen.h"
#include "aboutdialog.h"
#include <QApplication>
#include <QFile>
......@@ -283,6 +284,12 @@ main(int argc, char* argv[])
MainWindow::instance().hide();
}
QSettings settings("jami.net", "Jami");
if (!settings.contains(SettingsKey::changeLogShownOnce)) {
std::unique_ptr<AboutDialog> aboutDialog = std::make_unique<AboutDialog>(&MainWindow::instance());
aboutDialog->getContainer()->exec();
}
QObject::connect(&a, &QApplication::aboutToQuit, [&guard] { exitApp(guard); });
auto ret = a.exec();
......
......@@ -21,12 +21,19 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "aboutdialog.h"
#include "callwidget.h"
#include "settingskey.h"
#include "utils.h"
#include "version.h"
#include <QDesktopWidget>
#include <QDir>
#include <QScreen>
#include <QStandardPaths>
#include <QTimer>
#include <QWindow>
#include <QGraphicsDropShadowEffect>
#ifdef Q_OS_WIN
#include <QWinThumbnailToolBar>
......@@ -34,12 +41,6 @@
#include <windows.h>
#endif
#include "aboutdialog.h"
#include "callwidget.h"
#include "settingskey.h"
#include "utils.h"
#include "version.h"
MainWindow::MainWindow(QWidget* parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
......@@ -217,8 +218,8 @@ bool MainWindow::nativeEvent(const QByteArray& eventType, void* message, long* r
if ((msg->wParam & 0xfff0) == IDM_ABOUTBOX) {
*result = 0;
AboutDialog aboutDialog;
aboutDialog.exec();
AboutDialog aboutDialog(this);
aboutDialog.getContainer()->exec();
return true;
}
......
......@@ -61,6 +61,9 @@ PopupDialog::setSpikeLabelAlignment(SpikeLabelAlignment spikeAlignment)
case PopupDialog::SpikeLabelAlignment::AlignRight:
ui->spikeLabel->setAlignment(Qt::AlignVCenter | Qt::AlignRight);
break;
case PopupDialog::SpikeLabelAlignment::None:
ui->spikeLabel->hide();
break;
default:
break;
}
......
......@@ -33,7 +33,8 @@ public:
{
AlignLeft,
AlignHCenter,
AlignRight
AlignRight,
None
};
explicit PopupDialog(QWidget *parent = nullptr,
......
......@@ -29,4 +29,5 @@ constexpr static char mainSplitterState[] = "mainSplitterState";
constexpr static char windowState[] = "windowState";
constexpr static char autoUpdate[] = "autoUpdate";
constexpr static char neverShowMeAgain[] = "neverShowMeAgain";
constexpr static char changeLogShownOnce[] = "changeLogShownOnce";
}
......@@ -112,21 +112,21 @@ QPushButton#btnAcceptInvite:pressed, QPushButton#btnIgnoreInvite:pressed, QPushB
background-color: rgb(187, 187, 187);
}
QPushButton#imBackButton:hover, QPushButton#btnAudioCall:hover, QPushButton#btnVideoCall:hover,
QPushButton#sendContactRequestButton:hover, QPushButton#sendButton:hover, QPushButton#sendIMButton:hover,
QPushButton#btnExitSettings:hover, QPushButton#btnDeleteAccept:hover, QPushButton#btnDeleteCancel:hover,
QPushButton#aboutButton:hover, QPushButton#creditsButton:hover, QPushButton#updateCancelBtn:hover,
QPushButton#updateAcceptBtn:hover, QPushButton#installBetaButton:hover {
QPushButton#imBackButton:hover, QPushButton#btnAudioCall:hover, QPushButton#btnVideoCall:hover,
QPushButton#sendContactRequestButton:hover, QPushButton#sendButton:hover, QPushButton#sendIMButton:hover,
QPushButton#btnExitSettings:hover, QPushButton#btnDeleteAccept:hover, QPushButton#btnDeleteCancel:hover,
QPushButton#changelogButton:hover, QPushButton#creditsButton:hover, QPushButton#changelogButton:hover, QPushButton#updateCancelBtn:hover,
QPushButton#updateAcceptBtn:hover, QPushButton#installBetaButton:hover {
background-color: rgb(237, 237, 237);
}
}
QPushButton#imBackButton:pressed, QPushButton#btnAudioCall:pressed, QPushButton#btnVideoCall:pressed,
QPushButton#sendContactRequestButton:pressed, QPushButton#sendButton:pressed, QPushButton#sendIMButton:pressed,
QPushButton#btnExitSettings:pressed, QPushButton#btnDeleteAccept:pressed, QPushButton#btnDeleteCancel:pressed,
QPushButton#aboutButton:pressed, QPushButton#creditsButton:pressed, QPushButton#updateCancelBtn:pressed,
QPushButton#updateAcceptBtn:pressed, QPushButton#installBetaButton:pressed {
QPushButton#imBackButton:pressed, QPushButton#btnAudioCall:pressed, QPushButton#btnVideoCall:pressed,
QPushButton#sendContactRequestButton:pressed, QPushButton#sendButton:pressed, QPushButton#sendIMButton:pressed,
QPushButton#btnExitSettings:pressed, QPushButton#btnDeleteAccept:pressed, QPushButton#btnDeleteCancel:pressed,
QPushButton#changelogButton:pressed, QPushButton#creditsButton:pressed, QPushButton#changelogButton:pressed, QPushButton#updateCancelBtn:pressed,
QPushButton#updateAcceptBtn:pressed, QPushButton#installBetaButton:pressed {
background-color: rgb(212, 212, 212);
}
}
QWidget#searchBarLayoutWidget, QWidget#smartList,
QWidget#sidePanelLayoutWidget, QWidget#leftSettingsWidget {
......@@ -260,7 +260,7 @@ QMessageBox QPushButton:pressed {
background: #58b;
}
QToolButton#qrButton, QToolButton#shareButton{
QToolButton#qrButton, QToolButton#shareButton {
background-color: rgb(242, 242, 242);
border-style: solid;
border-width: 0px;
......@@ -269,13 +269,13 @@ QToolButton#qrButton, QToolButton#shareButton{
color: rgb(32, 32, 32);
}
QToolButton#qrButton:hover, QToolButton#shareButton:hover{
QToolButton#qrButton:hover, QToolButton#shareButton:hover {
background-color: rgb(237, 237, 237);
}
}
QToolButton#qrButton:pressed, QToolButton#shareButton:pressed{
QToolButton#qrButton:pressed, QToolButton#shareButton:pressed {
background-color: rgb(212, 212, 212);
}
}
QToolButton#qrButton:checked {
background-color: rgb(237, 237, 237);
......@@ -897,3 +897,31 @@ QProgressBar#levelMeter {
background-color: white;
margin: 2px;
}
QScrollArea#changeLogScrollArea {
background-color: transparent;
color: white;
border: none;
}
QWidget#changeLogContents {
background-color: transparent;
color: white;
border: none;
}
QTextEdit#logTextEdit {
background-color: white;
color: black;
}
QPushButton#logCloseButton {
background-color: rgb(189, 189, 189);
}
QPushButton#logCloseButton:hover {
background-color: rgb(170, 170, 170);
}
QPushButton#logCloseButton:pressed {
background-color: rgb(180, 180, 180);
}
\ No newline at end of file
......@@ -323,6 +323,22 @@ Utils::forceDeleteAsync(const QString& path)
});
}
QString
Utils::getChangeLog()
{
QString logs;
QFile changeLogFile("changelog.html");
if (!changeLogFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug().noquote() << " Change log file failed to load";
return {};
}
QTextStream in(&changeLogFile);
while (!in.atEnd()) {
logs += in.readLine();
}
return logs;
}
void
Utils::cleanUpdateFiles()
{
......
......@@ -73,6 +73,7 @@ void showSystemNotification(QWidget* widget, const QString& message, long delay
void showSystemNotification(QWidget* widget, const QString& sender, const QString& message, long delay = 5000);
QSize getRealSize(QScreen* screen);
void forceDeleteAsync(const QString& path);
QString getChangeLog();
// updates
void cleanUpdateFiles();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment