Skip to content

Commit

Permalink
Merge pull request #249 from IENT/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ChristianFeldmann authored Jul 3, 2020
2 parents ce9b58f + caee16e commit 24c65ed
Show file tree
Hide file tree
Showing 9 changed files with 148 additions and 47 deletions.
47 changes: 39 additions & 8 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: CI build

on: [push, release]
on:
push:
release:
types:
- created

jobs:
build-unix:
Expand Down Expand Up @@ -77,22 +81,38 @@ jobs:
cd build/YUViewApp
# Zip
zip -r ${{matrix.ARTIFACT_NAME}} YUView.app/
cp ${{matrix.ARTIFACT_NAME}} $GITHUB_WORKSPACE/artifacts
mkdir $GITHUB_WORKSPACE/artifacts
cp ${{matrix.ARTIFACT_NAME}} $GITHUB_WORKSPACE/artifacts/
if: matrix.os == 'macos-10.15'
- name: Build Appimage (Linux)
run: |
cd build
make INSTALL_ROOT=appdir install
$GITHUB_WORKSPACE/linuxdeployqt-6-x86_64.AppImage YUViewApp/appdir/usr/local/share/applications/de.rwth_aachen.ient.YUView.desktop -appimage -bundle-non-qt-libs -verbose=2
mv YUView-*.AppImage YUView.AppImage
cp YUView.AppImage $GITHUB_WORKSPACE/artifacts
mkdir $GITHUB_WORKSPACE/artifacts
cp YUView.AppImage $GITHUB_WORKSPACE/artifacts/
cd $GITHUB_WORKSPACE
ls -l
cd $GITHUB_WORKSPACE/artifacts
ls -l
if: matrix.os == 'ubuntu-16.04'
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: ${{matrix.ARTIFACT_NAME}}
path: artifacts
if: matrix.os != 'ubuntu-18.04'
- name: Upload Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/${{matrix.ARTIFACT_NAME}}
asset_name: ${{matrix.ARTIFACT_NAME}}
asset_content_type: application/zip
if: github.event_name == 'release' && matrix.os != 'ubuntu-18.04'
build-windows:
runs-on: ${{ matrix.os }}
strategy:
Expand All @@ -107,7 +127,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: git fetch --prune --unshallow
- uses: Dovyski/payload-info-action@master
- name: Install Qt base
run: |
cd ../../
Expand Down Expand Up @@ -196,16 +215,28 @@ jobs:
name: YUViewSetup.msi
path: ./YUViewSetup.msi
if: matrix.auto_update == true
- name: Upload Release
- name: Upload Windows zip to Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: artifacts/YUView-Win.zip
asset_name: YUView-Win.zip
asset_content_type: binary/octet-stream
asset_name: ${{matrix.ARTIFACT_NAME}}
asset_content_type: application/zip
if: github.event_name == 'release'
- name: Upload Windows installer to Release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: YUViewSetup.msi
asset_name: YUViewSetup.msi
asset_content_type: application/zip
if: github.event_name == 'release' && matrix.auto_update == true

# How to upload files to the release:
# https://github.com/Blacksmoke16/oq/pull/47/files#diff-082c28d748ad2e3eecc5508d740d9417R9-R29
# https://github.com/Blacksmoke16/oq/pull/47/files#diff-082c28d748ad2e3eecc5508d740d9417R9-R29
# Mime type list
# https://www.iana.org/assignments/media-types/media-types.xhtml
16 changes: 8 additions & 8 deletions YUViewLib/src/parser/common/SubByteReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@ uint64_t SubByteReader::readBits64(int nrBits, QString &bitsRead)

