mirror of
https://github.com/ONLYOFFICE/desktop-apps.git
synced 2026-04-07 14:09:22 +08:00
Merge pull request 'Online installer review' (#131) from feature/online-installer-review-r5 into release/v8.3.0
This commit is contained in:
BIN
win-linux/extras/online-installer/res/icons/welcome.emf
Normal file
BIN
win-linux/extras/online-installer/res/icons/welcome.emf
Normal file
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 1.7 KiB |
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<assemblyIdentity
|
||||
version="1.0.0.0"
|
||||
processorArchitecture="*"
|
||||
@ -41,6 +41,9 @@
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2020/WindowsSettings">
|
||||
<heapType>SegmentHeap</heapType>
|
||||
</asmv3:windowsSettings>
|
||||
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2017/WindowsSettings">
|
||||
<gdiScaling>true</gdiScaling>
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "../src/resource.h"
|
||||
|
||||
IDI_MAINICON ICON DISCARDABLE APP_ICON_PATH
|
||||
IDI_WELCOME PNG "./icons/welcome.png"
|
||||
IDI_WELCOME RCDATA "./icons/welcome.emf"
|
||||
IDT_TRANSLATIONS RCDATA APP_LANG_PATH
|
||||
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "./manifest/online-installer.exe.manifest"
|
||||
|
||||
|
||||
@ -182,7 +182,7 @@ void MainWindow::initInstallationMode(const std::wstring &url)
|
||||
/* Image section*/
|
||||
Label *wlcLbl = new Label(m_cenPanel);
|
||||
wlcLbl->resize(282, 200);
|
||||
wlcLbl->setImage(IDI_WELCOME, 282, 200);
|
||||
wlcLbl->setEMFIcon(IDI_WELCOME, 282, 200);
|
||||
wlcLbl->palette()->setColor(Palette::Background, Palette::Normal, 0xfefefe);
|
||||
wlcLbl->setProperty(Widget::HSizeBehavior, Widget::Expanding);
|
||||
wlcLbl->setProperty(Widget::VSizeBehavior, Widget::Fixed);
|
||||
@ -191,7 +191,7 @@ void MainWindow::initInstallationMode(const std::wstring &url)
|
||||
/* Check box section*/
|
||||
CheckBox *chkBox = new CheckBox(m_cenPanel, _TR(CHECK_SILENT));
|
||||
chkBox->setChecked(m_is_checked);
|
||||
chkBox->setGeometry(m_cenPanel->size().width/2 - 43, 254, 180, 16);
|
||||
chkBox->setGeometry(m_cenPanel->size().width/2 - 60, 254, 180, 18);
|
||||
setSelectorStyle(chkBox);
|
||||
chkBox->onClick([chkBox, this]() {
|
||||
m_is_checked = chkBox->isChecked();
|
||||
@ -219,7 +219,7 @@ void MainWindow::initInstallationMode(const std::wstring &url)
|
||||
});
|
||||
|
||||
m_resize_conn = m_cenPanel->onResize([chkBox, comntLbl, instlBtn](int w, int h) {
|
||||
chkBox->setGeometry(w/2 - 43, 254, 180, 16);
|
||||
chkBox->setGeometry(w/2 - 60, 254, 180, 18);
|
||||
comntLbl->setGeometry(0, h - 130, w, 48);
|
||||
instlBtn->setGeometry(w/2 - 50, h - 76, 100, 28);
|
||||
});
|
||||
@ -338,7 +338,7 @@ void MainWindow::finishInstall(const std::wstring &app_path)
|
||||
/* Check box section*/
|
||||
m_is_checked = false;
|
||||
CheckBox *chkBox = new CheckBox(m_cenPanel, _TR(CHECK_LAUNCH));
|
||||
chkBox->setGeometry(m_cenPanel->size().width/2 - 43, 254, 180, 16);
|
||||
chkBox->setGeometry(m_cenPanel->size().width/2 - 43, 254, 180, 18);
|
||||
setSelectorStyle(chkBox);
|
||||
chkBox->onClick([chkBox, this]() {
|
||||
m_is_checked = chkBox->isChecked();
|
||||
@ -364,7 +364,7 @@ void MainWindow::finishInstall(const std::wstring &app_path)
|
||||
});
|
||||
|
||||
m_resize_conn = m_cenPanel->onResize([chkBox, comntLbl, closeBtn](int w, int h) {
|
||||
chkBox->setGeometry(w/2 - 43, 254, 180, 16);
|
||||
chkBox->setGeometry(w/2 - 43, 254, 180, 18);
|
||||
comntLbl->setGeometry(0, h - 130, w, 48);
|
||||
closeBtn->setGeometry(w/2 - 50, h - 76, 100, 28);
|
||||
});
|
||||
|
||||
@ -15,7 +15,7 @@ static bool isArrangingAllowed() {
|
||||
Button::Button(Widget *parent, const std::wstring &text) :
|
||||
AbstractButton(parent, text),
|
||||
m_hIcon(nullptr),
|
||||
m_hMetaFile(nullptr),
|
||||
m_hEmfBmp(nullptr),
|
||||
m_stockIcon(StockIcon::None),
|
||||
supportSnapLayouts(false),
|
||||
snapLayoutAllowed(false),
|
||||
@ -30,10 +30,8 @@ Button::~Button()
|
||||
DestroyIcon(m_hIcon);
|
||||
m_hIcon = nullptr;
|
||||
}
|
||||
if (m_hMetaFile) {
|
||||
//delete m_hMetaFile;
|
||||
DeleteEnhMetaFile(m_hMetaFile);
|
||||
m_hMetaFile = nullptr;
|
||||
if (m_hEmfBmp) {
|
||||
delete m_hEmfBmp, m_hEmfBmp = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,24 +62,19 @@ void Button::setIcon(int id, int w, int h)
|
||||
|
||||
void Button::setEMFIcon(const std::wstring &path, int w, int h)
|
||||
{
|
||||
if (m_hMetaFile) {
|
||||
//delete m_hMetaFile;
|
||||
DeleteEnhMetaFile(m_hMetaFile);
|
||||
m_hMetaFile = nullptr;
|
||||
if (m_hEmfBmp) {
|
||||
delete m_hEmfBmp, m_hEmfBmp = nullptr;
|
||||
}
|
||||
metrics()->setMetrics(Metrics::IconWidth, w);
|
||||
metrics()->setMetrics(Metrics::IconHeight, h);
|
||||
m_hMetaFile = GetEnhMetaFile(path.c_str());
|
||||
//m_hMetaFile = new Metafile(path.c_str());
|
||||
m_hEmfBmp = new Gdiplus::Bitmap(path.c_str());
|
||||
update();
|
||||
}
|
||||
|
||||
void Button::setEMFIcon(int id, int w, int h)
|
||||
{
|
||||
if (m_hMetaFile) {
|
||||
//delete m_hMetaFile;
|
||||
DeleteEnhMetaFile(m_hMetaFile);
|
||||
m_hMetaFile = nullptr;
|
||||
if (m_hEmfBmp) {
|
||||
delete m_hEmfBmp, m_hEmfBmp = nullptr;
|
||||
}
|
||||
metrics()->setMetrics(Metrics::IconWidth, w);
|
||||
metrics()->setMetrics(Metrics::IconHeight, h);
|
||||
@ -90,8 +83,21 @@ void Button::setEMFIcon(int id, int w, int h)
|
||||
if (HGLOBAL hResData = LoadResource(hInst, hRes)) {
|
||||
if (LPVOID pData = LockResource(hResData)) {
|
||||
DWORD dataSize = SizeofResource(hInst, hRes);
|
||||
if (dataSize > 0)
|
||||
m_hMetaFile = SetEnhMetaFileBits(dataSize, (BYTE*)pData);
|
||||
if (dataSize > 0) {
|
||||
if (HGLOBAL hGlobal = GlobalAlloc(GHND, dataSize)) {
|
||||
if (LPVOID pBuffer = GlobalLock(hGlobal)) {
|
||||
memcpy(pBuffer, pData, dataSize);
|
||||
IStream *pStream = nullptr;
|
||||
HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pStream);
|
||||
if (SUCCEEDED(hr)) {
|
||||
m_hEmfBmp = new Gdiplus::Bitmap(pStream);
|
||||
pStream->Release();
|
||||
}
|
||||
GlobalUnlock(hGlobal);
|
||||
}
|
||||
GlobalFree(hGlobal);
|
||||
}
|
||||
}
|
||||
}
|
||||
FreeResource(hResData);
|
||||
}
|
||||
@ -134,8 +140,8 @@ bool Button::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result)
|
||||
engine()->DrawBorder();
|
||||
if (m_hIcon)
|
||||
engine()->DrawIcon(m_hIcon);
|
||||
if (m_hMetaFile)
|
||||
engine()->DrawEmfIcon(m_hMetaFile);
|
||||
if (m_hEmfBmp)
|
||||
engine()->DrawEmfIcon(m_hEmfBmp);
|
||||
if (!m_text.empty())
|
||||
engine()->DrawText(rc, m_text);
|
||||
|
||||
|
||||
@ -34,8 +34,7 @@ protected:
|
||||
|
||||
private:
|
||||
HICON m_hIcon;
|
||||
HENHMETAFILE m_hMetaFile;
|
||||
//Gdiplus::Metafile *m_hMetaFile;
|
||||
Gdiplus::Bitmap *m_hEmfBmp;
|
||||
int m_stockIcon;
|
||||
bool supportSnapLayouts,
|
||||
snapLayoutAllowed;
|
||||
|
||||
@ -146,25 +146,17 @@ void DrawingEngine::DrawIcon(HICON hIcon) const
|
||||
DrawIconEx(m_hdc, x, y, hIcon, m_ds->metrics()->value(Metrics::IconWidth), m_ds->metrics()->value(Metrics::IconHeight), 0, NULL, DI_NORMAL);
|
||||
}
|
||||
|
||||
void DrawingEngine::DrawEmfIcon(HENHMETAFILE hIcon) const
|
||||
void DrawingEngine::DrawEmfIcon(Gdiplus::Bitmap *hEmfBmp) const
|
||||
{
|
||||
int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2;
|
||||
int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2;
|
||||
RECT _rc{x, y, x + m_ds->metrics()->value(Metrics::IconWidth), y + m_ds->metrics()->value(Metrics::IconHeight)};
|
||||
SetGraphicsMode(m_hdc, GM_ADVANCED);
|
||||
SetPolyFillMode(m_hdc, WINDING);
|
||||
SetStretchBltMode(m_hdc, HALFTONE);
|
||||
SetBrushOrgEx(m_hdc, 0, 0, nullptr);
|
||||
PlayEnhMetaFile(m_hdc, hIcon, &_rc);
|
||||
// Gdiplus::Graphics gr(m_hdc);
|
||||
// gr.SetInterpolationMode(Gdiplus::InterpolationModeBilinear);
|
||||
int w = m_ds->metrics()->value(Metrics::IconWidth);
|
||||
int h = m_ds->metrics()->value(Metrics::IconHeight);
|
||||
int x = m_rc->left + (m_rc->right - m_rc->left - w) / 2;
|
||||
int y = m_rc->top + (m_rc->bottom - m_rc->top - h) / 2;
|
||||
Gdiplus::Graphics gr(m_hdc);
|
||||
// gr.SetInterpolationMode(Gdiplus::InterpolationModeHighQualityBicubic);
|
||||
// gr.SetPixelOffsetMode(Gdiplus::PixelOffsetModeHighQuality);
|
||||
// gr.SetSmoothingMode(Gdiplus::SmoothingMode::SmoothingModeAntiAlias);
|
||||
// int x = m_rc->left + (m_rc->right - m_rc->left - m_ds->metrics()->value(Metrics::IconWidth)) / 2;
|
||||
// int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2;
|
||||
// Gdiplus::Metafile mf(hIcon);
|
||||
// mf.ConvertToEmfPlus(&gr, NULL , Gdiplus::EmfTypeEmfPlusOnly, NULL);
|
||||
// gr.DrawImage(&mf, x, y, m_ds->metrics()->value(Metrics::IconWidth), m_ds->metrics()->value(Metrics::IconHeight));
|
||||
// gr.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
|
||||
gr.DrawImage(hEmfBmp, x, y, w, h);
|
||||
}
|
||||
|
||||
void DrawingEngine::DrawImage(Gdiplus::Bitmap *hBmp) const
|
||||
@ -249,7 +241,7 @@ void DrawingEngine::DrawStockRestoreIcon()
|
||||
|
||||
void DrawingEngine::DrawCheckBox(const std::wstring &text, bool checked)
|
||||
{
|
||||
int x = m_rc->left;
|
||||
int x = m_rc->left + 1;
|
||||
int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2;
|
||||
|
||||
m_memDC = CreateCompatibleDC(m_hdc);
|
||||
@ -313,7 +305,7 @@ void DrawingEngine::DrawCheckBox(const std::wstring &text, bool checked)
|
||||
|
||||
void DrawingEngine::DrawRadioButton(const std::wstring &text, bool checked)
|
||||
{
|
||||
int x = m_rc->left;
|
||||
int x = m_rc->left + 1;
|
||||
int y = m_rc->top + (m_rc->bottom - m_rc->top - m_ds->metrics()->value(Metrics::IconHeight)) / 2;
|
||||
|
||||
m_memDC = CreateCompatibleDC(m_hdc);
|
||||
|
||||
@ -22,7 +22,7 @@ public:
|
||||
void DrawBorder() const;
|
||||
void DrawTopBorder(int, COLORREF) const;
|
||||
void DrawIcon(HICON hIcon) const;
|
||||
void DrawEmfIcon(HENHMETAFILE hIconc) const;
|
||||
void DrawEmfIcon(Gdiplus::Bitmap *hEmfBmp) const;
|
||||
void DrawImage(Gdiplus::Bitmap *hBmp) const;
|
||||
void DrawStockCloseIcon();
|
||||
void DrawStockMinimizeIcon();
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
Label::Label(Widget *parent) :
|
||||
Widget(parent, ObjectType::WidgetType),
|
||||
m_hIcon(nullptr),
|
||||
m_hMetaFile(nullptr),
|
||||
m_hEmfBmp(nullptr),
|
||||
m_hBmp(nullptr),
|
||||
m_multiline(false)
|
||||
{
|
||||
@ -19,10 +19,8 @@ Label::~Label()
|
||||
DestroyIcon(m_hIcon);
|
||||
m_hIcon = nullptr;
|
||||
}
|
||||
if (m_hMetaFile) {
|
||||
//delete m_hMetaFile;
|
||||
DeleteEnhMetaFile(m_hMetaFile);
|
||||
m_hMetaFile = nullptr;
|
||||
if (m_hEmfBmp) {
|
||||
delete m_hEmfBmp, m_hEmfBmp = nullptr;
|
||||
}
|
||||
if (m_hBmp) {
|
||||
delete m_hBmp, m_hBmp = nullptr;
|
||||
@ -63,24 +61,19 @@ void Label::setIcon(int id, int w, int h)
|
||||
|
||||
void Label::setEMFIcon(const std::wstring &path, int w, int h)
|
||||
{
|
||||
if (m_hMetaFile) {
|
||||
//delete m_hMetaFile;
|
||||
DeleteEnhMetaFile(m_hMetaFile);
|
||||
m_hMetaFile = nullptr;
|
||||
if (m_hEmfBmp) {
|
||||
delete m_hEmfBmp, m_hEmfBmp = nullptr;
|
||||
}
|
||||
metrics()->setMetrics(Metrics::IconWidth, w);
|
||||
metrics()->setMetrics(Metrics::IconHeight, h);
|
||||
m_hMetaFile = GetEnhMetaFile(path.c_str());
|
||||
//m_hMetaFile = new Metafile(path.c_str());
|
||||
m_hEmfBmp = new Gdiplus::Bitmap(path.c_str());
|
||||
update();
|
||||
}
|
||||
|
||||
void Label::setEMFIcon(int id, int w, int h)
|
||||
{
|
||||
if (m_hMetaFile) {
|
||||
//delete m_hMetaFile;
|
||||
DeleteEnhMetaFile(m_hMetaFile);
|
||||
m_hMetaFile = nullptr;
|
||||
if (m_hEmfBmp) {
|
||||
delete m_hEmfBmp, m_hEmfBmp = nullptr;
|
||||
}
|
||||
metrics()->setMetrics(Metrics::IconWidth, w);
|
||||
metrics()->setMetrics(Metrics::IconHeight, h);
|
||||
@ -89,8 +82,21 @@ void Label::setEMFIcon(int id, int w, int h)
|
||||
if (HGLOBAL hResData = LoadResource(hInst, hRes)) {
|
||||
if (LPVOID pData = LockResource(hResData)) {
|
||||
DWORD dataSize = SizeofResource(hInst, hRes);
|
||||
if (dataSize > 0)
|
||||
m_hMetaFile = SetEnhMetaFileBits(dataSize, (BYTE*)pData);
|
||||
if (dataSize > 0) {
|
||||
if (HGLOBAL hGlobal = GlobalAlloc(GHND, dataSize)) {
|
||||
if (LPVOID pBuffer = GlobalLock(hGlobal)) {
|
||||
memcpy(pBuffer, pData, dataSize);
|
||||
IStream *pStream = nullptr;
|
||||
HRESULT hr = CreateStreamOnHGlobal(hGlobal, TRUE, &pStream);
|
||||
if (SUCCEEDED(hr)) {
|
||||
m_hEmfBmp = new Gdiplus::Bitmap(pStream);
|
||||
pStream->Release();
|
||||
}
|
||||
GlobalUnlock(hGlobal);
|
||||
}
|
||||
GlobalFree(hGlobal);
|
||||
}
|
||||
}
|
||||
}
|
||||
FreeResource(hResData);
|
||||
}
|
||||
@ -155,8 +161,8 @@ bool Label::event(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *result)
|
||||
engine()->DrawImage(m_hBmp);
|
||||
if (m_hIcon)
|
||||
engine()->DrawIcon(m_hIcon);
|
||||
if (m_hMetaFile)
|
||||
engine()->DrawEmfIcon(m_hMetaFile);
|
||||
if (m_hEmfBmp)
|
||||
engine()->DrawEmfIcon(m_hEmfBmp);
|
||||
if (!m_text.empty())
|
||||
engine()->DrawText(rc, m_text, m_multiline);
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ protected:
|
||||
private:
|
||||
std::wstring m_text;
|
||||
HICON m_hIcon;
|
||||
HENHMETAFILE m_hMetaFile;
|
||||
Gdiplus::Bitmap *m_hEmfBmp;
|
||||
Gdiplus::Bitmap *m_hBmp;
|
||||
bool m_multiline;
|
||||
};
|
||||
|
||||
@ -30,11 +30,11 @@ void ProgressBar::pulse(bool enable)
|
||||
m_pulse_pos = enable ? 0 : -1;
|
||||
m_pulse_direction = 1;
|
||||
if (enable) {
|
||||
timeBeginPeriod(1);
|
||||
// timeBeginPeriod(1);
|
||||
SetTimer(m_hWnd, PROGRESS_PULSE_TIMER_ID, 17, NULL);
|
||||
} else {
|
||||
KillTimer(m_hWnd, PROGRESS_PULSE_TIMER_ID);
|
||||
timeEndPeriod(1);
|
||||
// timeEndPeriod(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user