mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-02-15 11:10:40 +01:00
Merge remote-tracking branch 'remotes/origin/branches/issue184_REBASED'
This commit is contained in:
commit
7ba0da60c9
148
.github/workflows/CreateReleaseDraft.yml
vendored
148
.github/workflows/CreateReleaseDraft.yml
vendored
@ -4,67 +4,105 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
fetch-artifacts:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install tools
|
- name: Install tools
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install gh
|
sudo apt-get install gh
|
||||||
sudo apt-get install jq
|
sudo apt-get install jq
|
||||||
|
|
||||||
- name: Get latest run ID for Linux_AppImage
|
- name: Get latest run ID for Linux_AppImage
|
||||||
id: get_linux_run_id
|
id: get_linux_run_id
|
||||||
run: |
|
run: |
|
||||||
latest_run=$(gh run list --workflow=Linux_AppImage --json databaseId,conclusion --jq '.[0]')
|
latest_run=$(gh run list --workflow=Linux_AppImage --json databaseId,conclusion --jq '.[0]')
|
||||||
linux_run_id=$(echo $latest_run | jq -r .databaseId)
|
linux_run_id=$(echo $latest_run | jq -r .databaseId)
|
||||||
echo "linux_run_id=$linux_run_id" >> $GITHUB_ENV
|
echo "linux_run_id=$linux_run_id" >> $GITHUB_ENV
|
||||||
conclusion=$(echo $latest_run | jq -r .conclusion)
|
conclusion=$(echo $latest_run | jq -r .conclusion)
|
||||||
if [ "$conclusion" != "success" ]; then
|
if [ "$conclusion" != "success" ]; then
|
||||||
echo "Latest Linux_AppImage workflow run failed."
|
echo "Latest Linux_AppImage workflow run failed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Get latest run ID for Windows_MSI
|
- name: Get latest run ID for Windows_MSI
|
||||||
id: get_windows_run_id
|
id: get_windows_run_id
|
||||||
run: |
|
run: |
|
||||||
latest_run=$(gh run list --workflow=Windows_MSI --json databaseId,conclusion --jq '.[0]')
|
latest_run=$(gh run list --workflow=Windows_MSI --json databaseId,conclusion --jq '.[0]')
|
||||||
windows_run_id=$(echo $latest_run | jq -r .databaseId)
|
windows_run_id=$(echo $latest_run | jq -r .databaseId)
|
||||||
echo "windows_run_id=$windows_run_id" >> $GITHUB_ENV
|
echo "windows_run_id=$windows_run_id" >> $GITHUB_ENV
|
||||||
conclusion=$(echo $latest_run | jq -r .conclusion)
|
conclusion=$(echo $latest_run | jq -r .conclusion)
|
||||||
if [ "$conclusion" != "success" ]; then
|
if [ "$conclusion" != "success" ]; then
|
||||||
echo "Latest Windows_MSI workflow run failed."
|
echo "Latest Windows_MSI workflow run failed."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Download Linux_AppImage artifact
|
- name: Download Linux_AppImage artifact
|
||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts/linux
|
mkdir -p artifacts
|
||||||
gh run download ${{ env.linux_run_id }} --name Linux_AppImage -D artifacts/linux/
|
echo "Downloading artifacts from run ID: ${{ env.linux_run_id }}..."
|
||||||
|
gh run download ${{ env.linux_run_id }} -D artifacts
|
||||||
|
echo "Artifacts downloaded to artifacts directory."
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Download Windows_MSI artifact
|
- name: Download Windows_MSI artifact
|
||||||
run: |
|
run: |
|
||||||
mkdir -p artifacts/windows
|
mkdir -p artifacts
|
||||||
gh run download ${{ env.windows_run_id }} --name Windows_MSI -D artifacts/windows/
|
echo "Downloading artifacts from run ID: ${{ env.windows_run_id }}..."
|
||||||
|
gh run download ${{ env.windows_run_id }} -D artifacts
|
||||||
|
echo "Artifacts downloaded to artifacts directory."
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Create Release Draft
|
- name: Read version
|
||||||
id: create_release
|
id: get_version
|
||||||
uses: actions/create-release@v1
|
run: |
|
||||||
env:
|
version=$(grep -oP 'set\(PDF4QT_VERSION \K[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' "CMakeLists.txt")
|
||||||
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
|
echo "Version: $version"
|
||||||
with:
|
echo "pdf4qt_version=$version" >> $GITHUB_ENV
|
||||||
tag_name: ''
|
|
||||||
release_name: "Release Draft"
|
- name: Rezip zip file
|
||||||
draft: true
|
id: rezip_zip_file
|
||||||
prerelease: false
|
run: |
|
||||||
generate_release_notes: true
|
cd artifacts/PDF4QT-Windows-${{ env.pdf4qt_version }}.zip
|
||||||
files: |
|
zip -r ../PDF4QT-Windows-${{ env.pdf4qt_version }}.zip.backup *
|
||||||
artifacts/linux/*
|
|
||||||
artifacts/windows/*
|
- name: Rename zip archive
|
||||||
|
run: |
|
||||||
|
rm -rf artifacts/PDF4QT-Windows-${{ env.pdf4qt_version }}.zip/
|
||||||
|
mv artifacts/PDF4QT-Windows-${{ env.pdf4qt_version }}.zip.backup artifacts/PDF4QT-Windows-${{ env.pdf4qt_version }}.zip
|
||||||
|
|
||||||
|
- name: Correct file paths
|
||||||
|
run: |
|
||||||
|
find artifacts -mindepth 2 -type f -exec sh -c 'mv "$1" "artifacts/$(basename "$1")_moved"' _ {} \;
|
||||||
|
find artifacts -type d -empty -delete
|
||||||
|
for f in artifacts/*_moved; do
|
||||||
|
mv "$f" "${f/_moved/}"
|
||||||
|
done
|
||||||
|
|
||||||
|
- name: List all files recursively
|
||||||
|
run: |
|
||||||
|
echo "Listing all files in artifacts:"
|
||||||
|
find artifacts -type f -print
|
||||||
|
|
||||||
|
- name: Create Release Draft
|
||||||
|
id: create_release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: 'v${{ env.pdf4qt_version }}'
|
||||||
|
name: "Release of PDF4QT ${{ env.pdf4qt_version }} (Draft)"
|
||||||
|
draft: true
|
||||||
|
prerelease: false
|
||||||
|
generate_release_notes: true
|
||||||
|
token: ${{ secrets.MY_GITHUB_TOKEN }}
|
||||||
|
fail_on_unmatched_files: true
|
||||||
|
files: |
|
||||||
|
artifacts/*
|
4
.github/workflows/LinuxInstall.yml
vendored
4
.github/workflows/LinuxInstall.yml
vendored
@ -1,10 +1,6 @@
|
|||||||
name: Linux_AppImage
|
name: Linux_AppImage
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
4
.github/workflows/WindowsInstall.yml
vendored
4
.github/workflows/WindowsInstall.yml
vendored
@ -1,10 +1,6 @@
|
|||||||
name: Windows_MSI
|
name: Windows_MSI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- 'v*'
|
|
||||||
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -693,28 +693,9 @@ void PDFBLPaintEngine::drawPixmap(const QRectF& r, const QPixmap& pm, const QRec
|
|||||||
|
|
||||||
void PDFBLPaintEngine::drawTextItem(const QPointF& p, const QTextItem& textItem)
|
void PDFBLPaintEngine::drawTextItem(const QPointF& p, const QTextItem& textItem)
|
||||||
{
|
{
|
||||||
if (m_currentRawFont.isValid())
|
// We will call the base implementation, which will
|
||||||
{
|
// create paths from text and draw these paths.
|
||||||
QString text = textItem.text();
|
QPaintEngine::drawTextItem(p, textItem);
|
||||||
QList<quint32> glyphIndices = m_currentRawFont.glyphIndexesForString(text);
|
|
||||||
QList<QPointF> glyphPositions = m_currentRawFont.advancesForGlyphIndexes(glyphIndices);
|
|
||||||
|
|
||||||
QPointF currentPosition = p;
|
|
||||||
QPainterPath path;
|
|
||||||
for (int i = 0; i < glyphIndices.size(); ++i)
|
|
||||||
{
|
|
||||||
QPainterPath glyphPath = m_currentRawFont.pathForGlyph(glyphIndices[i]);
|
|
||||||
glyphPath.translate(currentPosition);
|
|
||||||
path.addPath(glyphPath);
|
|
||||||
currentPosition += glyphPositions[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
m_blContext->save();
|
|
||||||
setFillRule(path.fillRule());
|
|
||||||
m_blContext->setFillStyle(BLRgba32(m_currentPen.color().rgba()));
|
|
||||||
drawPathImpl(path, false, true, true);
|
|
||||||
m_blContext->restore();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PDFBLPaintEngine::drawTiledPixmap(const QRectF& r, const QPixmap& pixmap, const QPointF& s)
|
void PDFBLPaintEngine::drawTiledPixmap(const QRectF& r, const QPixmap& pixmap, const QPointF& s)
|
||||||
|
@ -566,11 +566,12 @@ QTransform PDFTextEditPseudowidget::createTextBoxTransformMatrix(bool edit) cons
|
|||||||
matrix.translate(m_widgetRect.left(), m_widgetRect.bottom());
|
matrix.translate(m_widgetRect.left(), m_widgetRect.bottom());
|
||||||
matrix.scale(1.0, -1.0);
|
matrix.scale(1.0, -1.0);
|
||||||
|
|
||||||
|
const qreal textBoxHeight = m_widgetRect.height();
|
||||||
if (edit && !isComb() && m_textLayout.isValidCursorPosition(m_positionCursor))
|
if (edit && !isComb() && m_textLayout.isValidCursorPosition(m_positionCursor))
|
||||||
{
|
{
|
||||||
// Jakub Melka: we must scroll the control, so cursor is always
|
// Jakub Melka: We must scroll the control so the cursor is always
|
||||||
// visible in the widget area. If we are not editing, this not the
|
// visible in the widget area. If we are not editing, this is not the
|
||||||
// case, because we always show the text from the beginning.
|
// case because we always show the text from the beginning.
|
||||||
|
|
||||||
const QTextLine line = m_textLayout.lineForTextPosition(m_positionCursor);
|
const QTextLine line = m_textLayout.lineForTextPosition(m_positionCursor);
|
||||||
if (line.isValid())
|
if (line.isValid())
|
||||||
@ -586,28 +587,31 @@ QTransform PDFTextEditPseudowidget::createTextBoxTransformMatrix(bool edit) cons
|
|||||||
const qreal lineSpacing = line.leadingIncluded() ? line.height() : line.leading() + line.height();
|
const qreal lineSpacing = line.leadingIncluded() ? line.height() : line.leading() + line.height();
|
||||||
const qreal lineBottom = lineSpacing * (line.lineNumber() + 1);
|
const qreal lineBottom = lineSpacing * (line.lineNumber() + 1);
|
||||||
|
|
||||||
if (lineBottom >= m_widgetRect.height())
|
if (lineBottom > textBoxHeight)
|
||||||
{
|
{
|
||||||
const qreal delta = lineBottom - m_widgetRect.height();
|
const qreal delta = lineBottom - textBoxHeight;
|
||||||
matrix.translate(0.0, -delta);
|
matrix.translate(0.0, -delta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (!isMultiline() && !isComb())
|
||||||
if (!isMultiline() && !isComb())
|
|
||||||
{
|
{
|
||||||
// If text is single line, then adjust text position to the vertical center
|
// If text is single line, then adjust text position to the vertical center
|
||||||
QTextLine textLine = m_textLayout.lineAt(0);
|
QTextLine textLine = m_textLayout.lineAt(0);
|
||||||
if (textLine.isValid())
|
if (textLine.isValid())
|
||||||
{
|
{
|
||||||
const qreal lineSpacing = textLine.leadingIncluded() ? textLine.height() : textLine.leading() + textLine.height();
|
const qreal lineSpacing = textLine.leadingIncluded() ? textLine.height() : textLine.leading() + textLine.height();
|
||||||
const qreal textBoxHeight = m_widgetRect.height();
|
|
||||||
|
|
||||||
if (lineSpacing < textBoxHeight)
|
if (lineSpacing < textBoxHeight)
|
||||||
{
|
{
|
||||||
const qreal delta = (textBoxHeight - lineSpacing) * 0.5;
|
const qreal delta = (textBoxHeight - lineSpacing) * 0.5;
|
||||||
matrix.translate(0.0, delta);
|
matrix.translate(0.0, delta);
|
||||||
}
|
}
|
||||||
|
else if (lineSpacing > textBoxHeight)
|
||||||
|
{
|
||||||
|
const qreal delta = lineSpacing - textBoxHeight;
|
||||||
|
matrix.translate(0.0, -delta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user