QByteArray SubByteReader::readBytes(int nrBytes)
{
if (skipEmulationPrevention)
throw std::logic_error("Reading bytes with emulation prevention active is not supported.");
if (posInBuffer_bits != 0 && posInBuffer_bits != 8)
throw std::logic_error("When reading bytes from the bitstream, it should be byte alligned.");

if (posInBuffer_bits == 8)
if (!gotoNextByte())
if (!this->gotoNextByte())
// We are at the end of the buffer but we need to read more. Error.
throw std::logic_error("Error while reading annexB file. Trying to read over buffer boundary.");

QByteArray retArray;
for (int i = 0; i < nrBytes; i++)
{
if (posInBuffer_bytes >= (unsigned int)byteArray.size())
throw std::logic_error("Error while reading annexB file. Trying to read over buffer boundary.");

retArray.append(byteArray[posInBuffer_bytes]);
posInBuffer_bytes++;

if (!this->gotoNextByte())
{
if (i < nrBytes - 1)
throw std::logic_error("Error while reading annexB file. Trying to read over buffer boundary.");
}
}

return retArray;
Expand Down Expand Up @@ -322,7 +322,7 @@ bool SubByteReader::gotoNextByte()

if (posInBuffer_bytes >= (unsigned int)byteArray.size())
// The next byte is outside of the current buffer. Error.
return false;
return false;

if (skipEmulationPrevention)
{
Expand Down
28 changes: 21 additions & 7 deletions YUViewLib/src/parser/parserAVFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ bool parserAVFormat::runParsingOfFile(QString compressedFilePath)
{
// Open the file but don't parse it yet.
QScopedPointer<fileSourceFFmpegFile> ffmpegFile(new fileSourceFFmpegFile());
if (!ffmpegFile->openFile(compressedFilePath, nullptr, nullptr, false))
if (!ffmpegFile->openFile(compressedFilePath, nullptr, nullptr, false))
{
emit backgroundParsingDone("Error opening the ffmpeg file.");
return false;
Expand Down Expand Up @@ -650,12 +650,26 @@ bool parserAVFormat::runParsingOfFile(QString compressedFilePath)
// ffmpegFile->seekFileToBeginning();

// First get the extradata and push it to the parser
QByteArray extradata = ffmpegFile->getExtradata();
parseExtradata(extradata);

// Parse the metadata
QStringPairList metadata = ffmpegFile->getMetadata();
parseMetadata(metadata);
try
{
QByteArray extradata = ffmpegFile->getExtradata();
parseExtradata(extradata);
}
catch (...)
{
emit backgroundParsingDone("Error parsing Extradata from container");
return false;
}
try
{
QStringPairList metadata = ffmpegFile->getMetadata();
parseMetadata(metadata);
}
catch (...)
{
emit backgroundParsingDone("Error parsing Metadata from container");
return false;
}

// After opening the file, we can get information on it
streamInfoAllStreams = ffmpegFile->getFileInfoForAllStreams();
Expand Down
1 change: 0 additions & 1 deletion YUViewLib/src/ui/bitstreamAnalysisWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ void BitstreamAnalysisWidget::restartParsingOfCurrentItem()
this->ui.streamInfoTreeWidget->clear();
this->ui.dataTreeView->setModel(nullptr);
this->ui.plotViewWidget->setModel(nullptr);
this->parser.reset();
return;
}

Expand Down
3 changes: 2 additions & 1 deletion YUViewLib/src/ui/views/MoveAndZoomableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ protected slots:
const QPen ZOOM_RECT_PEN = QPen(QColor(50, 50, 255, 150));
const QBrush ZOOM_RECT_BRUSH = QBrush(QColor(50, 50, 255, 50));

virtual void getStateFromMaster();

private:
QPoint viewDraggingMousePosStart;
QPoint viewDraggingStartOffset;
Expand All @@ -161,5 +163,4 @@ protected slots:
void slaveSetZoomFactor(double zoom);
//void slaveSetPinchValues(double scaleFactor, QPointF centerPointOffset);
void slaveUpdateWidget();
void getStateFromMaster();
};
70 changes: 60 additions & 10 deletions YUViewLib/src/ui/views/splitViewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,8 @@ void splitViewWidget::paintEvent(QPaintEvent *paint_event)
painter.fillRect(boxRect,Qt::white);
painter.drawRect(boxRect);

// Draw the text
painter.drawText(textRect, Qt::AlignCenter, text);

// Update the mouse cursor
MoveAndZoomableView::updateMouseCursor();

return;
Expand Down Expand Up @@ -480,7 +478,6 @@ void splitViewWidget::paintEvent(QPaintEvent *paint_event)
painter.drawPixmap(pos, waitingForCachingPixmap);
}

// Update the mouse cursor
MoveAndZoomableView::updateMouseCursor();

if (testMode)
Expand Down Expand Up @@ -540,6 +537,7 @@ void splitViewWidget::updatePixelPositions()
// We now have the pixel difference value for the item under the cursor.
// We now draw one zoom box per view
const auto viewNum = (isSplitting() && item[1]) ? 2 : 1;
QPoint positions[2];
for (int view = 0; view < viewNum; view++)
{
// Get the size of the item
Expand All @@ -556,12 +554,26 @@ void splitViewWidget::updatePixelPositions()
if (pixelPoxY < 0)
pixelPoxY -= 1;

zoomBoxPixelUnderCursor[view] = QPoint(pixelPosX, pixelPoxY);
positions[view] = QPoint(pixelPosX, pixelPoxY);
}
}

