Skip to content

Commit

Permalink
QT6 Version
Browse files Browse the repository at this point in the history
  • Loading branch information
kanehekili committed May 5, 2023
1 parent 604f709 commit 5930f11
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 66 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# VideoMerge
Version 1.0.2
Version 2.0.0

![Download](https://github.com/kanehekili/VideoMerge/releases/download/1.0.2/videomerge1.0.2.tar)
![Download](https://github.com/kanehekili/VideoMerge/releases/download/2.0.0/videomerge2.0.0.tar)

UI Tool to merge different videos using ffmpeg
Supports the (fast) merge of homogenius streams as well as (slower) reencoding different file formats.
Expand Down Expand Up @@ -73,6 +73,9 @@ sudo apt install --no-install-recommends install videomerge
```

## Changes
05.05.2023
* Fixed fps recognition, Ubuntu build changes, Switch to QT6

20.12.2022
* Path fixes

Expand Down
2 changes: 1 addition & 1 deletion build/AUR-template/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pkgrel=@xpkgrelx@
pkgdesc="Simple and fast mp4/matroska/Av1/webm/mp2/mpts Video merger"
url="https://github.com/kanehekili/VideoMerge"
license=('GPL2')
depends=('python-pyqt5' 'ffmpeg')
depends=('python-pyqt6' 'ffmpeg')
arch=('any')
source=(https://github.com/kanehekili/VideoMerge/releases/download/@xxx@/videomerge@xxx@.tar)
md5sums=(@md5sum@)
Expand Down
4 changes: 2 additions & 2 deletions build/DEB-template/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Source: videomerge
Maintainer: kanehekili <mat.wegmann@gmail.com>
Section: video
Priority: optional
Build-Depends: python3, debhelper, python3-pyqt5
Build-Depends: debhelper
Standards-Version: 1.0.0



Architecture: all
Depends: python3, ffmpeg, python3-pyqt5,${shlibs:Depends}, ${misc:Depends}
Depends: python3, ffmpeg, python3-pyqt6,${shlibs:Depends}, ${misc:Depends}
Description: Fast and lossless videomerger for mp2,mp4,mkv,av-1 and more
Section: video
Package: videomerge
Expand Down
6 changes: 4 additions & 2 deletions build/build.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
startApp=VideoMerge.py
appName=videomerge
version=1.0.2
pkgrelease=1
version=2.0.0
pkgrelease=3
#LTS,LTS,prepare for next LTS
ubu1=focal
ubu2=jammy
ubu3=lunar
49 changes: 44 additions & 5 deletions build/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
<property name="debTarget" value="DEB"/>
<property name="ubu1Build" value="${appName}_${version}+${pkgrelease}~${ubu1}"/>
<property name="ubu2Build" value="${appName}_${version}+${pkgrelease}~${ubu2}"/>
<property name="ubu3Build" value="${appName}_${version}+${pkgrelease}~${ubu3}"/>
<property name="ubu1Target" value="${stage}/${ubu1Build}"/>
<property name="ubu2Target" value="${stage}/${ubu2Build}"/>
<property name="ubu2Target" value="${stage}/${ubu2Build}"/>
<property name="ubu3Target" value="${stage}/${ubu3Build}"/>

<delete dir="${stage}"/>
<delete dir="${aurTarget}"/>
Expand All @@ -21,6 +23,7 @@
<mkdir dir="${debTarget}"/>
<mkdir dir="${ubu1Target}"/>
<mkdir dir="${ubu2Target}"/>
<mkdir dir="${ubu3Target}"/>
<property name="source" value="../src"/>
<property name="srcIcons" value="${source}/icons"/>

Expand Down Expand Up @@ -102,7 +105,7 @@
</copy>

<mkdir dir="${ubu1Target}/addons"/>
<mkdir dir="${ubu1Target}/debian"/>
<mkdir dir="${ubu1Target}/debian"></mkdir>
<mkdir dir="${ubu1Target}/src"/>
<copy todir="${ubu1Target}/src/icons">
<fileset dir="${srcIcons}">
Expand Down Expand Up @@ -152,7 +155,7 @@
<filterset>
<filter token="xxx" value="${version}"/>
</filterset>
<fileset file="${rootDir}FFMPEGTools.py" />
<fileset file="${rootDir}/FFMPEGTools.py" />
</copy>
<chmod file="${ubu2Target}/src/${startApp}" perm="ug+rwx"/>
<copy todir="${ubu2Target}/addons">
Expand All @@ -166,8 +169,44 @@
<arg value="${ubu2Build}"/>
</exec>

<delete dir="${stage}"/>
</target>
<!-- DEBBUILD ubu3-->
<copy todir="${ubu3Target}">
<fileset dir="DEB-template"/>
<filterset>
<filter token="ubu" value="${ubu3}"/>
<filter token="xxx" value="${version}"/>
<filter token="xpkgrelx" value="${pkgrelease}"/>
<filter token="xtsx" value="${time.stamp}"/>
</filterset>

</copy>
<mkdir dir="${ubu3Target}/addons"/>
<mkdir dir="${ubu3Target}/debian"/>
<mkdir dir="${ubu3Target}/src"/>
<copy todir="${ubu3Target}/src/icons">
<fileset dir="${srcIcons}">
</fileset>
</copy>
<copy todir="${ubu3Target}/src">
<fileset file="${source}/*.py" />
<filterset>
<filter token="xxx" value="${version}"/>
</filterset>
<fileset file="${rootDir}/FFMPEGTools.py" />
</copy>
<chmod file="${ubu3Target}/src/${startApp}" perm="ug+rwx"/>
<copy todir="${ubu3Target}/addons">
<fileset file="*.desktop"/>
</copy>

<exec executable="tar" output="/dev/null" os="Linux">
<arg value="-cp"/>
<arg value="--file=${debTarget}/${ubu3Build}.tar"/>
<arg value="--directory=${stage}"/>
<arg value="${ubu3Build}"/>
</exec>

<delete dir="${stage}"/>
</target>

</project>
67 changes: 37 additions & 30 deletions src/DragnDropTableWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@
@author: matze
'''
from PyQt5 import QtGui,QtWidgets,QtCore
from PyQt5.QtCore import pyqtSignal
#from PyQt5 import QtGui,QtWidgets,QtCore
#from PyQt5.QtCore import pyqtSignal
from PyQt6 import QtGui,QtWidgets,QtCore
from PyQt6.QtCore import pyqtSignal,Qt


import os

class CheckBoxDelegate(QtWidgets.QItemDelegate):
CHECKBOX_USER_ROLE = QtCore.Qt.UserRole+1001
CHECKBOX_USER_ROLE = QtCore.Qt.ItemDataRole.UserRole+1001

def createEditor(self, parent, option, index):
""" Important, otherwise an editor is created if the user clicks in this cell.
Expand All @@ -17,34 +21,34 @@ def createEditor(self, parent, option, index):

def paint(self, painter, option, index):
checked = index.data(self.CHECKBOX_USER_ROLE)
text=index.data(QtCore.Qt.DisplayRole)
text=index.data(QtCore.Qt.ItemDataRole.DisplayRole)
opts = QtWidgets.QStyleOptionButton()
opts.state |= QtWidgets.QStyle.State_Active
if index.flags() & QtCore.Qt.ItemIsEditable:
opts.state |= QtWidgets.QStyle.State_Enabled
opts.state |= QtWidgets.QStyle.StateFlag.State_Active
if index.flags() & QtCore.Qt.ItemFlag.ItemIsEditable:
opts.state |= QtWidgets.QStyle.StateFlag.State_Enabled
else:
opts.state |= QtWidgets.QStyle.State_ReadOnly
opts.state |= QtWidgets.QStyle.StateFlag.State_ReadOnly
if checked:
opts.state |= QtWidgets.QStyle.State_On
opts.state |= QtWidgets.QStyle.StateFlag.State_On
else:
opts.state |= QtWidgets.QStyle.State_Off
opts.state |= QtWidgets.QStyle.StateFlag.State_Off
opts.rect = option.rect
opts.textVisible = True
opts.text=text
QtWidgets.QApplication.style().drawControl(QtWidgets.QStyle.CE_CheckBox, opts, painter)
QtWidgets.QApplication.style().drawControl(QtWidgets.QStyle.ControlElement.CE_CheckBox, opts, painter)

def editorEvent(self, event, model, option, index):
""" Change the data in the model and the state of the checkbox if the
user presses the left mouse button and this cell is editable. Otherwise do nothing.
"""
if not (index.flags() & QtCore.Qt.ItemIsEditable):
if not (index.flags() & QtCore.Qt.ItemFlag.ItemIsEditable):
return False
if event.button() == QtCore.Qt.LeftButton:
if event.type() == QtCore.QEvent.MouseButtonRelease:
if event.button() == QtCore.Qt.MouseButton.LeftButton:
if event.type() == QtCore.QEvent.Type.MouseButtonRelease:
if option.rect.contains(event.pos()):
self.setModelData(None, model, index)
return True
elif event.type() == QtCore.QEvent.MouseButtonDblClick:
elif event.type() == QtCore.QEvent.Type.MouseButtonDblClick:
if option.rect.contains(event.pos()):
return True
return False
Expand All @@ -56,12 +60,12 @@ def setModelData(self, editor, model, index):
model.setData(index, checked, self.CHECKBOX_USER_ROLE)

class ProgressDelegate(QtWidgets.QStyledItemDelegate):
PROGRESS_USER_ROLE = QtCore.Qt.UserRole+1001
PROGRESS_USER_ROLE = QtCore.Qt.ItemDataRole.UserRole+1001

def paint(self, painter, option, index):
progress = index.data(self.PROGRESS_USER_ROLE)
#the selection
if option.state & QtWidgets.QStyle.State_Selected:
if option.state & QtWidgets.QStyle.StateFlag.State_Selected:
painter.fillRect(option.rect, option.palette.highlight());
else:
painter.fillRect(option.rect, option.palette.window());
Expand All @@ -78,7 +82,7 @@ def paint(self, painter, option, index):
opt.progress = progress
opt.text = "{}%".format(progress)
opt.textVisible = True
QtWidgets.QApplication.style().drawControl(QtWidgets.QStyle.CE_ProgressBar, opt, painter)
QtWidgets.QApplication.style().drawControl(QtWidgets.QStyle.ControlElement.CE_ProgressBar, opt, painter)

# simple delegate to display the filename only
class PathDelegate(QtWidgets.QStyledItemDelegate):
Expand All @@ -89,7 +93,7 @@ def displayText(self, value, locale):
Support plain icon delegate
'''
class IconDelegate(QtWidgets.QStyledItemDelegate):
PROGRESS_USER_ROLE = QtCore.Qt.UserRole+1001
PROGRESS_USER_ROLE = QtCore.Qt.ItemDataRole.UserRole+1001
def __init__(self, icons, parent=None):
super(IconDelegate, self).__init__(parent)
self._icons = icons
Expand All @@ -103,11 +107,11 @@ def paint(self, painter, option, index):
progress = index.data(self.PROGRESS_USER_ROLE)
icon = self.get_icon(progress)
#the selection
if option.state & QtWidgets.QStyle.State_Selected:
if option.state & QtWidgets.QStyle.StateFlag.State_Selected:
painter.fillRect(option.rect, option.palette.highlight());
else:
painter.fillRect(option.rect, option.palette.window());
icon.paint(painter, option.rect, QtCore.Qt.AlignCenter)
icon.paint(painter, option.rect, QtCore.Qt.AlignmentFlag.AlignCenter)


'''
Expand All @@ -122,10 +126,11 @@ def __init__(self, parent):
QtWidgets.QTableView.__init__(self, parent)
self.owner=parent
self.verticalHeader().hide()
self.setSelectionBehavior(self.SelectRows)
self.setSelectionMode(self.SingleSelection)
#pyqt5 self.setSelectionBehavior(self.SelectRows)
self.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
self.setShowGrid(True)
self.setDragDropMode(self.InternalMove)
self.setDragDropMode(QtWidgets.QAbstractItemView.DragDropMode.InternalMove)
self.setDragDropOverwriteMode(False)
self.resizeColumnsToContents()
self._createContextMenu()
Expand Down Expand Up @@ -232,7 +237,7 @@ def dragMoveEvent(self, event):
return
if event.mimeData().hasUrls():
event.setDropAction(QtCore.Qt.CopyAction)
event.setDropAction(QtCore.Qt.DropAction.CopyAction)
event.accept()
else:
event.ignore()
Expand All @@ -244,7 +249,7 @@ def dropEvent(self, event):
return

if event.mimeData().hasUrls:
event.setDropAction(QtCore.Qt.CopyAction)
event.setDropAction(QtCore.Qt.DropAction.CopyAction)
for url in event.mimeData().urls():
urlString = str(url.toLocalFile())
self.onDropURL.emit(urlString)
Expand All @@ -261,10 +266,12 @@ def count(self):
def _createContextMenu(self):
self.contextMenu = QtWidgets.QMenu("Context")
self.contextMenu.addSeparator()
rmAction = QtWidgets.QAction(QtGui.QIcon('icons/del-x.png'), 'Remove', self)
#pyqt5 rmAction = QtWidgets.QAction(QtGui.QIcon('icons/del-x.png'), 'Remove', self)
rmAction = QtGui.QAction(QtGui.QIcon('icons/del-x.png'), 'Remove', self)
rmAction.triggered.connect(self._rmItem)
self.contextMenu.addAction(rmAction)
rmAllAction = QtWidgets.QAction(QtGui.QIcon('icons/clear-all.png'), 'Remove all', self)
#pyqt5 rmAllAction = QtWidgets.QAction(QtGui.QIcon('icons/clear-all.png'), 'Remove all', self)
rmAllAction = QtGui.QAction(QtGui.QIcon('icons/clear-all.png'), 'Remove all', self)
rmAllAction.triggered.connect(self._rmAllItems)
self.contextMenu.addAction(rmAllAction)
self.contextMenu.addSeparator()
Expand Down Expand Up @@ -321,15 +328,15 @@ def _rmAllItems(self):
#dont work right. And must implement for all items in the row!
# So this pattern is not really usable for dragndrop
class PathItemXX(QtGui.QStandardItem):
ROLE = QtCore.Qt.UserRole+1
ROLE = QtCore.Qt.ItemDataRole.UserRole+1
def __init__(self,another=None):
QtGui.QStandardItem.__init__(self,another)
self.path = None
self.displayName="?"

#only answer your stuff, else it breaks
def data(self,userRole):
if userRole == QtCore.Qt.DisplayRole:
if userRole == QtCore.Qt.ItemDataRole.DisplayRole:
return self.displayName
return None

Expand Down
Loading

0 comments on commit 5930f11

Please sign in to comment.