Skip to content

Commit 94742a4

Browse files
authored
Merge pull request #1 from CM0use/2.0.0
GenPassword v.2.0.0
2 parents c06e188 + a46346a commit 94742a4

File tree

86 files changed

+1867
-2703
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1867
-2703
lines changed

installer/config/appIcon.png

-8.22 KB
Binary file not shown.

installer/config/config.xml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Installer>
33
<Name>GenPassword</Name>
4-
<Version>1.0.0</Version>
4+
<Version>2.0.0</Version>
55
<Title>GenPassword Installer</Title>
66
<Publisher>CM0use</Publisher>
77
<ProductUrl>https://github.com/CM0use/GenPassword</ProductUrl>
8-
<InstallerWindowIcon>appIcon.png</InstallerWindowIcon>
98
<StartMenuDir>GenPassword</StartMenuDir>
109
<TargetDir>@HomeDir@/GenPassword</TargetDir>
11-
<ProductImages>
12-
<ProductImage>
13-
<Image>appIcon.png</Image>
14-
<Url>https://github.com/CM0use/GenPassword</Url>
15-
</ProductImage>
16-
</ProductImages>
1710
</Installer>

installer/packages/com.CM0use.GenPassword/meta/installscript.qs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,5 @@
1-
/**
2-
** This file is part of the GenPassword project.
3-
** Copyright 2023 CM0use dilanuzcs@gmail.com
4-
** URL: https://github.com/CM0use/GenPassword
5-
**
6-
** This program is free software: you can redistribute it and/or modify
7-
** it under the terms of the GNU General Public License as published by
8-
** the Free Software Foundation, either version 3 of the License, or
9-
** (at your option) any later version.
10-
**
11-
** This program is distributed in the hope that it will be useful,
12-
** but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
** GNU General Public License for more details.
15-
**
16-
** You should have received a copy of the GNU General Public License
17-
** along with this program. If not, see <http://www.gnu.org/licenses/>.
18-
**/
1+
// GenPassword
2+
// Copyright (c) 2023 CM0use
193