setZoomBoxPixelUnderCursor(positions[0], positions[1], true);
}
}

void splitViewWidget::setZoomBoxPixelUnderCursor(QPoint posA, QPoint posB, bool setOtherViewIfLinked, bool callUpdate)
{
if (this->enableLink && setOtherViewIfLinked)
this->getOtherWidget()->setZoomBoxPixelUnderCursor(posA, posB, false, true);

this->zoomBoxPixelUnderCursor[0] = posA;
this->zoomBoxPixelUnderCursor[1] = posB;

if (callUpdate)
update();
}

void splitViewWidget::paintZoomBox(int view, QPainter &painter, int xSplit, const QPoint &drawArea_botR, playlistItem *item, int frame, const QPoint &pixelPos, bool pixelPosInItem, double zoomFactor, bool playing)
{
if (!this->drawZoomBox)
Expand Down Expand Up @@ -688,6 +700,20 @@ void splitViewWidget::paintZoomBox(int view, QPainter &painter, int xSplit, cons
}
}

void splitViewWidget::setDrawZoomBox(bool drawZoomBox, bool setOtherViewIfLinked, bool callUpdate)
{
if (this->enableLink && setOtherViewIfLinked)
this->getOtherWidget()->setDrawZoomBox(drawZoomBox, false, callUpdate);

this->drawZoomBox = drawZoomBox;
QSignalBlocker actionZoomBoxBlocker(this->actionZoomBox);
this->actionZoomBox.setChecked(drawZoomBox);
this->updateMouseTracking();

if (callUpdate)
update();
}

void splitViewWidget::paintRegularGrid(QPainter *painter, playlistItem *item)
{
if (regularGridSize == 0)
Expand Down Expand Up @@ -864,6 +890,8 @@ void splitViewWidget::mouseMoveEvent(QMouseEvent *mouse_event)

update();
}

MoveAndZoomableView::updateMouseCursor();
}

void splitViewWidget::mousePressEvent(QMouseEvent *mouse_event)
Expand Down Expand Up @@ -1002,6 +1030,14 @@ void splitViewWidget::setZoomFactor(double zoom)
}
}

void splitViewWidget::updateMouseTracking()
{
if (isViewFrozen)
this->setMouseTracking(false);
else
this->setMouseTracking(viewSplitMode != DISABLED || this->drawZoomBox);
}

