Skip to content

Commit

Permalink
fix: support for mingw and msvg build programming
Browse files Browse the repository at this point in the history
and chore: clean code, and add comment information
  • Loading branch information
XMuli committed Jan 24, 2024
1 parent 430a894 commit bd79a5a
Show file tree
Hide file tree
Showing 19 changed files with 132 additions and 19 deletions.
7 changes: 5 additions & 2 deletions GuiHelper/guiapplicationhelper.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#include "guiapplicationhelper.h"
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "guiapplicationhelper.h"
#include <QColor>

GuiApplicationHelper::GuiApplicationHelper()
{

}

inline static int adjustColorValue(int base, qint8 increment, int max = 255)
Expand Down
5 changes: 5 additions & 0 deletions GuiHelper/guiapplicationhelper.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef GUIAPPLICATIONHELPER_H
#define GUIAPPLICATIONHELPER_H

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 偕臧
Copyright (c) 2020~2024 XMuli <xmulitech@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 5 additions & 12 deletions ShotX.pro
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
QT += core gui
# SPDX-License-Identifier: MIT
# SPDX-FileCopyrightText: 2020-2024 XMuli
# SPDX-GitHub: https://github.com/XMuli/shotx
# SPDX-Author: XMuli <xmulitech@gmail.com>

QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++11

# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0

SOURCES += \
GuiHelper/guiapplicationhelper.cpp \
main.cpp \
Expand Down
6 changes: 5 additions & 1 deletion about.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "about.h"
#include "ui_about.h"

#include <QIcon>

About::About(QWidget *parent) :
Expand Down
5 changes: 5 additions & 0 deletions about.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef ABOUT_H
#define ABOUT_H

Expand Down
48 changes: 48 additions & 0 deletions convert_to_utf8_bom.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import os
import subprocess

try:
import chardet
except ImportError:
print('chardet is not installed. Installing...')
subprocess.run(['pip', 'install', 'chardet'])
import chardet

# 获取当前路径
current_dir = os.getcwd()

# 遍历当前目录及子目录下的所有 .h .cpp 文件
file_list = []
for root, dirs, files in os.walk(current_dir):
for filename in files:
if filename.endswith('.h') or filename.endswith('.cpp'):
filepath = os.path.join(root, filename)
file_list.append(filepath)

# 打印文件信息
print(f'{"序号":<5} {"文件名":<50} {"原来格式":<20} {"转换后格式":<20} {"是否转换成功":<15}')
success_count = 0
for i, filepath in enumerate(file_list, 1):
with open(filepath, 'rb') as f:
# 检测原来的编码格式
before_encoding = chardet.detect(f.read())['encoding']
if before_encoding is None:
before_encoding = 'unknown'
# 转换编码格式为 UTF-8 BOM
try:
with open(filepath, 'r', encoding=before_encoding) as f:
content = f.read()
with open(filepath, 'w', encoding='utf-8-sig') as f:
f.write(content)
success = True
success_count += 1
except:
success = False
# 检测转换后的编码格式
with open(filepath, 'rb') as f:
after_encoding = chardet.detect(f.read())['encoding']
if after_encoding is None:
after_encoding = 'unknown'
# 打印文件信息
print(f'{i:<5} {filepath:<50} {before_encoding:<20} {after_encoding:<20} {"Yes" if success else "No":<15}')
print(f'Total: {len(file_list)}, success: {success_count}, failed: {len(file_list)-success_count}')
6 changes: 3 additions & 3 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
shotx (1.0-1) unstable; urgency=medium
shotx (2.0-1) unstable; urgency=medium

* Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
* Cleaning Code, and Ensure build success

-- unknown <ifmet@ifmet-PC> Sat, 20 Feb 2021 15:41:21 +0800
-- unknown <ifmet@ifmet-PC> Wen, 24 Jan 2024 23:45:21 +0800
5 changes: 5 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "mainwindow.h"
#include "screenshots.h"
#include "trayiconwindow.h"
Expand Down
5 changes: 5 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
Expand Down
5 changes: 5 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

Expand Down
5 changes: 5 additions & 0 deletions screenshots.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "screenshots.h"

#include <QDesktopWidget>
Expand Down
5 changes: 5 additions & 0 deletions screenshots.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef SCREENSHOTS_H
#define SCREENSHOTS_H

Expand Down
5 changes: 5 additions & 0 deletions systeminfo.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "systeminfo.h"

#include <QScreen>
Expand Down
5 changes: 5 additions & 0 deletions systeminfo.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef SYSTEMINFO_H
#define SYSTEMINFO_H

Expand Down
5 changes: 5 additions & 0 deletions toolboxwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "screenshots.h"
#include "toolboxwindow.h"

Expand Down
5 changes: 5 additions & 0 deletions toolboxwindow.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef TOOLBOXWINDOW_H
#define TOOLBOXWINDOW_H

Expand Down
5 changes: 5 additions & 0 deletions trayiconwindow.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#include "trayiconwindow.h"

#include <QMenu>
Expand Down
5 changes: 5 additions & 0 deletions trayiconwindow.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2020-2024 XMuli
// SPDX-GitHub: https://github.com/XMuli/shotx
// SPDX-Author: XMuli <xmulitech@gmail.com>

#ifndef TRAYICONWINDOW_H
#define TRAYICONWINDOW_H

Expand Down

0 comments on commit bd79a5a

Please sign in to comment.