Skip to content

Commit 0553eba

Browse files
Merge pull request #630 from IENT/feature/RGB565
Add support for RGB565
2 parents 82b95e0 + ccac682 commit 0553eba

65 files changed

Lines changed: 3546 additions & 1576 deletions

File tree

Some content is hidden

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

.clang-format

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ IndentWidth: 2
22
ContinuationIndentWidth: 2
33
---
44
Language: Cpp
5-
Standard: c++17
5+
Standard: c++20
66
ColumnLimit: 100
77
AlignAfterOpenBracket: Align
88
BreakBeforeBraces: Allman

.github/workflows/Build.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
matrix:
1414
os: [ubuntu-22.04, ubuntu-24.04, ubuntu-22.04-arm, ubuntu-24.04-arm]
1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v6
1717
with:
1818
submodules: true
1919
- run: git fetch --prune --unshallow
@@ -30,13 +30,15 @@ jobs:
3030
make -j$(nproc)
3131
- name: Run Unittests
3232
run: $GITHUB_WORKSPACE/build/YUViewUnitTest/YUViewUnitTest
33+
env:
34+
QT_QPA_PLATFORM: 'offscreen'
3335
build-mac-native:
3436
runs-on: ${{ matrix.os }}
3537
strategy:
3638
matrix:
3739
os: [macos-15, macos-15-intel]
3840
steps:
39-
- uses: actions/checkout@v4
41+
- uses: actions/checkout@v6
4042
with:
4143
submodules: true
4244
- run: git fetch --prune --unshallow
@@ -51,13 +53,15 @@ jobs:
5153
make -j $(sysctl -n hw.logicalcpu)
5254
- name: Run Unittests
5355
run: $GITHUB_WORKSPACE/build/YUViewUnitTest/YUViewUnitTest
56+
env:
57+
QT_QPA_PLATFORM: 'offscreen'
5458
build-linux-mac:
5559
runs-on: ${{ matrix.os }}
5660
strategy:
5761
matrix:
5862
os: [ubuntu-22.04, macos-15]
5963
steps:
60-
- uses: actions/checkout@v4
64+
- uses: actions/checkout@v6
6165
with:
6266
submodules: true
6367
- run: git fetch --prune --unshallow
@@ -105,6 +109,8 @@ jobs:
105109
make -j 4
106110
- name: Run Unittests
107111
run: $GITHUB_WORKSPACE/build/YUViewUnitTest/YUViewUnitTest
112+
env:
113+
QT_QPA_PLATFORM: 'offscreen'
108114
- name: Build App (Mac)
109115
if: runner.os == 'macOS'
110116
run: |
@@ -125,7 +131,7 @@ jobs:
125131
mkdir $GITHUB_WORKSPACE/artifacts
126132
cp YUView.AppImage $GITHUB_WORKSPACE/artifacts/
127133
- name: Upload Artifact
128-
uses: actions/upload-artifact@v4
134+
uses: actions/upload-artifact@v7
129135
with:
130136
name: ${{steps.artifacts.outputs.outputZip}}
131137
path: artifacts
@@ -140,7 +146,7 @@ jobs:
140146
matrix:
141147
autoUpdate: [true, false]
142148
steps:
143-
- uses: actions/checkout@v4
149+
- uses: actions/checkout@v6
144150
with:
145151
submodules: true
146152
- uses: ilammy/msvc-dev-cmd@v1
@@ -153,6 +159,8 @@ jobs:
153159
curl -L https://github.com/ChristianFeldmann/YUViewQt/releases/download/QtBase-6.9.0/qtBase-6-9-0-windows-2022.zip -o Qt.zip
154160
7z x Qt.zip
155161
echo "${{ github.workspace }}\..\..\YUViewQt\YUViewQt\Qt\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
162+
- name: Test qmake
163+
run : qmake --version
156164
- name: Install libde265
157165
run: |
158166
curl -L https://github.com/ChristianFeldmann/libde265/releases/download/v1.1/libde265.dll -o libde265.dll
@@ -176,20 +184,20 @@ jobs:
176184
echo "Creating Build dir and entering it"
177185
mkdir build
178186
cd build
179-
echo "Qmake Version:"
180-
d:\a\YUViewQt\YUViewQt\Qt\bin\qmake --version
181187
echo "Executing qmake..."
182-
d:\a\YUViewQt\YUViewQt\Qt\bin\qmake CONFIG+=UNITTESTS ..
188+
qmake CONFIG+=UNITTESTS ..
183189
echo "Executing jom:"
184190
jom
185191
- name: Run Unittests
186-
run: D:\a\YUView\YUView\build\YUViewUnitTest\YUViewUnitTest
192+
run: ${{ github.workspace }}\build\YUViewUnitTest\YUViewUnitTest
193+
env:
194+
QT_QPA_PLATFORM: 'offscreen'
187195
- name: WindeployQT
188196
run: |
189197
mkdir deploy
190198
cd deploy
191199
cp ../build/YUViewApp/YUView.exe .
192-
d:\a\YUViewQt\YUViewQt\Qt\bin\windeployqt.exe --release --no-compiler-runtime YUView.exe
200+
windeployqt --release --no-compiler-runtime YUView.exe
193201
cp ../openSSL/*.dll .
194202
mkdir decoder
195203
cp ..\libde265.dll decoder
@@ -212,19 +220,19 @@ jobs:
212220
cp deployment/wix/bin/Release/YUViewSetup.msi ./
213221
- name: Upload Artifact (Autoupdate)
214222
if: matrix.autoUpdate == true
215-
uses: actions/upload-artifact@v4
223+
uses: actions/upload-artifact@v7
216224
with:
217225
name: YUView-windows-2022-autoupdate.zip
218226
path: artifacts
219227
- name: Upload Artifact (Autoupdate disabled)
220228
if: matrix.autoUpdate == false
221-
uses: actions/upload-artifact@v4
229+
uses: actions/upload-artifact@v7
222230
with:
223231
name: YUView-windows-2022.zip
224232
path: artifacts
225233
- name: Upload Windows installer Artifact
226234
if: matrix.autoUpdate == true
227-
uses: actions/upload-artifact@v4
235+
uses: actions/upload-artifact@v7
228236
with:
229237
name: YYUView-windows-2022.msi
230238
path: ./YUViewSetup.msi

.github/workflows/flatpak.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
2626
options: --privileged
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v6
2929
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
3030
with:
3131
bundle: "YUView.flatpak"

HACKING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Compiler Requirements
22

33
MSVC: Visual Studio 2013 Update 5 or newer.
4-
gcc/llvm: C++17 support is required.
4+
gcc/llvm: C++20 support is required.
55

66
# Coding Conventions
77

YUViewApp/YUViewApp.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ QT += core gui widgets opengl xml concurrent network
22

33
TARGET = YUView
44
TEMPLATE = app
5-
CONFIG += c++17
5+
CONFIG += c++20
66
CONFIG -= debug_and_release
77

88
SOURCES += $$files(src/*.cpp, false)

YUViewLib/YUViewLib.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ QT += core gui widgets opengl xml concurrent network
22

33
TEMPLATE = lib
44
CONFIG += staticlib
5-
CONFIG += c++17
5+
CONFIG += c++20
66
CONFIG -= debug_and_release
77
CONFIG += object_parallel_to_source
88

YUViewLib/src/common/Functions.cpp

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,32 @@ std::string toLower(const std::string_view str)
198198
return lowercaseStr;
199199
}
200200

201+
std::vector<std::string_view> splitString(const std::string_view str, const char delimiter)
202+
{
203+
std::vector<std::string_view> result;
204+
size_t start = 0;
205+
size_t end = str.find(delimiter);
206+
while (end != std::string_view::npos)
207+
{
208+
result.emplace_back(str.substr(start, end - start));
209+
start = end + 1;
210+
end = str.find(delimiter, start);
211+
}
212+
if (start != str.size())
213+
result.emplace_back(str.substr(start));
214+
return result;
215+
}
216+
217+
std::string_view stripWhitespace(std::string_view str)
218+
{
219+
str.remove_prefix(std::min(str.find_first_not_of(" "), str.size()));
220+
221+
const auto lastNonWhitespace = str.find_last_not_of(" ");
222+
if (lastNonWhitespace != std::string_view::npos)
223+
str.remove_suffix(str.size() - lastNonWhitespace - 1);
224+
return str;
225+
}
226+
201227
ByteVector readData(std::istream &istream, const size_t nrBytes)
202228
{
203229
ByteVector data;
@@ -211,11 +237,12 @@ ByteVector readData(std::istream &istream, const size_t nrBytes)
211237
std::optional<unsigned> toUnsigned(const std::string_view text)
212238
{
213239
unsigned value{};
214-
const auto result = std::from_chars(text.data(), text.data() + text.size(), value);
240+
const auto endPointer = text.data() + text.size();
241+
const auto result = std::from_chars(text.data(), endPointer, value);
215242

216243
if (result.ec != std::errc())
217244
return {};
218-
const auto allCharactersParsed = (result.ptr == &(*text.end()));
245+
const auto allCharactersParsed = (result.ptr == endPointer);
219246
if (!allCharactersParsed)
220247
return {};
221248

@@ -225,11 +252,12 @@ std::optional<unsigned> toUnsigned(const std::string_view text)
225252
std::optional<int> toInt(const std::string_view text)
226253
{
227254
int value{};
228-
const auto result = std::from_chars(text.data(), text.data() + text.size(), value);
255+
const auto endPointer = text.data() + text.size();
256+
const auto result = std::from_chars(text.data(), endPointer, value);
229257

230258
if (result.ec != std::errc())
231259
return {};
232-
const auto allCharactersParsed = (result.ptr == &(*text.end()));
260+
const auto allCharactersParsed = (result.ptr == endPointer);
233261
if (!allCharactersParsed)
234262
return {};
235263

YUViewLib/src/common/Functions.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
#include <istream>
3838
#include <optional>
39+
#include <string_view>
40+
#include <vector>
3941

4042
namespace functions
4143
{
@@ -77,8 +79,12 @@ template <size_t N> QStringList toQStringList(const std::array<std::string_view,
7779
return list;
7880
}
7981

80-
std::string toLower(const std::string_view str);
81-
ByteVector readData(std::istream &istream, const size_t nrBytes);
82+
std::string toLower(const std::string_view str);
83+
std::optional<int> toInt(const std::string_view str);
84+
std::vector<std::string_view> splitString(const std::string_view str, const char delimiter);
85+
std::string_view stripWhitespace(std::string_view str);
86+
87+
ByteVector readData(std::istream &istream, const size_t nrBytes);
8288

8389
template <typename T> unsigned clipToUnsigned(T val)
8490
{

YUViewLib/src/common/FunctionsGui.cpp

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -108,40 +108,6 @@ QIcon functionsGui::convertIcon(QString iconPath)
108108
return outIcon;
109109
}
110110

111-
QPixmap functionsGui::convertPixmap(QString pixmapPath)
112-
{
113-
QSettings settings;
114-
QString themeName = settings.value("Theme", "Default").toString();
115-
116-
// Get the active and inactive colors
117-
QStringList colors = functions::getThemeColors(themeName);
118-
QRgb activeColor;
119-
if (colors.size() == 4)
120-
{
121-
QColor active(colors[1]);
122-
activeColor = active.rgb();
123-
}
124-
else
125-
activeColor = qRgb(0, 0, 0);
126-
127-
QImage input(pixmapPath);
128-
129-
QImage active(input.size(), input.format());
130-
for (int y = 0; y < input.height(); y++)
131-
{
132-
for (int x = 0; x < input.width(); x++)
133-
{
134-
QRgb in = input.pixel(x, y);
135-
if (qAlpha(in) != 0)
136-
active.setPixel(x, y, activeColor);
137-
else
138-
active.setPixel(x, y, in);
139-
}
140-
}
141-
142-
return QPixmap::fromImage(active);
143-
}
144-
145111
QString functionsGui::pixelFormatToString(QImage::Format f)
146112
{
147113
if (f == QImage::Format_Invalid)

YUViewLib/src/common/FunctionsGui.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,5 @@ void setupUi(void *ui, void (*setupUi)(void *ui, QWidget *widget));
108108

109109
// Return the icon/pixmap from the given file path (inverted if necessary)
110110
QIcon convertIcon(QString iconPath);
111-
QPixmap convertPixmap(QString pixmapPath);
112111

113112
} // namespace functionsGui

0 commit comments

Comments
 (0)