bool splitViewWidget::updateMouseCursor(const QPoint &mousePos)
{
if (!MoveAndZoomableView::updateMouseCursor(mousePos))
Expand Down Expand Up @@ -1061,10 +1097,8 @@ void splitViewWidget::gridSetCustom(bool checked)

void splitViewWidget::toggleZoomBox(bool checked)
{
Q_UNUSED(checked);
this->drawZoomBox = !this->drawZoomBox;
this->setMouseTracking(this->drawZoomBox);
update();
Q_UNUSED(checked);
this->setDrawZoomBox(!this->drawZoomBox, true, true);
}

void splitViewWidget::toggleSeparateWindow(bool checked)
Expand Down Expand Up @@ -1197,6 +1231,8 @@ void splitViewWidget::setViewSplitMode(ViewSplitMode mode, bool setOtherViewIfLi
QSignalBlocker actionSplitViewBlocker(actionSplitView[i]);
actionSplitView[i].setChecked(viewSplitMode == ViewSplitMode(i));
}

this->updateMouseTracking();

if (callUpdate)
update();
Expand Down Expand Up @@ -1408,7 +1444,7 @@ void splitViewWidget::freezeView(bool freeze)
{
// View is frozen and should be unfrozen
isViewFrozen = false;
setMouseTracking(true);
this->updateMouseTracking();
update();
}
if (!isViewFrozen && freeze)
Expand All @@ -1418,7 +1454,7 @@ void splitViewWidget::freezeView(bool freeze)
if (this->isMasterView && isSeparateViewEnabled && !playbackPrimary)
{
isViewFrozen = true;
setMouseTracking(false);
this->updateMouseTracking();
update();
}
}
Expand Down Expand Up @@ -1792,3 +1828,17 @@ QPointer<splitViewWidget> splitViewWidget::getOtherWidget() const
return QPointer<splitViewWidget>(qobject_cast<splitViewWidget*>(this->masterView));
}
}

void splitViewWidget::getStateFromMaster()
{
const auto mainView = this->getOtherWidget();
this->setViewSplitMode(mainView->viewSplitMode, false);
this->setSplittingPoint(mainView->splittingPoint, false);
this->setRegularGridSize(mainView->regularGridSize, false);
this->setDrawZoomBox(mainView->drawZoomBox, false);

this->updateMouseTracking();
update();

MoveAndZoomableView::getStateFromMaster();
}
4 changes: 4 additions & 0 deletions YUViewLib/src/ui/views/splitViewWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ private slots:
QAction actionSeparateViewPlaybackBoth;
QAction actionZoomBox;

void updateMouseTracking();
virtual bool updateMouseCursor(const QPoint &srcMousePos) override;

// When the splitView is set as a center widget this will assert that after the adding operation the widget will have a
Expand Down Expand Up @@ -202,9 +203,11 @@ private slots:
QPoint zoomBoxMousePosition; //!< If we are drawing the zoom box(es) we have to know where the mouse currently is.
QColor zoomBoxBackgroundColor; //!< The color of the zoom box background (read from settings)
void paintZoomBox(int view, QPainter &painter, int xSplit, const QPoint &drawArea_botR, playlistItem *item, int frame, const QPoint &pixelPos, bool pixelPosInItem, double zoomFactor, bool playing);
void setDrawZoomBox(bool drawZoomBox, bool setOtherViewIfLinked = true, bool callUpdate = false);

//!< Using the current mouse position, calculate the position in the items under the mouse (per view)
void updatePixelPositions();
void setZoomBoxPixelUnderCursor(QPoint posA, QPoint posB, bool setOtherViewIfLinked = true, bool callUpdate = false);
QPoint zoomBoxPixelUnderCursor[2]; //!< The above function will update this. (The position of the pixel under the cursor (per item))

// Regular grid
Expand Down Expand Up @@ -264,6 +267,7 @@ private slots:
void testFinished(bool canceled); //< Report the test results and stop the testProgrssUpdateTimer

QPointer<splitViewWidget> getOtherWidget() const;
void getStateFromMaster() override;
};

#endif // SPLITVIEWWIDGET_H
Loading

0 comments on commit 24c65ed

Please sign in to comment.