chore(cpn): upgrade to Ubuntu 22.04 and Qt 6.9.0 (#5986)

Co-authored-by: elecpower <elecpower@users.noreply.github.com>
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com>
This commit is contained in:
Neil Horne
2025-07-23 14:04:19 +02:00
committed by GitHub
co-authored by elecpower raphaelcoeffic
parent 7264b28e62
commit 9e86a3ea84
117 changed files with 4221 additions and 5155 deletions
+2 -2
View File
@@ -28,7 +28,7 @@ set(${PROJECT_NAME}_NAMES
AddHeadersSources()
# AUTOMOC does not detect so manually process
qt5_wrap_cpp(${PROJECT_NAME}_SRCS
qt_wrap_cpp(${PROJECT_NAME}_SRCS
${${PROJECT_NAME}_HDRS}
)
@@ -39,7 +39,7 @@ add_library(${PROJECT_NAME}
target_link_libraries(${PROJECT_NAME}
PRIVATE
${CPN_COMMON_LIB}
Qt5::Multimedia
Qt::Multimedia
)
target_include_directories(${PROJECT_NAME}
+14 -8
View File
@@ -31,6 +31,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model,
functions(model ? model->customFn : generalSettings.customFn),
mediaPlayerCurrent(-1),
mediaPlayer(nullptr),
audioOutput(new QAudioOutput()),
modelsUpdateCnt(0)
{
lock = true;
@@ -245,16 +246,16 @@ CustomFunctionsPanel::~CustomFunctionsPanel()
delete tabFilterFactory;
}
void CustomFunctionsPanel::onMediaPlayerStateChanged(QMediaPlayer::State state)
void CustomFunctionsPanel::onMediaPlayerPlaybackStateChanged(QMediaPlayer::PlaybackState state)
{
if (state != QMediaPlayer::PlayingState)
stopSound(mediaPlayerCurrent);
}
void CustomFunctionsPanel::onMediaPlayerError(QMediaPlayer::Error error)
void CustomFunctionsPanel::onMediaPlayerErrorOccurred(QMediaPlayer::Error error, const QString &errorString)
{
stopSound(mediaPlayerCurrent);
QMessageBox::critical(this, CPN_STR_TTL_ERROR, tr("Error occurred while trying to play sound, possibly the file is already opened. (Err: %1 [%2])").arg(mediaPlayer ? mediaPlayer->errorString() : "").arg(error));
QMessageBox::critical(this, CPN_STR_TTL_ERROR, tr("Error occurred while trying to play sound, possibly the file is already opened. (Err: %1 [%2])").arg(errorString).arg(error));
}
bool CustomFunctionsPanel::playSound(int index)
@@ -288,13 +289,16 @@ bool CustomFunctionsPanel::playSound(int index)
if (mediaPlayer)
stopSound(mediaPlayerCurrent);
mediaPlayer = new QMediaPlayer(this, QMediaPlayer::LowLatency);
mediaPlayer = new QMediaPlayer(this);
mediaPlayer->setAudioOutput(audioOutput);
if (functions[index].func == FuncPlaySound)
mediaPlayer->setMedia(QUrl(path.prepend("qrc")));
mediaPlayer->setSource(QUrl(path.prepend("qrc")));
else
mediaPlayer->setMedia(QUrl::fromLocalFile(path));
connect(mediaPlayer, &QMediaPlayer::stateChanged, this, &CustomFunctionsPanel::onMediaPlayerStateChanged);
connect(mediaPlayer, static_cast<void(QMediaPlayer::*)(QMediaPlayer::Error)>(&QMediaPlayer::error), this, &CustomFunctionsPanel::onMediaPlayerError);
mediaPlayer->setSource(QUrl::fromLocalFile(path));
connect(mediaPlayer, &QMediaPlayer::playbackStateChanged, this, &CustomFunctionsPanel::onMediaPlayerPlaybackStateChanged);
connect(mediaPlayer, &QMediaPlayer::errorOccurred, this, &CustomFunctionsPanel::onMediaPlayerErrorOccurred);
mediaPlayerCurrent = index;
mediaPlayer->play();
return true;
@@ -304,7 +308,9 @@ void CustomFunctionsPanel::stopSound(int index)
{
if (index > -1 && index < (int)DIM(playBT))
playBT[index]->setChecked(false);
mediaPlayerCurrent = -1;
if (mediaPlayer) {
disconnect(mediaPlayer, 0, this, 0);
mediaPlayer->stop();
+5 -2
View File
@@ -27,6 +27,7 @@
#include "filtereditemmodels.h"
#include <QMediaPlayer>
#include <QAudioOutput>
class TimerEdit;
@@ -53,8 +54,9 @@ class CustomFunctionsPanel : public GenericPanel
bool playSound(int index);
void stopSound(int index);
void toggleSound(bool play);
void onMediaPlayerStateChanged(QMediaPlayer::State state);
void onMediaPlayerError(QMediaPlayer::Error error);
void onMediaPlayerPlaybackStateChanged(QMediaPlayer::PlaybackState state);
void onMediaPlayerErrorOccurred(QMediaPlayer::Error error, const QString &errorString);
void cmDelete();
void cmCopy();
void cmPaste();
@@ -107,6 +109,7 @@ class CustomFunctionsPanel : public GenericPanel
QComboBox * fswtchRepeat[CPN_MAX_SPECIAL_FUNCTIONS];
QComboBox * fswtchGVmode[CPN_MAX_SPECIAL_FUNCTIONS];
QMediaPlayer * mediaPlayer;
QAudioOutput * audioOutput;
int selectedIndex;
int fswCapability;
+28 -16
View File
@@ -391,41 +391,53 @@ void InputsPanel::expoAdd()
gm_openExpo(index);
}
QAction * InputsPanel::addAct(const QString & icon, const QString & text, const char * slot, const QKeySequence & shortcut, bool enabled)
{
QAction * newAction = new QAction(this);
newAction->setMenuRole(QAction::NoRole);
newAction->setText(text);
newAction->setIcon(CompanionIcon(icon));
newAction->setShortcut(shortcut);
newAction->setEnabled(enabled);
connect(newAction, SIGNAL(triggered()), this, slot);
return newAction;
}
void InputsPanel::expolistWidget_customContextMenuRequested(QPoint pos)
{
QPoint globalPos = ExposlistWidget->mapToGlobal(pos);
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
bool hasData = mimeData->hasFormat(MIMETYPE_EXPO);
bool hasClipData = mimeData->hasFormat(MIMETYPE_EXPO);
selectedIdx = getIndexFromSelected();
inputIdx = getInputIndexFromSelected();
QMenu contextMenu;
QMenu *contextMenuLines = contextMenu.addMenu(tr("Lines"));
contextMenuLines->addAction(CompanionIcon("add.png"), tr("&Add"), this, SLOT(expoAdd()), tr("Ctrl+A"));
contextMenuLines->addAction(CompanionIcon("edit.png"), tr("&Edit"), this, SLOT(expoOpen()), tr("Enter"));
contextMenuLines->addAction(addAct("add.png", tr("&Add"), SLOT(expoAdd()), tr("Ctrl+A")));
contextMenuLines->addAction(addAct("edit.png", tr("&Edit"), SLOT(expoOpen()), tr("Enter")));
contextMenuLines->addSeparator();
contextMenuLines->addAction(CompanionIcon("clear.png"), tr("&Delete"), this, SLOT(exposDelete()), tr("Delete"));
contextMenuLines->addAction(CompanionIcon("copy.png"), tr("&Copy"), this, SLOT(exposCopy()), tr("Ctrl+C"));
contextMenuLines->addAction(CompanionIcon("cut.png"), tr("&Cut"), this, SLOT(exposCut()), tr("Ctrl+X"));
contextMenuLines->addAction(CompanionIcon("paste.png"), tr("&Paste"), this, SLOT(exposPaste()), tr("Ctrl+V"))->setEnabled(hasData);
contextMenuLines->addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"), this, SLOT(exposDuplicate()), tr("Ctrl+U"));
contextMenuLines->addAction(addAct("clear.png", tr("&Delete"), SLOT(exposDelete()), tr("Delete")));
contextMenuLines->addAction(addAct("copy.png", tr("&Copy"), SLOT(exposCopy()), tr("Ctrl+C")));
contextMenuLines->addAction(addAct("cut.png", tr("&Cut"), SLOT(exposCut()), tr("Ctrl+X")));
contextMenuLines->addAction(addAct("paste.png", tr("&Paste"), SLOT(exposPaste()), tr("Ctrl+V"), hasClipData));
contextMenuLines->addAction(addAct("duplicate.png", tr("Du&plicate"), SLOT(exposDuplicate()), tr("Ctrl+U")));
contextMenuLines->addSeparator();
contextMenuLines->addAction(CompanionIcon("moveup.png"), tr("Move Up"), this, SLOT(moveExpoUp()), tr("Ctrl+Up"));
contextMenuLines->addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(moveExpoDown()), tr("Ctrl+Down"));
contextMenuLines->addAction(addAct("moveup.png", tr("Move Up"), SLOT(moveExpoUp()), tr("Ctrl+Up")));
contextMenuLines->addAction(addAct("movedown.png", tr("Move Down"), SLOT(moveExpoDown()), tr("Ctrl+Down")));
QMenu *contextMenuInputs = contextMenu.addMenu(tr("Input"));
contextMenuInputs->addAction(CompanionIcon("arrow-right.png"), tr("Insert"), this, SLOT(cmInputInsert()))->setEnabled(cmInputInsertAllowed());
contextMenuInputs->addAction(CompanionIcon("arrow-left.png"), tr("Delete"), this, SLOT(cmInputDelete()));
contextMenuInputs->addAction(CompanionIcon("moveup.png"), tr("Move Up"), this, SLOT(cmInputMoveUp()))->setEnabled(cmInputMoveUpAllowed());
contextMenuInputs->addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(cmInputMoveDown()))->setEnabled(cmInputMoveDownAllowed());
contextMenuInputs->addAction(addAct("arrow-right.png", tr("Insert"), SLOT(cmInputInsert()), 0, cmInputInsertAllowed()));
contextMenuInputs->addAction(addAct("arrow-left.png", tr("Delete"), SLOT(cmInputDelete()), 0));
contextMenuInputs->addAction(addAct("moveup.png", tr("Move Up"), SLOT(cmInputMoveUp()), 0, cmInputMoveUpAllowed()));
contextMenuInputs->addAction(addAct("movedown.png", tr("Move Down"), SLOT(cmInputMoveDown()), 0, cmInputMoveDownAllowed()));
contextMenuInputs->addSeparator();
contextMenuInputs->addAction(CompanionIcon("clear.png"), tr("Clear"), this, SLOT(cmInputClear()))->setEnabled(isExpoIndex(selectedIdx));
contextMenuInputs->addAction(addAct("clear.png", tr("Clear"), SLOT(cmInputClear()), 0, isExpoIndex(selectedIdx)));
contextMenu.addSeparator();
contextMenu.addAction(CompanionIcon("clear.png"), tr("Clear All"), this, SLOT(clearExpos()));
contextMenu.addAction(addAct( "clear.png", tr("Clear All"), SLOT(clearExpos())));
contextMenu.addSeparator();
contextMenu.addActions(ExposlistWidget->actions());
contextMenu.exec(globalPos);
+1
View File
@@ -96,4 +96,5 @@ class InputsPanel : public ModelPanel
int getInputIndexFromSelected();
void updateItemModels();
void connectItemModelEvents(const int id);
QAction * addAct(const QString & icon, const QString & text, const char * slot, const QKeySequence & shortcut = 0, bool enabled = true);
};
+1 -1
View File
@@ -131,7 +131,7 @@ void MixersListWidget::dropEvent(QDropEvent * event)
else {
event->acceptProposedAction();
}
dropMimeData(indexAt(event->pos()).row(), event->mimeData(), event->dropAction());
dropMimeData(indexAt(event->position().toPoint()).row(), event->mimeData(), event->dropAction());
}
}
+23 -11
View File
@@ -419,27 +419,39 @@ void MixesPanel::mixerAdd()
gm_openMix(index);
}
QAction * MixesPanel::addAct(const QString & icon, const QString & text, const char * slot, const QKeySequence & shortcut, bool enabled)
{
QAction * newAction = new QAction(this);
newAction->setMenuRole(QAction::NoRole);
newAction->setText(text);
newAction->setIcon(CompanionIcon(icon));
newAction->setShortcut(shortcut);
newAction->setEnabled(enabled);
connect(newAction, SIGNAL(triggered()), this, slot);
return newAction;
}
void MixesPanel::mixerlistWidget_customContextMenuRequested(QPoint pos)
{
QPoint globalPos = mixersListWidget->mapToGlobal(pos);
const QClipboard *clipboard = QApplication::clipboard();
const QMimeData *mimeData = clipboard->mimeData();
bool hasData = mimeData->hasFormat("application/x-companion-mix");
bool hasClipData = mimeData->hasFormat("application/x-companion-mix");
QMenu contextMenu;
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add"), this, SLOT(mixerAdd()), tr("Ctrl+A"));
contextMenu.addAction(CompanionIcon("edit.png"), tr("&Edit"), this, SLOT(mixerOpen()), tr("Enter"));
contextMenu.addAction(CompanionIcon("fuses.png"), tr("&Toggle highlight"), this, SLOT(mixerHighlight()), tr("Ctrl+T"));
contextMenu.addAction(addAct("add.png", tr("&Add"), SLOT(mixerAdd()), tr("Ctrl+A")));
contextMenu.addAction(addAct("edit.png", tr("&Edit"), SLOT(mixerOpen()), tr("Enter")));
contextMenu.addAction(addAct("fuses.png", tr("&Toggle highlight"), SLOT(mixerHighlight()), tr("Ctrl+T")));
contextMenu.addSeparator();
contextMenu.addAction(CompanionIcon("clear.png"), tr("&Delete"), this, SLOT(mixersDelete()), tr("Delete"));
contextMenu.addAction(CompanionIcon("copy.png"), tr("&Copy"), this, SLOT(mixersCopy()), tr("Ctrl+C"));
contextMenu.addAction(CompanionIcon("cut.png"), tr("C&ut"), this, SLOT(mixersCut()), tr("Ctrl+X"));
contextMenu.addAction(CompanionIcon("paste.png"), tr("&Paste"), this, SLOT(mixersPaste()), tr("Ctrl+V"))->setEnabled(hasData);
contextMenu.addAction(CompanionIcon("duplicate.png"), tr("Du&plicate"), this, SLOT(mixersDuplicate()), tr("Ctrl+U"));
contextMenu.addAction(addAct("clear.png", tr("&Delete"), SLOT(mixersDelete()), tr("Delete")));
contextMenu.addAction(addAct("copy.png", tr("&Copy"), SLOT(mixersCopy()), tr("Ctrl+C")));
contextMenu.addAction(addAct("cut.png", tr("C&ut"), SLOT(mixersCut()), tr("Ctrl+X")));
contextMenu.addAction(addAct("paste.png", tr("&Paste"), SLOT(mixersPaste()), tr("Ctrl+V"), hasClipData));
contextMenu.addAction(addAct("duplicate.png", tr("Du&plicate"), SLOT(mixersDuplicate()), tr("Ctrl+U")));
contextMenu.addSeparator();
contextMenu.addAction(CompanionIcon("moveup.png"), tr("Move Up"), this, SLOT(moveMixUp()), tr("Ctrl+Up"));
contextMenu.addAction(CompanionIcon("movedown.png"), tr("Move Down"), this, SLOT(moveMixDown()), tr("Ctrl+Down"));
contextMenu.addAction(addAct("moveup.png", tr("Move Up"), SLOT(moveMixUp()), tr("Ctrl+Up")));
contextMenu.addAction(addAct("movedown.png", tr("Move Down"), SLOT(moveMixDown()), tr("Ctrl+Down")));
contextMenu.addSeparator();
contextMenu.addActions(mixersListWidget->actions());
+2 -4
View File
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/
#ifndef _MIXES_H_
#define _MIXES_H_
#pragma once
#include "modeledit.h"
#include "mixerslistwidget.h"
@@ -84,6 +83,5 @@ class MixesPanel : public ModelPanel
QString getMixerText(int dest, bool newChannel);
void connectItemModelEvents(const int id);
void updateItemModels();
QAction * addAct(const QString & icon, const QString & text, const char * slot, const QKeySequence & shortcut = 0, bool enabled = true);
};
#endif // _MIXES_H_