204
function Component()
215
{
@@ -44,8 +28,8 @@ Component.prototype.createOperations = function()
4428
"iconPath=@TargetDir@/GenPassword.exe");
4529
} else if (installer.value("os") === "x11") {
4630
component.addOperation("InstallIcons", "@TargetDir@/icons");
47-
var app_desktop = "Version=1.0.0\nName=GenPassword\nComment=A random and customizable password generator\nComment[zh_CN]=随机和可定制的密码生成器\nComment[hi]=एक यादृच्छिक और अनुकूलन योग्य पासवर्ड जनरेटर\nComment[es]=Un generador de contraseñas aleatorio y personalizable\nComment[pt_BR]=Um gerador de senhas aleatórias e personalizáveis\nExec=@TargetDir@/GenPassword\nTerminal=false\nType=Application\nIcon=GenPasswordIcon\nCategories=Utility;Security",
48-
uninstall_desktop = "Version=1.0.0\nName=Uninstall\nExec=@TargetDir@/maintenancetool\nTerminal=false\nKeyword=GenPassword\nType=Application\nIcon=GenPasswordIcon\nCategories=Utility;Security";
31+
var app_desktop = "Version=2.0.0\nName=GenPassword\nComment=A random and customizable password generator\nComment[es]=Un generador de contraseñas aleatorio y personalizable\nExec=@TargetDir@/GenPassword\nTerminal=false\nType=Application\nIcon=GenPasswordIcon\nCategories=Utility;Security",
32+
uninstall_desktop = "Version=2.0.0\nName=Uninstall\nExec=@TargetDir@/maintenancetool\nTerminal=false\nKeyword=GenPassword\nType=Application\nIcon=GenPasswordIcon\nCategories=Utility;Security";
4933

5034
component.addOperation("CreateDesktopEntry",
5135
"GenPassword.desktop",

installer/packages/com.CM0use.GenPassword/meta/package.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Package>
33
<DisplayName>GenPassword</DisplayName>
4-
<ReleaseDate>2023-09-16</ReleaseDate>
5-
<Version>1.0.0</Version>
4+
<ReleaseDate>2023-11-10</ReleaseDate>
5+
<Version>2.0.0</Version>
66
<Default>true</Default>
77
<Description>A random and customizable password generator.</Description>
88
<Licenses>

src/GenPassword.pro

Lines changed: 17 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,34 @@
1-
#
2-
# ** This file is part of the GenPassword project.
3-
# ** Copyright 2023 CM0use dilanuzcs@gmail.com
4-
# ** URL: https://github.com/CM0use/GenPassword
5-
# **
6-
# ** This program is free software: you can redistribute it and/or modify
7-
# ** it under the terms of the GNU General Public License as published by
8-
# ** the Free Software Foundation, either version 3 of the License, or
9-
# ** (at your option) any later version.
10-
# **
11-
# ** This program is distributed in the hope that it will be useful,
12-
# ** but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
# ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
# ** GNU General Public License for more details.
15-
# **
16-
# ** You should have received a copy of the GNU General Public License
17-
# ** along with this program. If not, see <http://www.gnu.org/licenses/>.
18-
#
19-
201
QT += core gui
212

223
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
234

24-
CONFIG += c++20
25-
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
5+
CONFIG += c++17
6+
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
7+
VERSION = 2.0.0
8+
QMAKE_TARGET_PRODUCT = GenPassword
9+
QMAKE_TARGET_DESCRIPTION = "A free generator password"
10+
QMAKE_TARGET_COPYRIGHT = CM0use
11+
12+
win32: RC_ICONS = icons/appIcon.ico
2613

2714
SOURCES += \
15+
framelesswindow.cpp \
2816
main.cpp \
29-
passwordgeneratorapp.cpp
17+
passwordgenerator.cpp \
18+
switchbutton.cpp \
19+
window.cpp
3020

3121
HEADERS += \
32-
passwordgeneratorapp.h
22+
framelesswindow.h \
23+
icons.h \
24+
passwordgenerator.h \
25+
switchbutton.h \
26+
window.h
3327

34-
# Default rules for deployment.
3528
qnx: target.path = /tmp/$${TARGET}/bin
3629
else: unix:!android: target.path = /opt/$${TARGET}/bin
3730
!isEmpty(target.path): INSTALLS += target
3831

39-
win32: RC_ICONS = icon/appIcon.ico
40-
macx: ICON = icon/appIcon.icns
41-
4232
RESOURCES += \
4333
i18n.qrc \
4434
icons.qrc \

src/framelesswindow.cpp

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
// GenPassword
2+
// Copyright (c) 2023 CM0use
3+
4+
#include "framelesswindow.h"
5+
6+
#include <QStyle>
7+
#include <QHoverEvent>
8+
#include <QWindow>
9+
10+
FramelessWindow::FramelessWindow(QWidget *const parent)
11+
: QMainWindow{ parent, Qt::FramelessWindowHint },
12+
m_titleBar{ nullptr }
13+
{ }
14+
15+
bool FramelessWindow::event(QEvent *const event)
16+
{
17+
if (windowFlags() & Qt::FramelessWindowHint) {
18+
static Qt::Edges edges{ Qt::Edges() };
19+
const int margin{ style()->pixelMetric(QStyle::PM_LayoutTopMargin) };
20+
switch (event->type()) {
21+
case QEvent::MouseButtonPress:
22+
updateCursor(edges);
23+
if ((m_titleBar != nullptr) && m_titleBar->underMouse())
24+
windowHandle()->startSystemMove();
25+
else if (edges)
26+
windowHandle()->startSystemResize(edges);
27+
break;
28+
case QEvent::MouseButtonRelease:
29+
edges = Qt::Edges();
30+
updateCursor(edges);
31+
setFocus();
32+
break;
33+
case QEvent::HoverMove: {
34+
edges = Qt::Edges();
35+
QPoint p{ static_cast<QHoverEvent *>(event)->position().toPoint() };
36+
37+
if (p.x() < margin)
38+
edges |= Qt::LeftEdge;
39+
if (p.x() > (width() - margin))
40+
edges |= Qt::RightEdge;
41+
if (p.y() < margin)
42+
edges |= Qt::TopEdge;
43+
if (p.y() > (height() - margin))
44+
edges |= Qt::BottomEdge;
45+
updateCursor(edges);
46+
break;
47+
}
48+
default:
49+
break;
50+
}
51+
}
52+
return QMainWindow::event(event);
53+
}
54+
55+
void FramelessWindow::setTitleBar(QWidget *const widget)
56+
{
57+
m_titleBar = widget;
58+
}
59+
60+
QWidget* FramelessWindow::getTitleBar() const
61+
{
62+
return m_titleBar;
63+
}
64+
65+
void FramelessWindow::updateCursor(const Qt::Edges &edges)
66+
{
67+
switch (edges) {
68+
case 0:
69+
setCursor(Qt::ArrowCursor);
70+
break;
71+
case Qt::LeftEdge:
72+
case Qt::RightEdge:
73+
setCursor(Qt::SizeHorCursor);
74+
break;
75+
case Qt::TopEdge:
76+
case Qt::BottomEdge:
77+
setCursor(Qt::SizeVerCursor);
78+
break;
79+
case Qt::LeftEdge | Qt::TopEdge:
80+
case Qt::RightEdge | Qt::BottomEdge:
81+
setCursor(Qt::SizeFDiagCursor);
82+
break;
83+
case Qt::RightEdge | Qt::TopEdge:
84+
case Qt::LeftEdge | Qt::BottomEdge:
85+
setCursor(Qt::SizeBDiagCursor);
86+
break;
87+
}
88+
}

src/framelesswindow.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// GenPassword
2+
// Copyright (c) 2023 CM0use
3+
4+
#ifndef FRAMELESSWINDOW_H
5+
#define FRAMELESSWINDOW_H
6+
7+
#include <QMainWindow>
8+
9+
class FramelessWindow: public QMainWindow
10+
{
11+
public:
12+
explicit FramelessWindow(QWidget *const parent = nullptr);
13+
virtual ~FramelessWindow() = default;
14+
15+
protected:
16+
virtual bool event(QEvent *const event) override;
17+
18+
void setTitleBar(QWidget *const widget);
19+
QWidget* getTitleBar() const;
20+
21+
private:
22+
void updateCursor(const Qt::Edges &edges);
23+
QWidget *m_titleBar;
24+
};
25+
26+
#endif

src/i18n.qrc

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
<RCC>
2-
<qresource prefix="/i18n">
3-
<file>languages/en.qm</file>
4-
<file>languages/es.qm</file>
5-
<file>languages/hi.qm</file>
6-
<file>languages/pt-BR.qm</file>
7-
<file>languages/zh-CN.qm</file>
2+
<qresource prefix="/">
3+
<file>i18n/es.qm</file>
84
</qresource>
95
</RCC>

src/i18n/es.qm

9.54 KB
Binary file not shown.

0 commit comments

Comments
 (0)