Continues migration with DDS, Common
This commit is contained in:
1 parent
9b15cee841
commit
fa48db111e
668 files changed
+111841
-2
No files matched your search
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-03-15
|
||||
#
|
||||
|
||||
|
||||
# Test
|
||||
#ADD_SUBDIRECTORY(Test) Not needed anymore + old 'api'
|
||||
|
||||
|
||||
# Library
|
||||
SET(LtsScriptTimeline_SRCS
|
||||
tools.h
|
||||
tools.cpp
|
||||
indicator.h
|
||||
indicator.cpp
|
||||
script_timeline.h
|
||||
script_timeline.cpp
|
||||
track_content_widget.h
|
||||
track_content_widget.cpp
|
||||
track_entry.h
|
||||
track_entry_painters.h
|
||||
track_entry_painters.cpp
|
||||
track_entry_previewer.h
|
||||
track_entry_previewer.cpp
|
||||
track_entry_preview_widget.h
|
||||
track_entry_preview_widget.cpp
|
||||
track_select_handler.h
|
||||
track_select_handler.cpp
|
||||
track_resize_handler.cpp
|
||||
track_resize_handler.h
|
||||
track_drag_handler.h
|
||||
track_drag_handler.cpp
|
||||
track_widget.h
|
||||
track_widget.cpp
|
||||
track_header.h
|
||||
track_header.cpp
|
||||
filter_track_widget.h
|
||||
filter_track_widget.cpp
|
||||
filter_background_widget.h
|
||||
filter_background_widget.cpp
|
||||
temporary_pointer_vector.h
|
||||
)
|
||||
|
||||
SET(LtsScriptTimeline_UICS
|
||||
Ui/indicator.ui
|
||||
Ui/script_timeline.ui
|
||||
Ui/track_widget.ui
|
||||
Ui/filter_track_widget.ui
|
||||
Ui/track_entry_preview_widget.ui
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(LtsScriptTimeline_SRCS ${LtsScriptTimeline_UICS})
|
||||
|
||||
NGL_ADD_LIBRARY2(WS LtsScriptTimeline SHARED ${LtsScriptTimeline_SRCS} ${LtsScriptTimeline_UICS})
|
||||
|
||||
NGL_TARGET_INCLUDE_DIRECTORIES(LtsScriptTimeline
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../
|
||||
)
|
||||
|
||||
NGL_TARGET_LINK_LIBRARIES(LtsScriptTimeline
|
||||
Qt5::Core
|
||||
Qt5::Widgets
|
||||
LtsWidgets
|
||||
LtsSessionData
|
||||
)
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
#
|
||||
# $Id$
|
||||
# $HeadURL$
|
||||
# $Author$
|
||||
#
|
||||
# Created by Mike Wille, SLSE, 2017-03-15
|
||||
#
|
||||
|
||||
# Test-Executable
|
||||
|
||||
SET(LtsScriptTimelineTest_SRCS
|
||||
main.cpp
|
||||
mainwindow.h
|
||||
mainwindow.cpp
|
||||
)
|
||||
|
||||
SET(LtsScriptTimelineTest_UICS
|
||||
mainwindow.ui
|
||||
)
|
||||
|
||||
NGL_WRAP_UI(LtsScriptTimelineTest_SRCS ${LtsScriptTimelineTest_UICS})
|
||||
|
||||
NGL_ADD_EXECUTABLE(TOOLSWS LtsScriptTimelineTest ${LtsScriptTimelineTest_SRCS})
|
||||
NGL_TARGET_LINK_LIBRARIES(LtsScriptTimelineTest LtsScriptTimeline)
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#include "mainwindow.h"
|
||||
#include <QApplication>
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
MainWindow w;
|
||||
w.show();
|
||||
|
||||
return a.exec();
|
||||
}
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <LtsScriptTimeline/track_entry.h>
|
||||
|
||||
#include <QLabel>
|
||||
#include <QDialog>
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::MainWindow)
|
||||
, m_selectedTe(nullptr)
|
||||
, m_currentNewTopicEditor(nullptr)
|
||||
, m_currentEditTopicEditor(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->masterSplitter->setStretchFactor(ui->masterSplitter->indexOf(ui->masterSplitter), 20);
|
||||
ui->masterSplitter->setStretchFactor(ui->masterSplitter->indexOf(ui->toolBox), 0);
|
||||
|
||||
ui->detailSplitter->setStretchFactor(ui->masterSplitter->indexOf(ui->scriptTimeline), 20);
|
||||
ui->detailSplitter->setStretchFactor(ui->masterSplitter->indexOf(ui->detailLayout), 0);
|
||||
|
||||
|
||||
connect(ui->scriptTimeline, &LtsScriptTimeline::ScriptTimeline::signalTrackEntrySelectionChanged, this, &MainWindow::slotTrackEntrySelectionChanged);
|
||||
|
||||
connect(ui->pbTopicAddAudio, &QPushButton::clicked,
|
||||
this, [this]()
|
||||
{
|
||||
LtsScriptTimeline::TrackEntry *te = new LtsScriptTimeline::TrackEntry(LtsScriptTimeline::TrackEntryType::Audio);
|
||||
te->time = -1;
|
||||
te->length = 30;
|
||||
te->topicId = 3;
|
||||
|
||||
if (m_currentNewTopicEditor)
|
||||
delete m_currentNewTopicEditor;
|
||||
|
||||
LtsScriptTimeline::AudioTopicEditor *ate = new LtsScriptTimeline::AudioTopicEditor(te);
|
||||
connect(ate, &LtsScriptTimeline::AudioTopicEditor::destroyed, this, [this]() { m_currentNewTopicEditor = nullptr; });
|
||||
m_currentNewTopicEditor = ate;
|
||||
ui->newTopicTab->layout()->addWidget(ate);
|
||||
ui->detailLayout->setCurrentWidget(ui->newTopicTab);
|
||||
});
|
||||
|
||||
|
||||
ui->scriptTimeline->addTrack(ui->scriptTimeline->newTrackName());
|
||||
|
||||
|
||||
|
||||
|
||||
qCritical() << "THIS EXAMPLE NO LONGER WORKS!";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::disconnectTrackEntry()
|
||||
{
|
||||
if (!m_selectedTe)
|
||||
return;
|
||||
|
||||
m_selectedTe = nullptr;
|
||||
|
||||
if (m_currentEditTopicEditor)
|
||||
{
|
||||
|
||||
delete m_currentEditTopicEditor;
|
||||
m_currentEditTopicEditor = nullptr;
|
||||
ui->lblNoTopicSelected->setVisible(true);
|
||||
}
|
||||
|
||||
ui->lblNoTopicSelected->setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::slotTrackEntrySelectionChanged(LtsScriptTimeline::TrackEntry *te)
|
||||
{
|
||||
qDeleteAll(ui->topicEditorTab->layout()->children());
|
||||
disconnectTrackEntry();
|
||||
|
||||
if (!te)
|
||||
return;
|
||||
|
||||
ui->lblNoTopicSelected->setVisible(false);
|
||||
|
||||
m_selectedTe = te;
|
||||
|
||||
|
||||
|
||||
|
||||
LtsScriptTimeline::AudioTopicEditor *ate = new LtsScriptTimeline::AudioTopicEditor(te);
|
||||
connect(ate, &LtsScriptTimeline::AudioTopicEditor::destroyed,
|
||||
this, [this]() { m_currentEditTopicEditor = nullptr; });
|
||||
m_currentEditTopicEditor = ate;
|
||||
ui->topicEditorTab->layout()->addWidget(ate);
|
||||
}
|
||||
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
}
|
||||
|
||||
|
||||
class MainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
private:
|
||||
Ui::MainWindow *ui;
|
||||
LtsScriptTimeline::TrackEntry *m_selectedTe;
|
||||
QWidget *m_currentNewTopicEditor;
|
||||
QWidget *m_currentEditTopicEditor;
|
||||
|
||||
void disconnectTrackEntry();
|
||||
|
||||
private slots:
|
||||
void slotTrackEntrySelectionChanged(LtsScriptTimeline::TrackEntry *te);
|
||||
};
|
||||
+564
@@ -0,0 +1,564 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1084</width>
|
||||
<height>834</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralWidget">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QSplitter" name="masterSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QSplitter" name="detailSplitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="LtsScriptTimeline::ScriptTimeline" name="scriptTimeline" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="detailLayout">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="newTopicTab">
|
||||
<attribute name="title">
|
||||
<string>New Topic</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4"/>
|
||||
</widget>
|
||||
<widget class="QWidget" name="topicEditorTab">
|
||||
<attribute name="title">
|
||||
<string>Topic Editor</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item alignment="Qt::AlignTop">
|
||||
<widget class="QLabel" name="lblNoTopicSelected">
|
||||
<property name="text">
|
||||
<string>No Topic selected.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutEditorTab">
|
||||
<attribute name="title">
|
||||
<string>Layout Editor</string>
|
||||
</attribute>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="previewGroupBox">
|
||||
<property name="palette">
|
||||
<palette>
|
||||
<active>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>212</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>113</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>212</red>
|
||||
<green>127</green>
|
||||
<blue>127</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</active>
|
||||
<inactive>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>212</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>113</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>212</red>
|
||||
<green>127</green>
|
||||
<blue>127</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</inactive>
|
||||
<disabled>
|
||||
<colorrole role="WindowText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Button">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Light">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Midlight">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>212</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Dark">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Mid">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>113</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Text">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="BrightText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>255</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ButtonText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>85</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Base">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Window">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="Shadow">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="AlternateBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>170</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipBase">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>255</red>
|
||||
<green>255</green>
|
||||
<blue>220</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
<colorrole role="ToolTipText">
|
||||
<brush brushstyle="SolidPattern">
|
||||
<color alpha="255">
|
||||
<red>0</red>
|
||||
<green>0</green>
|
||||
<blue>0</blue>
|
||||
</color>
|
||||
</brush>
|
||||
</colorrole>
|
||||
</disabled>
|
||||
</palette>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QToolBox" name="toolBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>453</width>
|
||||
<height>782</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="label">
|
||||
<string>Add Topics</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbTopicAddAudio">
|
||||
<property name="text">
|
||||
<string>Add Audio Topic</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsScriptTimeline::ScriptTimeline</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">LtsScriptTimeline/script_timeline.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+126
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FilterTrackWidget</class>
|
||||
<widget class="QWidget" name="FilterTrackWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>828</width>
|
||||
<height>43</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="left" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Filters</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbSelect">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="const" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbDelete">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LtsScriptTimeline::FilterBackgroundWidget" name="fbw" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsScriptTimeline::FilterBackgroundWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>filter_background_widget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Indicator</class>
|
||||
<widget class="QWidget" name="Indicator">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>822</width>
|
||||
<height>88</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="m_widgetTrackLabel" native="true">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string notr="true">Tracks</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="LtsScriptTimeline::TrackHeader" name="m_widgetTrackHeader" native="true"/>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsScriptTimeline::TrackHeader</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>track_header.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ScriptTimeline</class>
|
||||
<widget class="QWidget" name="ScriptTimeline">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>570</width>
|
||||
<height>397</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>8</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="trackScrollArea">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>568</width>
|
||||
<height>370</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="trackLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="LtsScriptTimeline::Indicator" name="indicator" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1">
|
||||
<item>
|
||||
<widget class="QLabel" name="lbPortrait">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">P</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="zoomSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="invertedAppearance">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="invertedControls">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="const" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbLandscape">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">L</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollBar" name="trackScrollBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="const" stdset="0">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsScriptTimeline::Indicator</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>indicator.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TrackEntryPreviewWidget</class>
|
||||
<widget class="QWidget" name="TrackEntryPreviewWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>296</width>
|
||||
<height>78</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="lblDnD">
|
||||
<property name="text">
|
||||
<string>Drag & Drop:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="lblTopicId">
|
||||
<property name="text">
|
||||
<string>[Topic id:]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="LtsScriptTimeline::TrackEntryPreviewer" name="widget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="lbTopicId">
|
||||
<property name="text">
|
||||
<string notr="true">?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblLen">
|
||||
<property name="text">
|
||||
<string>[Topic length:]</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="lbLen">
|
||||
<property name="text">
|
||||
<string>?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsScriptTimeline::TrackEntryPreviewer</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">LtsScriptTimeline/track_entry_previewer.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+245
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>TrackWidget</class>
|
||||
<widget class="QWidget" name="TrackWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>925</width>
|
||||
<height>120</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="mainWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="mainLeft" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkSelect">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblTrackName">
|
||||
<property name="text">
|
||||
<string>Name of Track:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="leName">
|
||||
<property name="maxLength">
|
||||
<number>128</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbEditName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbApply">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbCancel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbExpand">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>More</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbAddFilter">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Add filter track</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>+</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="LtsScriptTimeline::TrackContentWidget" name="mainTrack" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Maximum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="filtersWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>LtsScriptTimeline::TrackContentWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>track_content_widget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
+190
@@ -0,0 +1,190 @@
|
||||
#include "filter_background_widget.h"
|
||||
#include "track_content_widget.h"
|
||||
#include "tools.h"
|
||||
#include "track_entry.h"
|
||||
#include "script_timeline.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
FilterBackgroundWidget::FilterBackgroundWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_readonly(false)
|
||||
, m_scriptTimeline(nullptr)
|
||||
, m_tools(nullptr)
|
||||
, m_trackWidget(nullptr)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::setReadonly(bool readonly)
|
||||
{
|
||||
m_readonly = readonly;
|
||||
|
||||
for (auto i = m_filterContentWidgets.begin(); i != m_filterContentWidgets.end(); ++i)
|
||||
{
|
||||
TrackContentWidget *tcw = *i;
|
||||
tcw->setReadonly(readonly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
(void)event;
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
painter.save();
|
||||
|
||||
painter.setBrush(QColor("lightgray"));
|
||||
painter.drawRect(rect());
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::setTools(Tools *tools)
|
||||
{
|
||||
m_tools = tools;
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::adjustFilterContentWidgets(const TrackEntry *te)
|
||||
{
|
||||
TrackContentWidget *tcw = m_filterContentWidgets.value(te->m_topicId, nullptr);
|
||||
|
||||
if (tcw == nullptr)
|
||||
{
|
||||
trackEntryAdded(te);
|
||||
return;
|
||||
}
|
||||
|
||||
QRect currentGeo = tcw->geometry();
|
||||
int currentX = currentGeo.x();
|
||||
int currentWidth = currentGeo.width();
|
||||
|
||||
|
||||
|
||||
int x = m_tools->getPos(te->m_startTime);
|
||||
int width = m_tools->getLength(te->m_startTime, te->m_length);
|
||||
|
||||
if (currentX != x || currentWidth != width)
|
||||
{
|
||||
|
||||
tcw->setGeometry(x, currentGeo.y(), width, currentGeo.height());
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::slotChangesMade()
|
||||
{
|
||||
QObject *tcwObj = sender();
|
||||
TrackContentWidget *tcw = qobject_cast<TrackContentWidget *>(tcwObj);
|
||||
|
||||
if (tcw == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int topicId = m_filterContentWidgets.key(tcw, -1);
|
||||
|
||||
if (topicId == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
emit signalChangesMade(topicId);
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::trackEntryDeleted(const int topicId)
|
||||
{
|
||||
auto fcwI = m_filterContentWidgets.find(topicId);
|
||||
|
||||
if (fcwI != m_filterContentWidgets.end())
|
||||
{
|
||||
TrackContentWidget *tcw = *fcwI;
|
||||
m_filterContentWidgets.erase(fcwI);
|
||||
tcw->deleteLater();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::addFilterEntry(TrackEntry *main, TrackEntry *filter)
|
||||
{
|
||||
auto fcwI = m_filterContentWidgets.find(main->m_topicId);
|
||||
|
||||
if (fcwI != m_filterContentWidgets.end())
|
||||
{
|
||||
TrackContentWidget *tcw = *fcwI;
|
||||
tcw->addTrackEntry(filter, false);
|
||||
emit tcw->signalChangesMade();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FilterBackgroundWidget::trackEntryAdded(const TrackEntry *te)
|
||||
{
|
||||
auto fcwI = m_filterContentWidgets.find(te->m_topicId);
|
||||
|
||||
if (fcwI == m_filterContentWidgets.end())
|
||||
{
|
||||
TrackContentWidget *tcw = new TrackContentWidget(this, true, m_tools, te->m_topicId);
|
||||
|
||||
tcw->setTrackWidget(m_trackWidget);
|
||||
tcw->setReadonly(m_readonly);
|
||||
tcw->setScriptTimeline(m_scriptTimeline);
|
||||
tcw->setGeometry(-1, 0, 0, height());
|
||||
tcw->show();
|
||||
|
||||
connect(tcw, &TrackContentWidget::signalChangesMade,
|
||||
this, &FilterBackgroundWidget::slotChangesMade);
|
||||
connect(tcw, &TrackContentWidget::signalUnselectAll,
|
||||
this, &FilterBackgroundWidget::signalUnselectAll);
|
||||
connect(tcw, &TrackContentWidget::signalTrackEntrySelectionChanged,
|
||||
this, &FilterBackgroundWidget::signalTrackEntrySelectionChanged);
|
||||
connect(tcw, &TrackContentWidget::signalTrackEntryDeleted,
|
||||
this, &FilterBackgroundWidget::signalTrackEntryDeleted);
|
||||
connect(tcw, &TrackContentWidget::signalEditEntry,
|
||||
this, &FilterBackgroundWidget::signalEditEntry);
|
||||
|
||||
connect(tcw, &TrackContentWidget::signalStartRubberband,
|
||||
m_scriptTimeline, &ScriptTimeline::slotStartRubberband);
|
||||
connect(tcw, &TrackContentWidget::signalModifyRubberband,
|
||||
m_scriptTimeline, &ScriptTimeline::slotModifyRubberband);
|
||||
connect(tcw, &TrackContentWidget::signalEscapeRubberband,
|
||||
m_scriptTimeline, &ScriptTimeline::slotEscapeRubberband);
|
||||
connect(tcw, &TrackContentWidget::signalStopRubberband,
|
||||
m_scriptTimeline, &ScriptTimeline::slotStopRubberband);
|
||||
connect(tcw, &TrackContentWidget::signalSelectAllGlobal,
|
||||
m_scriptTimeline, &ScriptTimeline::selectAll);
|
||||
connect(tcw, &TrackContentWidget::signalCopyTopics,
|
||||
m_scriptTimeline, &ScriptTimeline::slotCopyTopics);
|
||||
connect(tcw, &TrackContentWidget::signalPasteTopics,
|
||||
m_scriptTimeline, &ScriptTimeline::slotPasteTopics);
|
||||
connect(tcw, &TrackContentWidget::signalCutTopics,
|
||||
m_scriptTimeline, &ScriptTimeline::slotCutTopics);
|
||||
connect(tcw, &TrackContentWidget::signalDeleteSelectedTopics,
|
||||
m_scriptTimeline, &ScriptTimeline::slotDeleteSelectedTopics);
|
||||
connect(tcw, &TrackContentWidget::signalSave,
|
||||
m_scriptTimeline, &ScriptTimeline::signalSave);
|
||||
connect(tcw, &TrackContentWidget::signalMoveAll,
|
||||
m_scriptTimeline, &ScriptTimeline::slotMoveAll);
|
||||
|
||||
m_filterContentWidgets.insert(te->m_topicId, tcw);
|
||||
}
|
||||
|
||||
adjustFilterContentWidgets(te);
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
#pragma once
|
||||
|
||||
#include "track_content_widget.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
class ScriptTimeline;
|
||||
class Tools;
|
||||
|
||||
|
||||
class FilterBackgroundWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilterBackgroundWidget(QWidget *parent = nullptr);
|
||||
const QMap<int , TrackContentWidget *> &filterContentWidgets() const { return m_filterContentWidgets; }
|
||||
void adjustFilterContentWidgets(const TrackEntry *te);
|
||||
void trackEntryAdded(const TrackEntry *te);
|
||||
void trackEntryDeleted(const int topicId);
|
||||
void addFilterEntry(TrackEntry *main, TrackEntry *filter);
|
||||
void setReadonly(bool readonly);
|
||||
void setScriptTimeline(ScriptTimeline *scriptTimeline) { m_scriptTimeline = scriptTimeline; }
|
||||
void setTools(Tools *tools);
|
||||
void setTrackWidget(TrackWidget *trackWidget) { m_trackWidget = trackWidget; }
|
||||
|
||||
signals:
|
||||
void signalChangesMade(int topicId);
|
||||
void signalUnselectAll();
|
||||
void signalTrackEntrySelectionChanged(TrackEntry *te);
|
||||
void signalTrackEntryDeleted(const int topicId);
|
||||
void signalEditEntry(const int topicId);
|
||||
|
||||
private slots:
|
||||
void slotChangesMade();
|
||||
|
||||
private:
|
||||
QMap<int , TrackContentWidget *> m_filterContentWidgets;
|
||||
bool m_readonly;
|
||||
ScriptTimeline *m_scriptTimeline;
|
||||
Tools *m_tools;
|
||||
TrackWidget *m_trackWidget;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
};
|
||||
|
||||
}
|
||||
+155
@@ -0,0 +1,155 @@
|
||||
#include "filter_track_widget.h"
|
||||
#include "ui_filter_track_widget.h"
|
||||
#include "track_entry.h"
|
||||
#include "script_timeline.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
FilterTrackWidget::FilterTrackWidget(int baseWidth, bool readonly, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::FilterTrackWidget)
|
||||
, m_baseWidth(baseWidth)
|
||||
, m_readonly(readonly)
|
||||
, m_tools(nullptr)
|
||||
, m_trackWidget(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->cbSelect->hide();
|
||||
|
||||
setReadonly(readonly);
|
||||
setBaseWidth(baseWidth);
|
||||
|
||||
connect(ui->pbDelete, &QPushButton::clicked,
|
||||
this, &FilterTrackWidget::signalDeleteMe);
|
||||
|
||||
connect(ui->fbw, &FilterBackgroundWidget::signalChangesMade,
|
||||
this, &FilterTrackWidget::signalChangesMade);
|
||||
connect(ui->fbw, &FilterBackgroundWidget::signalUnselectAll,
|
||||
this, &FilterTrackWidget::signalUnselectAll);
|
||||
connect(ui->fbw, &FilterBackgroundWidget::signalTrackEntrySelectionChanged,
|
||||
this, &FilterTrackWidget::signalTrackEntrySelectionChanged);
|
||||
connect(ui->fbw, &FilterBackgroundWidget::signalEditEntry,
|
||||
this, &FilterTrackWidget::signalEditEntry);
|
||||
connect(ui->fbw, &FilterBackgroundWidget::signalTrackEntryDeleted,
|
||||
this, &FilterTrackWidget::signalTrackEntryDeleted);
|
||||
}
|
||||
|
||||
|
||||
FilterTrackWidget::~FilterTrackWidget()
|
||||
{
|
||||
|
||||
delete ui;
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::setTrackWidget(TrackWidget *trackWidget)
|
||||
{
|
||||
m_trackWidget = trackWidget;
|
||||
ui->fbw->setTrackWidget(trackWidget);
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::setReadonly(bool readonly)
|
||||
{
|
||||
m_readonly = readonly;
|
||||
ui->pbDelete->setVisible(!readonly);
|
||||
ui->fbw->setReadonly(readonly);
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::setTools(Tools *tools)
|
||||
{
|
||||
m_tools = tools;
|
||||
ui->fbw->setTools(tools);
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::setScriptTimeline(ScriptTimeline *scriptTimeline)
|
||||
{
|
||||
m_scriptTimeline = scriptTimeline;
|
||||
ui->fbw->setScriptTimeline(m_scriptTimeline);
|
||||
}
|
||||
|
||||
|
||||
FilterBackgroundWidget *FilterTrackWidget::fbw()
|
||||
{
|
||||
return ui->fbw;
|
||||
}
|
||||
|
||||
const FilterBackgroundWidget *FilterTrackWidget::fbw() const
|
||||
{
|
||||
return ui->fbw;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void FilterTrackWidget::setBaseWidth(int width)
|
||||
{
|
||||
ui->left->setMinimumWidth(width);
|
||||
ui->left->setMaximumWidth(width);
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::addFilterEntry(TrackEntry *main, TrackEntry *filter)
|
||||
{
|
||||
filter->m_topicId = m_scriptTimeline->nextUniqueId();
|
||||
ui->fbw->addFilterEntry(main, filter);
|
||||
}
|
||||
|
||||
|
||||
bool FilterTrackWidget::isSelected() const
|
||||
{
|
||||
return (ui->cbSelect->checkState() == Qt::CheckState::Checked);
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::unselectAll()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void FilterTrackWidget::updateMe()
|
||||
{
|
||||
update();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void FilterTrackWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
QWidget::paintEvent(event);
|
||||
}
|
||||
|
||||
}
|
||||
+73
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
#include "track_entry_painters.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class FilterTrackWidget;
|
||||
}
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
class TrackContentWidget;
|
||||
class FilterBackgroundWidget;
|
||||
class ScriptTimeline;
|
||||
class Tools;
|
||||
class TrackWidget;
|
||||
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT FilterTrackWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit FilterTrackWidget(int baseWidth, bool readonly = false, QWidget *parent = nullptr);
|
||||
~FilterTrackWidget();
|
||||
|
||||
FilterBackgroundWidget *fbw();
|
||||
const FilterBackgroundWidget *fbw() const;
|
||||
|
||||
void setReadonly(bool readonly);
|
||||
void updateMe();
|
||||
void unselectAll();
|
||||
bool isSelected() const;
|
||||
QString trackName() const;
|
||||
void addFilterEntry(TrackEntry *main, TrackEntry *filter);
|
||||
void setTrackName(const QString &name);
|
||||
|
||||
void setBaseWidth(int width);
|
||||
|
||||
|
||||
void setScriptTimeline(ScriptTimeline *scriptTimeline);
|
||||
void setTools(Tools *tools);
|
||||
void setTrackWidget(TrackWidget *trackWidget);
|
||||
|
||||
private:
|
||||
Ui::FilterTrackWidget *ui;
|
||||
int m_baseWidth;
|
||||
bool m_readonly;
|
||||
ScriptTimeline *m_scriptTimeline;
|
||||
Tools *m_tools;
|
||||
TrackWidget *m_trackWidget;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
|
||||
signals:
|
||||
void signalUnselectAll();
|
||||
void signalSelectTrack();
|
||||
void signalTrackEntrySelectionChanged(TrackEntry *te);
|
||||
void signalChangesMade(int topicId);
|
||||
void signalDeleteMe();
|
||||
void signalEditEntry(const int topicId);
|
||||
void signalTrackEntryDeleted(const int topicId);
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+82
@@ -0,0 +1,82 @@
|
||||
#include "indicator.h"
|
||||
#include "ui_indicator.h"
|
||||
#include <QTimer>
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
Indicator::Indicator(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::Indicator)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
connect(ui->splitter, &QSplitter::splitterMoved,
|
||||
this, &Indicator::slotSplitterMoved);
|
||||
|
||||
connect(ui->m_widgetTrackHeader, &TrackHeader::signalHeaderIndicatorTimeChanged,
|
||||
this, &Indicator::signalHeaderIndicatorTimeChanged);
|
||||
connect(ui->m_widgetTrackHeader, &TrackHeader::signalHeaderIndicatorTimeUserChanged,
|
||||
this, &Indicator::signalHeaderIndicatorTimeUserChanged);
|
||||
|
||||
QList<int> sizes;
|
||||
sizes << 100 << 900;
|
||||
ui->splitter->setSizes(sizes);
|
||||
|
||||
QTimer::singleShot(500, this, [this]()
|
||||
{
|
||||
slotSplitterMoved();
|
||||
emit signalHeaderIndicatorTimeUserChanged(ui->m_widgetTrackHeader->indicatorTime());
|
||||
ui->m_widgetTrackHeader->recreatePositionLabels();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Indicator::~Indicator()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void Indicator::setTools(Tools *tools)
|
||||
{
|
||||
ui->m_widgetTrackHeader->setTools(tools);
|
||||
}
|
||||
|
||||
|
||||
void Indicator::lockIndicator(bool lock)
|
||||
{
|
||||
ui->m_widgetTrackHeader->lockIndicator(lock);
|
||||
}
|
||||
|
||||
|
||||
void Indicator::setIndicatorTime(int time)
|
||||
{
|
||||
ui->m_widgetTrackHeader->setIndicatorTime(time);
|
||||
}
|
||||
|
||||
|
||||
void Indicator::updateMe()
|
||||
{
|
||||
ui->m_widgetTrackHeader->updateMe();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void Indicator::resizeEvent(QResizeEvent *)
|
||||
{
|
||||
slotSplitterMoved();
|
||||
}
|
||||
|
||||
|
||||
void Indicator::slotSplitterMoved()
|
||||
{
|
||||
int newSize = ui->m_widgetTrackLabel->width() + ui->splitter->handleWidth();
|
||||
|
||||
if (newSize < 0)
|
||||
newSize = 0;
|
||||
|
||||
emit signalHandleResized(newSize);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class Indicator;
|
||||
}
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class Tools;
|
||||
|
||||
class Indicator : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Indicator(QWidget *parent = nullptr);
|
||||
~Indicator();
|
||||
|
||||
void updateMe();
|
||||
void setIndicatorTime(int time);
|
||||
void lockIndicator(bool lock = true);
|
||||
void setTools(Tools *tools);
|
||||
|
||||
private:
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
||||
Ui::Indicator *ui;
|
||||
|
||||
signals:
|
||||
void signalHandleResized(int width);
|
||||
void signalHeaderIndicatorTimeChanged(int time);
|
||||
void signalHeaderIndicatorTimeUserChanged(int time);
|
||||
|
||||
private slots:
|
||||
void slotSplitterMoved();
|
||||
};
|
||||
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
+1202
File diff suppressed because it is too large.
Load diff
+125
@@ -0,0 +1,125 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
#include "track_entry_painters.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QKeyEvent>
|
||||
#include <QPointer>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class ScriptTimeline;
|
||||
}
|
||||
|
||||
|
||||
class QRubberBand;
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackContentWidget;
|
||||
class TrackWidget;
|
||||
class TrackEntry;
|
||||
class Tools;
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT ScriptTimeline : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ScriptTimeline(QWidget *parent = nullptr);
|
||||
~ScriptTimeline();
|
||||
|
||||
TrackWidget *addTrack(const QString &name, bool filtersAllowed = true);
|
||||
void setScriptId(int scriptId) { m_scriptId = scriptId; }
|
||||
bool addTopic(TrackEntry *te);
|
||||
QString newTrackName() const;
|
||||
int nextUniqueId() { return ++m_uniqueId; }
|
||||
void setUniqueIdCounter(int uniqueId) { m_uniqueId = uniqueId; }
|
||||
QVector<TrackEntry *> getTrackEntriesWithFiltersAsEntries(bool selectedEntriesOnly = false) const;
|
||||
QMap<QString, QVector<TrackEntry *> > getTrackEntriesWithFilters(bool selectedEntriesOnly = false) const;
|
||||
QVector<TrackEntry *> getTrackEntries(bool selectedEntriesOnly = false) const;
|
||||
QVector<TrackEntry *> getSelectedEntriesWithFilterEntries() const;
|
||||
QVector<TrackEntry *> getSelectedFilterEntries() const;
|
||||
TrackEntry *getTrackEntry(int topicId);
|
||||
TrackEntry *getTrackEntryWithFiltersAsEntries(int topicId);
|
||||
void setIndicatorTime(int time);
|
||||
int getCurrentScriptEndTime();
|
||||
|
||||
void updateEverything();
|
||||
void clear();
|
||||
void setReadonly(bool readonly);
|
||||
QList<TrackWidget *> getTrackWidgets() const;
|
||||
void lockIndicator(bool lock = true);
|
||||
int getFilterTrackEntryRealTime(TrackEntry *te);
|
||||
bool checkNewLength(TrackEntry *te, int newLength);
|
||||
bool importTrackEntries(const QVector<LtsScriptTimeline::TrackEntry *> &importTes);
|
||||
|
||||
protected:
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *) override;
|
||||
void mouseReleaseEvent(QMouseEvent *) override;
|
||||
|
||||
private:
|
||||
Ui::ScriptTimeline *ui;
|
||||
int m_uniqueId;
|
||||
int m_scriptId;
|
||||
int m_baseTrackWidgetWidth;
|
||||
QVector<TrackEntry *> m_clipboard;
|
||||
|
||||
bool m_readonly;
|
||||
int m_time;
|
||||
Tools *m_tools;
|
||||
TrackContentWidget *m_mlmsMaster;
|
||||
QHash<TrackContentWidget *, bool> m_mlmsTCWStates;
|
||||
bool m_ignoreChanges;
|
||||
QHash<TrackWidget *, QByteArray> m_copyTopics;
|
||||
|
||||
struct RubberbandAction
|
||||
{
|
||||
QPoint origin;
|
||||
QPointer<QRubberBand> rubberBand;
|
||||
} m_rubberbandAction;
|
||||
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void updateAllTracks();
|
||||
|
||||
signals:
|
||||
void signalTrackEntrySelectionChanged(TrackEntry *te);
|
||||
void signalChangesMade();
|
||||
void signalHeaderIndicatorTimeChanged(int time);
|
||||
void signalHeaderIndicatorTimeUserChanged(int time);
|
||||
void signalEditEntry(const int topicId);
|
||||
void signalTrackEntryDeleted(const int topicId);
|
||||
void signalTrackEntryAdded(TrackEntry *te);
|
||||
void signalSave();
|
||||
|
||||
public slots:
|
||||
void slotUnselectAll();
|
||||
void slotEscapeRubberband();
|
||||
void slotStopRubberband();
|
||||
void slotStartRubberband(const QPoint &pos);
|
||||
void slotModifyRubberband();
|
||||
void selectAll();
|
||||
void slotCopyTopics();
|
||||
void slotCutTopics();
|
||||
void slotPasteTopics();
|
||||
void slotDeleteSelectedTopics();
|
||||
void slotMoveAll(int direction);
|
||||
void slotScroll(int incr);
|
||||
|
||||
private slots:
|
||||
void slotScrollbarValueChanged();
|
||||
void slotZoomValueChanged(int value);
|
||||
void slotDeleteTracks();
|
||||
void slotSelectTrack();
|
||||
void slotHeaderHandleResized(int newSize);
|
||||
void slotHeaderIndicatorTimeChanged(int time);
|
||||
void slotTrackEntrySelectionChanged(TrackEntry *te);
|
||||
void slotSetNewScrollBarMaximum();
|
||||
};
|
||||
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
class TemporaryPointerVector : public QVector<T>
|
||||
{
|
||||
static_assert(std::is_pointer<T>::value, "Type must be of pointer type");
|
||||
|
||||
public:
|
||||
TemporaryPointerVector() = default;
|
||||
|
||||
explicit TemporaryPointerVector(const QVector<T> &other)
|
||||
{
|
||||
discard();
|
||||
this->append(other);
|
||||
}
|
||||
|
||||
|
||||
~TemporaryPointerVector()
|
||||
{
|
||||
discard();
|
||||
}
|
||||
|
||||
|
||||
void setDiscardable(bool discardable)
|
||||
{
|
||||
m_discard = discardable;
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
bool m_discard = true;
|
||||
|
||||
|
||||
void discard()
|
||||
{
|
||||
if (m_discard)
|
||||
qDeleteAll(this->begin(), this->end());
|
||||
this->clear();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
Executable
+84
@@ -0,0 +1,84 @@
|
||||
#include "tools.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int Tools::getLength(int startTime, int duration)
|
||||
{
|
||||
return (getPos(startTime + duration) - getPos(startTime));
|
||||
}
|
||||
|
||||
|
||||
int Tools::getDuration(int duration)
|
||||
{
|
||||
double max = Tools::m_timelineLength;
|
||||
max /= Tools::m_zoomFactor;
|
||||
|
||||
int paintWidth = m_paintWidth;
|
||||
|
||||
double x = duration;
|
||||
x /= paintWidth;
|
||||
x *= max;
|
||||
|
||||
return lrint(x);
|
||||
}
|
||||
|
||||
|
||||
int Tools::getTime(int pos, bool neutral)
|
||||
{
|
||||
double visibleMax = Tools::m_timelineLength;
|
||||
visibleMax /= Tools::m_zoomFactor;
|
||||
|
||||
if (!neutral)
|
||||
visibleMax += Tools::m_scrollPos;
|
||||
|
||||
int visibleMin = 0;
|
||||
|
||||
if (!neutral)
|
||||
visibleMin = Tools::m_scrollPos;
|
||||
|
||||
double diff = visibleMax - visibleMin;
|
||||
int paintWidth = m_paintWidth;
|
||||
|
||||
double x = pos;
|
||||
x /= paintWidth;
|
||||
x *= diff;
|
||||
x += visibleMin;
|
||||
|
||||
return lrint(x);
|
||||
}
|
||||
|
||||
|
||||
int Tools::getPos(int time, bool neutral)
|
||||
{
|
||||
double visibleMax = Tools::m_timelineLength;
|
||||
visibleMax /= Tools::m_zoomFactor;
|
||||
|
||||
if (!neutral)
|
||||
visibleMax += Tools::m_scrollPos;
|
||||
|
||||
int visibleMin = 0;
|
||||
|
||||
if (!neutral)
|
||||
visibleMin = Tools::m_scrollPos;
|
||||
|
||||
double diff = visibleMax - visibleMin;
|
||||
int paintWidth = m_paintWidth;
|
||||
|
||||
double x = time;
|
||||
x -= visibleMin;
|
||||
x /= diff;
|
||||
x *= paintWidth;
|
||||
|
||||
return lrint(x);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
class Tools : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Tools(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_timelineLength(5 * 60)
|
||||
, m_zoomFactor(1)
|
||||
, m_scrollPos(0)
|
||||
, m_paintWidth(1)
|
||||
{}
|
||||
|
||||
int m_timelineLength;
|
||||
float m_zoomFactor;
|
||||
int m_scrollPos;
|
||||
int m_paintWidth;
|
||||
|
||||
int getDuration(int duration);
|
||||
int getTime(int pos, bool neutral = false);
|
||||
int getPos(int time, bool neutral = false);
|
||||
int getLength(int startTime, int duration);
|
||||
};
|
||||
|
||||
}
|
||||
+1652
File diff suppressed because it is too large.
Load diff
+186
@@ -0,0 +1,186 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
enum class TrackEntryType;
|
||||
class TrackWidget;
|
||||
class ScriptTimeline;
|
||||
class Tools;
|
||||
class DragHandler;
|
||||
class ResizeHandler;
|
||||
class SelectHandler;
|
||||
|
||||
LTSSCRIPTTIMELINE_EXPORT QDataStream &operator<<(QDataStream &ds, const TrackEntry &te);
|
||||
LTSSCRIPTTIMELINE_EXPORT QDataStream &operator>>(QDataStream &ds, TrackEntry &te);
|
||||
LTSSCRIPTTIMELINE_EXPORT bool isCollision(int start_s, int end_s, int toCompare_start_s, int toCompare_end_s);
|
||||
LTSSCRIPTTIMELINE_EXPORT bool isCollision2(int startPreview_s, int endPreview_s, const TrackEntry *pTrackEntry);
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT TrackContentWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TrackContentWidget(QWidget *parent = nullptr, bool isFilter = false, Tools *tools = nullptr, int mainTopicId = -1);
|
||||
~TrackContentWidget() override;
|
||||
|
||||
bool addTrackEntry(TrackEntry *te, bool selectTrackEntry);
|
||||
void removeTrackEntryByTopicId(TrackEntry *te);
|
||||
|
||||
void selectAll();
|
||||
void unselectAll();
|
||||
const QVector<TrackEntry *> &getTrackEntries() const { return m_entryList; }
|
||||
const QVector<TrackEntry *> &getSelectedEntries() const { return m_selected; }
|
||||
void setIndicatorTime(int time);
|
||||
void setTrackName(const QString &trackName);
|
||||
void deleteSelectedTopics();
|
||||
void selectEntry(int topicId);
|
||||
void setTopicFilterId(int id) { m_topicFilterId = id; }
|
||||
int topicFilterId() const { return m_topicFilterId; }
|
||||
void setReadonly(bool readonly);
|
||||
void addAllowedType(const TrackEntryType &tet) { m_allowedTypes.append(tet); }
|
||||
void addDisallowedType(const TrackEntryType &tet) { m_disallowedTypes.append(tet); }
|
||||
void setTrackWidget(TrackWidget *trackWidget);
|
||||
void setScriptTimeline(ScriptTimeline *scriptTimeline) { m_scriptTimeline = scriptTimeline; }
|
||||
void setTools(Tools *tools);
|
||||
void addCorrespondingTrackWidget(TrackContentWidget *pCorrespondingTrackWidget);
|
||||
static QString parallelError();
|
||||
bool isMultiLineMultiSelectionMode() const { return m_isMultiLineMultiSelectionMode; }
|
||||
void setMultiLineMultiSelectionMode(bool active) { m_isMultiLineMultiSelectionMode = active; }
|
||||
bool isDragPossible() const { return (!m_isMultiLineMultiSelectionMode || m_dragPossible); }
|
||||
void selectEntriesAtPositions(int fromPos, int toPos);
|
||||
void forceLocalUnselect();
|
||||
|
||||
static bool checkForParallelTopics(const TrackContentWidget *pTCW, const QVector<TrackEntry *> &vecPreviewTrackEntries, int dropTime_s, bool hack = false);
|
||||
static bool checkForParallelTopics(const TrackContentWidget *tcw, const QVector<TrackEntry *> &preview, int dropTime_s, QVector<TrackEntry *> &vecParallelTopics, bool ignoreSelectedTopics = false, bool hack = false);
|
||||
static bool checkForCollisions(const TrackContentWidget *tcw, const QVector<TrackEntry *> &preview, int dropTime_s,
|
||||
QVector<TrackEntry *> &vecCollisions, bool ignoreSelected = false, bool ignoreSelfCheck = false);
|
||||
static bool checkForCollisions(const TrackContentWidget *pTCW, const QVector<TrackEntry *> &vecPreviewTrackEntries, int dropTime_s);
|
||||
bool checkForCollisionsSimple(const TrackEntry &previewEntry) const;
|
||||
|
||||
QByteArray selectedItemsToData(int dragPosTime = 0, bool calculateFirstTeTime = true);
|
||||
static QByteArray itemsToData(const QVector<TrackEntry *> &items, int dragPosTime = 0, bool calculateFirstTeTime = true);
|
||||
static QVector<TrackEntry *> dataToItems(const QByteArray &data, int &offset);
|
||||
bool canPasteTopics(const QVector<TrackEntry *> &topics, int offsetTime, int pasteTime) const;
|
||||
void forcePasteTopics(const QVector<TrackEntry *> &topics, int offsetTime, int pasteTime);
|
||||
bool canMoveAll(int offset) const;
|
||||
void forceMoveAll(int offset);
|
||||
bool setDescriptionForSelected();
|
||||
|
||||
static QString mime;
|
||||
|
||||
void dragEnd();
|
||||
void setDragPossible(bool possible);
|
||||
void dragLeave();
|
||||
bool dragEnter(const QByteArray &itemData);
|
||||
bool dragMove(int pos);
|
||||
bool dragDrop(int pos);
|
||||
void clearDrag();
|
||||
int getDropPos() const;
|
||||
|
||||
TrackWidget *trackWidget() { return m_trackWidget; }
|
||||
TrackEntry *trackEntryAtPos(int x) const;
|
||||
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
TrackEntry *getTrackEntryOnPos(QPoint globalPos);
|
||||
bool allowedByType(const TrackEntry *te) const;
|
||||
TrackEntry *getParentTopicOfFilter(TrackEntry *filterTe) const;
|
||||
|
||||
int m_topicFilterId = -1;
|
||||
|
||||
friend class SelectHandler;
|
||||
SelectHandler *m_selectHandler;
|
||||
|
||||
friend class ResizeHandler;
|
||||
ResizeHandler *m_resizeHandler;
|
||||
|
||||
friend class DragHandler;
|
||||
DragHandler *m_dragHandler;
|
||||
|
||||
|
||||
void selectEntry(TrackEntry *te);
|
||||
void addFilterType(const TrackEntryType &tet);
|
||||
void unselect();
|
||||
void moveAll(int offset);
|
||||
bool handleResize(int cursorTime, bool leftButton);
|
||||
bool handleDrag(int cursorTime, bool leftButton);
|
||||
void cancelResize();
|
||||
TrackEntry *getTrackEntryAt(int clickedTime);
|
||||
void clearPreview();
|
||||
int dragPos() const { return m_dragPos; }
|
||||
|
||||
|
||||
|
||||
int m_dragOffsetTime;
|
||||
int m_dragPos;
|
||||
QVector<TrackEntry *> m_entryList;
|
||||
QVector<TrackEntry *> m_selected;
|
||||
|
||||
TrackEntry *m_mainSelected;
|
||||
QVector<TrackEntry *> m_preview;
|
||||
int m_width;
|
||||
bool m_cursorSet;
|
||||
int m_oldEntryLength;
|
||||
bool m_unselectAllImmune;
|
||||
int m_indicatorTime;
|
||||
QString m_trackName;
|
||||
QVector<TrackEntryType> m_allowedTypes;
|
||||
QVector<TrackEntryType> m_disallowedTypes;
|
||||
bool m_isFilter;
|
||||
bool m_readonly;
|
||||
TrackWidget *m_trackWidget;
|
||||
ScriptTimeline *m_scriptTimeline;
|
||||
Tools *m_tools;
|
||||
QVector<TrackContentWidget *> m_tcwCorresponding;
|
||||
bool m_isMultiLineMultiSelectionMode;
|
||||
bool m_multiLineMultiSelectionOkay;
|
||||
bool m_dragPossible;
|
||||
bool m_moveValid;
|
||||
int m_mainTopicId;
|
||||
|
||||
signals:
|
||||
void signalUnselectAll();
|
||||
void signalTrackEntrySelectionChanged(TrackEntry *);
|
||||
void signalChangesMade();
|
||||
void signalTrackEntryAdded(TrackEntry *te);
|
||||
void signalTrackEntryDeleted(const int topicId);
|
||||
void signalEditEntry(const int topicId);
|
||||
void signalMultiLineMultiSelectionFailed();
|
||||
void signalMultiLineMultiSelectionOkay();
|
||||
void signalMultiLineMultiSelectionDone(int dropPos);
|
||||
void signalMultiLineMultiSelectionStart(int dragPosTime);
|
||||
void signalMultiLineMultiSelectionMove(int x);
|
||||
void signalStartRubberband(QPoint pos);
|
||||
void signalStopRubberband();
|
||||
void signalEscapeRubberband();
|
||||
void signalModifyRubberband();
|
||||
void signalSelectAllGlobal();
|
||||
void signalCopyTopics();
|
||||
void signalPasteTopics();
|
||||
void signalCutTopics();
|
||||
void signalDeleteSelectedTopics();
|
||||
void signalSave();
|
||||
void signalMoveAll(int offset);
|
||||
void signalScroll(int incr);
|
||||
};
|
||||
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
#include "track_drag_handler.h"
|
||||
|
||||
#include "track_content_widget.h"
|
||||
#include "track_entry.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include "track_widget.h"
|
||||
#include "script_timeline.h"
|
||||
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDropEvent>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
#include <QGuiApplication>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
void DragHandler::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
if (m_tcw->isMultiLineMultiSelectionMode())
|
||||
{
|
||||
if (event->source() != m_tcw)
|
||||
{
|
||||
event->ignore();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto &tcw : qAsConst(m_tcwCorresponding))
|
||||
tcw->dragEnter(tcw->selectedItemsToData(tcw->m_tools->getTime(m_dragStartPos.x())));
|
||||
}
|
||||
}
|
||||
|
||||
m_tcw->dragEnd();
|
||||
|
||||
if (!event->mimeData()->hasFormat(TrackContentWidget::mime))
|
||||
return;
|
||||
|
||||
if (m_tcw->dragEnter(event->mimeData()->data(TrackContentWidget::mime)))
|
||||
event->acceptProposedAction();
|
||||
}
|
||||
|
||||
|
||||
void DragHandler::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
{
|
||||
if (m_tcw->isMultiLineMultiSelectionMode())
|
||||
{
|
||||
event->ignore();
|
||||
for (const auto &tcw : qAsConst(m_tcwCorresponding))
|
||||
tcw->dragEnd();
|
||||
}
|
||||
|
||||
m_tcw->dragEnd();
|
||||
}
|
||||
|
||||
|
||||
void DragHandler::dropEvent(QDropEvent *event)
|
||||
{
|
||||
int dropPos = event->pos().x();
|
||||
int dropTime = m_tcw->m_tools->getTime(dropPos, m_tcw->m_isFilter) - m_tcw->m_dragOffsetTime;
|
||||
|
||||
|
||||
|
||||
for (const auto &tcw : qAsConst(m_tcwCorresponding))
|
||||
{
|
||||
bool hasParallelTopicsOfSameType = TrackContentWidget::checkForParallelTopics(tcw, m_tcw->m_preview, dropTime);
|
||||
|
||||
if (hasParallelTopicsOfSameType)
|
||||
{
|
||||
new LtsWidgets::LtsMessageDialogNew(m_tcw, TrackContentWidget::parallelError(), QObject::tr("Error"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_tcw->dragDrop(dropPos))
|
||||
event->acceptProposedAction();
|
||||
else
|
||||
emit m_tcw->signalMultiLineMultiSelectionDone(0);
|
||||
}
|
||||
|
||||
|
||||
void DragHandler::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
int pos = event->pos().x();
|
||||
|
||||
if (m_tcw->dragMove(pos))
|
||||
event->acceptProposedAction();
|
||||
|
||||
|
||||
if (m_tcw->isMultiLineMultiSelectionMode())
|
||||
emit m_tcw->signalMultiLineMultiSelectionMove(pos);
|
||||
}
|
||||
|
||||
|
||||
void DragHandler::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() != Qt::LeftButton)
|
||||
return;
|
||||
m_dragStartPos = event->pos();
|
||||
}
|
||||
|
||||
|
||||
void DragHandler::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
QPoint cursorPos = m_tcw->mapFromGlobal(event->globalPos());
|
||||
|
||||
|
||||
if (!m_tcw->m_mainSelected
|
||||
|| ((cursorPos - m_dragStartPos).manhattanLength() < QApplication::startDragDistance()
|
||||
&& (m_dragStartPos - cursorPos).manhattanLength() < QApplication::startDragDistance()))
|
||||
return;
|
||||
|
||||
QVector<TrackEntry *> selected = m_tcw->getSelectedEntries();
|
||||
|
||||
if (selected.isEmpty())
|
||||
return;
|
||||
|
||||
int cursorPosTime = m_tcw->m_tools->getTime(m_dragStartPos.x());
|
||||
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
mimeData->setData(TrackContentWidget::mime, m_tcw->selectedItemsToData(cursorPosTime));
|
||||
|
||||
QDrag *drag = new QDrag(m_tcw);
|
||||
drag->setMimeData(mimeData);
|
||||
|
||||
if (m_tcw->isMultiLineMultiSelectionMode())
|
||||
emit m_tcw->signalMultiLineMultiSelectionStart(cursorPosTime);
|
||||
|
||||
QVector<TrackEntry *> selectedOld = m_tcw->m_selected;
|
||||
|
||||
if (drag->exec(Qt::MoveAction) == Qt::MoveAction)
|
||||
{
|
||||
if (!m_tcw->isMultiLineMultiSelectionMode())
|
||||
{
|
||||
|
||||
for (auto i = selectedOld.begin(); i != selectedOld.end(); ++i)
|
||||
emit m_tcw->signalTrackEntryDeleted((*i)->m_topicId);
|
||||
qDeleteAll(selectedOld);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
emit m_tcw->signalMultiLineMultiSelectionDone(-1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DragHandler::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
switch (event->key())
|
||||
{
|
||||
case Qt::Key_Left:
|
||||
{
|
||||
emit m_tcw->signalMoveAll(-1);
|
||||
break;
|
||||
}
|
||||
|
||||
case Qt::Key_Right:
|
||||
{
|
||||
emit m_tcw->signalMoveAll(1);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackContentWidget;
|
||||
class TrackEntry;
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT DragHandler
|
||||
{
|
||||
public:
|
||||
explicit DragHandler(TrackContentWidget *_tcw)
|
||||
: m_tcw(_tcw)
|
||||
, m_dropPos(-1)
|
||||
{}
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
TrackContentWidget *m_tcw;
|
||||
QVector<TrackContentWidget *> m_tcwCorresponding;
|
||||
|
||||
QPoint m_dragStartPos;
|
||||
QVector<TrackEntry *> m_vecCollisions, m_vecParallel;
|
||||
int m_dropPos;
|
||||
};
|
||||
}
|
||||
Executable
+187
@@ -0,0 +1,187 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
#include "track_entry_painters.h"
|
||||
|
||||
#include <QJsonObject>
|
||||
#include <QObject>
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT TrackEntry : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TrackEntry(const TrackEntryType &tet = TrackEntryType::INVALID)
|
||||
: QObject()
|
||||
, m_topicId(-1)
|
||||
, m_startTime(-1)
|
||||
, m_length(-1)
|
||||
, m_type(tet)
|
||||
, isSet(false)
|
||||
, index(-1)
|
||||
, x(-1)
|
||||
, y(-1)
|
||||
, h(-1)
|
||||
, w(-1)
|
||||
{}
|
||||
|
||||
explicit TrackEntry(int topicId,
|
||||
int startTime,
|
||||
int length,
|
||||
LtsScriptTimeline::TrackEntryType type,
|
||||
const QJsonObject &detailData,
|
||||
const QString &channelName,
|
||||
const QString &description)
|
||||
: QObject()
|
||||
, m_topicId(topicId)
|
||||
, m_startTime(startTime)
|
||||
, m_length(length)
|
||||
, m_type(type)
|
||||
, isSet(false)
|
||||
, index(-1)
|
||||
, x(-1)
|
||||
, y(-1)
|
||||
, h(-1)
|
||||
, w(-1)
|
||||
, m_detailData(detailData)
|
||||
, m_channelName(channelName)
|
||||
|
||||
, m_description(description)
|
||||
{}
|
||||
|
||||
|
||||
explicit TrackEntry(const TrackEntry &te)
|
||||
: QObject()
|
||||
, m_topicId(te.m_topicId)
|
||||
, m_startTime(te.m_startTime)
|
||||
, m_length(te.m_length)
|
||||
, m_type(te.m_type)
|
||||
, isSet(te.isSet)
|
||||
, index(te.index)
|
||||
, x(te.x)
|
||||
, y(te.y)
|
||||
, h(te.h)
|
||||
, w(te.w)
|
||||
, m_detailData(te.m_detailData)
|
||||
, m_channelName(te.m_channelName)
|
||||
, m_description(te.m_description)
|
||||
, m_filterParentChannel(te.m_filterParentChannel)
|
||||
{}
|
||||
|
||||
explicit TrackEntry(TrackEntry *te)
|
||||
: QObject()
|
||||
, m_topicId(te->m_topicId)
|
||||
, m_startTime(te->m_startTime)
|
||||
, m_length(te->m_length)
|
||||
, m_type(te->m_type)
|
||||
, isSet(te->isSet)
|
||||
, index(te->index)
|
||||
, x(te->x)
|
||||
, y(te->y)
|
||||
, h(te->h)
|
||||
, w(te->w)
|
||||
, m_detailData(te->m_detailData)
|
||||
, m_channelName(te->m_channelName)
|
||||
, m_description(te->m_description)
|
||||
, m_filterParentChannel(te->m_filterParentChannel)
|
||||
{}
|
||||
|
||||
TrackEntry(const TrackEntryType &tet, int length)
|
||||
: QObject()
|
||||
, m_topicId(-1)
|
||||
, m_startTime(-1)
|
||||
, m_length(length)
|
||||
, m_type(tet)
|
||||
, isSet(false)
|
||||
, index(-1)
|
||||
, x(-1)
|
||||
, y(-1)
|
||||
, h(-1)
|
||||
, w(-1)
|
||||
{}
|
||||
|
||||
~TrackEntry()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
TrackEntry &operator=(const TrackEntry &other)
|
||||
{
|
||||
this->m_topicId = other.m_topicId;
|
||||
this->m_startTime = other.m_startTime;
|
||||
this->m_length = other.m_length;
|
||||
this->m_type = other.m_type;
|
||||
this->isSet = other.isSet;
|
||||
this->index = other.index;
|
||||
this->x = other.x;
|
||||
this->y = other.y;
|
||||
this->h = other.h;
|
||||
this->w = other.w;
|
||||
this->m_detailData = other.m_detailData;
|
||||
this->m_channelName = other.m_channelName;
|
||||
this->m_filterParentChannel = other.m_filterParentChannel;
|
||||
this->m_description = other.m_description;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
int m_topicId;
|
||||
int m_startTime;
|
||||
int m_length;
|
||||
TrackEntryType m_type;
|
||||
bool isSet;
|
||||
int index;
|
||||
|
||||
|
||||
double x;
|
||||
double y;
|
||||
double h;
|
||||
double w;
|
||||
|
||||
QJsonObject m_detailData;
|
||||
QString m_channelName;
|
||||
QString m_description;
|
||||
QString m_filterParentChannel;
|
||||
|
||||
QJsonObject toJson() const
|
||||
{
|
||||
return QJsonObject({{QStringLiteral("topicId"), m_topicId},
|
||||
{QStringLiteral("startTime"), m_startTime},
|
||||
{QStringLiteral("length"), m_length},
|
||||
{QStringLiteral("type"), static_cast<int>(m_type)},
|
||||
{QStringLiteral("isSet"), isSet},
|
||||
{QStringLiteral("index"), index},
|
||||
{QStringLiteral("x"), x},
|
||||
{QStringLiteral("y"), y},
|
||||
{QStringLiteral("w"), w},
|
||||
{QStringLiteral("h"), h},
|
||||
{QStringLiteral("detailData"), m_detailData},
|
||||
{QStringLiteral("channelName"), m_channelName},
|
||||
{QStringLiteral("description"), m_description},
|
||||
{QStringLiteral("filterParentChannel"), m_filterParentChannel}
|
||||
});
|
||||
}
|
||||
|
||||
void fromJson(const QJsonObject &obj)
|
||||
{
|
||||
m_topicId = obj[QStringLiteral("topicId")].toInt();
|
||||
m_startTime = obj[QStringLiteral("startTime")].toInt(-1);
|
||||
m_length = obj[QStringLiteral("length")].toInt(-1);
|
||||
m_type = static_cast<TrackEntryType>(obj[QStringLiteral("type")].toInt());
|
||||
isSet = obj[QStringLiteral("isSet")].toBool();
|
||||
index = obj[QStringLiteral("index")].toInt();
|
||||
x = obj[QStringLiteral("x")].toDouble();
|
||||
y = obj[QStringLiteral("y")].toDouble();
|
||||
w = obj[QStringLiteral("w")].toDouble();
|
||||
h = obj[QStringLiteral("h")].toDouble();
|
||||
m_detailData = obj[QStringLiteral("detailData")].toObject();
|
||||
m_channelName = obj[QStringLiteral("channelName")].toString();
|
||||
m_description = obj[QStringLiteral("description")].toString();
|
||||
m_filterParentChannel = obj[QStringLiteral("filterParentChannel")].toString();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
+321
@@ -0,0 +1,321 @@
|
||||
|
||||
|
||||
|
||||
#include "track_entry_painters.h"
|
||||
#include "track_entry.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
QString translateTrackEntryType(const TrackEntryType &tet)
|
||||
{
|
||||
switch (tet)
|
||||
{
|
||||
case TrackEntryType::INVALID: return QObject::tr("<unknown>");
|
||||
case TrackEntryType::SituationMap: return QObject::tr("Map");
|
||||
case TrackEntryType::Situation: return QObject::tr("Situation");
|
||||
case TrackEntryType::SituationReplay: return QObject::tr("Replay");
|
||||
case TrackEntryType::Snapshot: return QObject::tr("Snapshot");
|
||||
case TrackEntryType::Image: return QObject::tr("Image");
|
||||
case TrackEntryType::Text: return QObject::tr("Text");
|
||||
case TrackEntryType::Pdf: return QObject::tr("Pdf");
|
||||
case TrackEntryType::Xml: return QObject::tr("Xml");
|
||||
case TrackEntryType::MSOffice: return QObject::tr("MS Office");
|
||||
case TrackEntryType::OpenOffice: return QObject::tr("Open Office");
|
||||
case TrackEntryType::Audio: return QObject::tr("Audio");
|
||||
case TrackEntryType::Video: return QObject::tr("Video");
|
||||
case TrackEntryType::Building: return QObject::tr("Building");
|
||||
case TrackEntryType::Evaluation: return QObject::tr("Evaluation");
|
||||
case TrackEntryType::Report: return QObject::tr("Report");
|
||||
|
||||
|
||||
case TrackEntryType::TacticalPlan: return QObject::tr("Tactical Plan Map Filter");
|
||||
case TrackEntryType::SituationMapFilter: return QObject::tr("Map Filter");
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
QString trackEntryTypeName(const TrackEntryType &tet)
|
||||
{
|
||||
switch (tet)
|
||||
{
|
||||
case TrackEntryType::INVALID: return QStringLiteral("<unknown>");
|
||||
case TrackEntryType::SituationMap: return QStringLiteral("SituationMap");
|
||||
case TrackEntryType::Situation: return QStringLiteral("SituationReplayAndMap");
|
||||
case TrackEntryType::SituationReplay: return QStringLiteral("SituationReplay");
|
||||
case TrackEntryType::Image: return QStringLiteral("Image");
|
||||
case TrackEntryType::Text: return QStringLiteral("Text");
|
||||
case TrackEntryType::Pdf: return QStringLiteral("Pdf");
|
||||
case TrackEntryType::Xml: return QStringLiteral("Xml");
|
||||
case TrackEntryType::TacticalPlan: return QStringLiteral("TacticalPlan");
|
||||
case TrackEntryType::MSOffice: return QStringLiteral("MSOffice");
|
||||
case TrackEntryType::OpenOffice: return QStringLiteral("OpenOffice");
|
||||
case TrackEntryType::Audio: return QStringLiteral("Audio");
|
||||
case TrackEntryType::Video: return QStringLiteral("Video");
|
||||
case TrackEntryType::Building: return QStringLiteral("Building");
|
||||
case TrackEntryType::SituationMapFilter: return QStringLiteral("SituationMapFilter");
|
||||
case TrackEntryType::Snapshot: return QStringLiteral("Snapshot");
|
||||
case TrackEntryType::Evaluation: return QStringLiteral("Evaluation");
|
||||
case TrackEntryType::Report: return QStringLiteral("Report");
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
|
||||
QIcon appToIcon(const TrackEntryType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case LtsScriptTimeline::TrackEntryType::INVALID:
|
||||
return QIcon();
|
||||
case LtsScriptTimeline::TrackEntryType::SituationMap:
|
||||
return QIcon(QLatin1String("icon:add_situation.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Situation:
|
||||
return QIcon(QLatin1String("icon:add_situation_combined.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::SituationReplay:
|
||||
return QIcon(QLatin1String("icon:add_restart.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Image:
|
||||
return QIcon(QLatin1String("icon:create_image_topic.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Text:
|
||||
return QIcon(QLatin1String("icon:document-new-txt.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Pdf:
|
||||
return QIcon(QLatin1String("icon:create_pdf_topic.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Xml:
|
||||
return QIcon(QLatin1String("icon:document-new-xml.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::TacticalPlan:
|
||||
return QIcon(QLatin1String("icon:tactical_organization.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::MSOffice:
|
||||
return QIcon(QLatin1String("icon:ms_office.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::OpenOffice:
|
||||
return QIcon(QLatin1String("icon:documents.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Audio:
|
||||
return QIcon(QLatin1String("icon:create_lecture_topic.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Video:
|
||||
return QIcon(QLatin1String("icon:add_video_menu.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Building:
|
||||
return QIcon(QLatin1String("icon:configure_buildings.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::SituationMapFilter:
|
||||
return QIcon(QLatin1String("icon:filter_player.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Snapshot:
|
||||
return QIcon(QLatin1String("icon:create_snapshot.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Evaluation:
|
||||
return QIcon(QLatin1String("icon:add_evaluation_elements.svg"));
|
||||
case LtsScriptTimeline::TrackEntryType::Report:
|
||||
return QIcon(QLatin1String("icon:add_reports_display.svg"));
|
||||
}
|
||||
|
||||
return QIcon();
|
||||
}
|
||||
|
||||
|
||||
TrackEntryPainter *getTrackEntryPainter(const TrackEntryType &type)
|
||||
{
|
||||
TrackEntryPainter *trackEntryPainter = nullptr;
|
||||
static TrackEntryPainter painter;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case TrackEntryType::SituationMap:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#b1cbbb")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Situation:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#b1c1cb")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::SituationReplay:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#c94c4c")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Audio:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#034f84")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Video:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#618685")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Image:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#fefbd8")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Evaluation:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#d6cbd3")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Pdf:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#80ced6")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Text:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#92a8d1")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Xml:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#eea29a")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::TacticalPlan:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#dac292")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::MSOffice:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#f7cac9")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::OpenOffice:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#b2b2b2")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Building:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#c6bcb6")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::SituationMapFilter:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#36486b")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Snapshot:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#f18973")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
case TrackEntryType::Report:
|
||||
{
|
||||
painter = TrackEntryPainter(QColor(QStringLiteral("#feb236")), translateTrackEntryType(type));
|
||||
trackEntryPainter = static_cast<TrackEntryPainter *>(&painter);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
{
|
||||
qWarning() << "no painter found for type" << (int)type;
|
||||
trackEntryPainter = nullptr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return trackEntryPainter;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void drawTrackEntry(TrackEntry *te, QPainter &painter, const QRect &trackRect, bool isSelected, bool isEnabled)
|
||||
{
|
||||
TrackEntryPainter *trackEntryPainter = getTrackEntryPainter(te->m_type);
|
||||
|
||||
if (!trackEntryPainter)
|
||||
|
||||
return;
|
||||
|
||||
QColor trackEntryBgColor = trackEntryPainter->bgColor();
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
int r = trackEntryBgColor.red();
|
||||
int g = trackEntryBgColor.green();
|
||||
int b = trackEntryBgColor.blue();
|
||||
|
||||
trackEntryBgColor = trackEntryBgColor.lighter();
|
||||
painter.setPen(QColor(255 - r, 255 - g, 255 - b));
|
||||
}
|
||||
else if (!isEnabled)
|
||||
{
|
||||
trackEntryBgColor = QColor(200, 200, 200);
|
||||
painter.setPen(QColor("white"));
|
||||
}
|
||||
else
|
||||
painter.setPen(QColor(36, 36, 36));
|
||||
|
||||
painter.setBrush(trackEntryBgColor);
|
||||
painter.drawRect(trackRect);
|
||||
|
||||
if (trackRect.width() < 20)
|
||||
return;
|
||||
|
||||
QRect trackEntryPainterRect(trackRect.adjusted(1, 1, -1, -1));
|
||||
|
||||
painter.save();
|
||||
painter.setClipping(true);
|
||||
painter.setClipRect(trackEntryPainterRect, Qt::ReplaceClip);
|
||||
|
||||
|
||||
trackEntryPainter->paintEvent(painter, trackEntryPainterRect );
|
||||
painter.drawText(trackEntryPainterRect.adjusted(3, 16, 5000, 0), te->m_description);
|
||||
painter.restore();
|
||||
|
||||
if (trackRect.width() < 12)
|
||||
return;
|
||||
|
||||
|
||||
int trackRectEnd = trackRect.right();
|
||||
int gradientLength = 12;
|
||||
QRect gradientRect(trackRectEnd - gradientLength, 2, gradientLength, trackRect.height() - 2);
|
||||
QLinearGradient gradient(gradientRect.bottomRight(), gradientRect.bottomLeft());
|
||||
|
||||
int r = trackEntryBgColor.red();
|
||||
int g = trackEntryBgColor.green();
|
||||
int b = trackEntryBgColor.blue();
|
||||
|
||||
gradient.setColorAt(0, QColor(r, g, b, 255));
|
||||
gradient.setColorAt(1, QColor(r, g, b, 0));
|
||||
painter.fillRect(gradientRect, gradient);
|
||||
}
|
||||
|
||||
}
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
|
||||
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
|
||||
#include <QColor>
|
||||
#include <QPainter>
|
||||
#include <QRect>
|
||||
#include <QPen>
|
||||
#include <QIcon>
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
|
||||
enum class TrackEntryType
|
||||
{
|
||||
INVALID,
|
||||
SituationMap,
|
||||
SituationReplay,
|
||||
Image,
|
||||
Text,
|
||||
Pdf,
|
||||
Xml,
|
||||
TacticalPlan,
|
||||
MSOffice,
|
||||
OpenOffice,
|
||||
Audio,
|
||||
Video,
|
||||
Building,
|
||||
SituationMapFilter,
|
||||
Snapshot,
|
||||
Evaluation,
|
||||
Report,
|
||||
Situation
|
||||
};
|
||||
LTSSCRIPTTIMELINE_EXPORT QString translateTrackEntryType(const TrackEntryType &tet);
|
||||
LTSSCRIPTTIMELINE_EXPORT QString trackEntryTypeName(const TrackEntryType &tet);
|
||||
LTSSCRIPTTIMELINE_EXPORT QIcon appToIcon(const TrackEntryType type);
|
||||
inline std::ostream &operator<<(std::ostream &stream, const TrackEntryType tet)
|
||||
{
|
||||
return stream << trackEntryTypeName(tet).toStdString();
|
||||
}
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT TrackEntryPainter
|
||||
{
|
||||
public:
|
||||
explicit TrackEntryPainter(const QColor &bgColor = QColor(0, 0, 0), const QString &trackEntryType = QStringLiteral("INVALID"))
|
||||
: m_bgColor(bgColor)
|
||||
, m_trackEntryType(trackEntryType)
|
||||
{
|
||||
}
|
||||
|
||||
void paintEvent(QPainter &painter, const QRect &rect)
|
||||
{
|
||||
painter.setPen(QPen(Qt::black));
|
||||
painter.drawText(rect.adjusted(3, 0, 5000 , 0), m_trackEntryType);
|
||||
}
|
||||
|
||||
QColor bgColor() const
|
||||
{
|
||||
return m_bgColor;
|
||||
}
|
||||
|
||||
void setBgColor(const QColor &bgColor)
|
||||
{
|
||||
m_bgColor = bgColor;
|
||||
}
|
||||
|
||||
const QString &trackEntryType() const
|
||||
{
|
||||
return m_trackEntryType;
|
||||
}
|
||||
|
||||
void setTrackEntryType(const QString &trackEntryType)
|
||||
{
|
||||
m_trackEntryType = trackEntryType;
|
||||
}
|
||||
|
||||
protected:
|
||||
QColor m_bgColor;
|
||||
QString m_trackEntryType;
|
||||
};
|
||||
|
||||
void drawTrackEntry(TrackEntry *te, QPainter &painter, const QRect &trackRect, bool isSelected, bool isEnabled = true);
|
||||
TrackEntryPainter *getTrackEntryPainter(const TrackEntryType &type);
|
||||
|
||||
}
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
#include "track_entry_preview_widget.h"
|
||||
#include "ui_track_entry_preview_widget.h"
|
||||
#include "track_entry.h"
|
||||
|
||||
#include <LtsSession/lts_session_data.h>
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
|
||||
#include <QMenu>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QJsonDocument>
|
||||
#include <QTextEdit>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
TrackEntryPreviewWidget::TrackEntryPreviewWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_ui(new Ui::TrackEntryPreviewWidget)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
#ifndef LTS_DEBUG
|
||||
m_ui->lbTopicId->hide();
|
||||
m_ui->lblTopicId->hide();
|
||||
|
||||
m_ui->lbLen->hide();
|
||||
m_ui->lblLen->hide();
|
||||
#endif
|
||||
connect(m_ui->widget, &TrackEntryPreviewer::signalDelete,
|
||||
this, &TrackEntryPreviewWidget::signalDelete);
|
||||
|
||||
|
||||
connect(m_ui->widget, &TrackEntryPreviewer::signalStartDrag,
|
||||
this, &TrackEntryPreviewWidget::signalStartDrag);
|
||||
connect(m_ui->widget, &TrackEntryPreviewer::signalStopDrag,
|
||||
this, &TrackEntryPreviewWidget::signalStopDrag);
|
||||
}
|
||||
|
||||
|
||||
TrackEntryPreviewWidget::~TrackEntryPreviewWidget()
|
||||
{
|
||||
delete m_ui;
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewWidget::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
#ifndef LTS_DEBUG
|
||||
if (LtsSessionData::LtsSessionData::getInstance()->debugFlagValue(QStringLiteral("TrackEntryPreviewWidget.DebugMenu")) == QVariant(true))
|
||||
#endif
|
||||
{
|
||||
QMenu *m = new QMenu(this);
|
||||
m->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
QPoint p = mapToGlobal(m->pos());
|
||||
m->setGeometry(QRect(p, QPoint(event->x(), event->y())));
|
||||
|
||||
m->addAction(QStringLiteral("enable"), this, [this]()
|
||||
{
|
||||
setTopicEnabled(true);
|
||||
});
|
||||
|
||||
m->addAction(QStringLiteral("disable"), this, [this]()
|
||||
{
|
||||
setTopicEnabled(false);
|
||||
});
|
||||
|
||||
m->addAction(QStringLiteral("show detail data"), this, [this]()
|
||||
{
|
||||
TrackEntry *te = m_ui->widget->trackEntry();
|
||||
|
||||
if (te == nullptr)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(this, QStringLiteral("no te was set"));
|
||||
return;
|
||||
}
|
||||
|
||||
QTextEdit *ted = new QTextEdit(nullptr);
|
||||
ted->setAttribute(Qt::WA_DeleteOnClose);
|
||||
ted->setWindowTitle(QStringLiteral("Track Entry #%1 - Detail Data string").arg(te->m_topicId));
|
||||
ted->setText(QString::fromUtf8(QJsonDocument(te->m_detailData).toJson()));
|
||||
ted->setReadOnly(true);
|
||||
ted->show();
|
||||
});
|
||||
|
||||
m->show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewWidget::setTopicEnabled(bool enabled)
|
||||
{
|
||||
m_ui->widget->setEnabled(enabled);
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewWidget::setTrackEntry(TrackEntry *te)
|
||||
{
|
||||
m_ui->lblDnD->setVisible(!te->isSet);
|
||||
m_ui->widget->setVisible(!te->isSet);
|
||||
|
||||
m_ui->lbTopicId->setText(QString::number(te->m_topicId));
|
||||
m_ui->lbLen->setText(QString::number(te->m_length));
|
||||
m_ui->widget->setTrackEntry(te);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TrackEntryPreviewWidget;
|
||||
}
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT TrackEntryPreviewWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TrackEntryPreviewWidget(QWidget *parent = nullptr);
|
||||
~TrackEntryPreviewWidget();
|
||||
|
||||
|
||||
|
||||
void setTrackEntry(TrackEntry *te);
|
||||
|
||||
void setTopicEnabled(bool enabled);
|
||||
|
||||
private:
|
||||
Ui::TrackEntryPreviewWidget *m_ui;
|
||||
|
||||
void contextMenuEvent(QContextMenuEvent *event);
|
||||
|
||||
signals:
|
||||
void signalStartDrag();
|
||||
void signalStopDrag();
|
||||
void signalDelete();
|
||||
};
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
#include "track_entry_previewer.h"
|
||||
#include "track_entry.h"
|
||||
#include "track_entry_painters.h"
|
||||
#include "track_content_widget.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QDrag>
|
||||
#include <QMimeData>
|
||||
#include <QMouseEvent>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
QDataStream &operator<<(QDataStream &ds, const TrackEntry &te);
|
||||
QDataStream &operator>>(QDataStream &ds, TrackEntry &te);
|
||||
|
||||
TrackEntryPreviewer::TrackEntryPreviewer(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_te(nullptr)
|
||||
{
|
||||
|
||||
|
||||
setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
TrackEntryPreviewer::~TrackEntryPreviewer()
|
||||
{}
|
||||
|
||||
|
||||
void TrackEntryPreviewer::setTrackEntry(TrackEntry *te)
|
||||
{
|
||||
m_te = te;
|
||||
|
||||
if (m_te->isSet)
|
||||
return;
|
||||
|
||||
connect(m_te, &TrackEntry::destroyed,
|
||||
this, [this]()
|
||||
{
|
||||
m_te = nullptr;
|
||||
emit signalDelete();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewer::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
|
||||
if (!m_te || event->buttons() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
m_te->isSet = true;
|
||||
QByteArray itemData(TrackContentWidget::itemsToData({ m_te }, 0));
|
||||
m_te->isSet = false;
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData(TrackContentWidget::mime, itemData);
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setDragCursor(QPixmap(), Qt::CopyAction);
|
||||
drag->setMimeData(mimeData);
|
||||
|
||||
emit signalStartDrag();
|
||||
|
||||
if (drag->exec(Qt::CopyAction) == Qt::CopyAction)
|
||||
emit signalDelete();
|
||||
|
||||
emit signalStopDrag();
|
||||
}
|
||||
|
||||
|
||||
void TrackEntryPreviewer::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QWidget::paintEvent(event);
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
if (!m_te)
|
||||
return;
|
||||
|
||||
drawTrackEntry(m_te, painter, rect().adjusted(0, 0, -1, -1), false, isEnabled());
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
|
||||
|
||||
class TrackEntryPreviewer : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TrackEntryPreviewer(QWidget *parent = nullptr);
|
||||
~TrackEntryPreviewer();
|
||||
|
||||
|
||||
|
||||
void setTrackEntry(TrackEntry *te);
|
||||
TrackEntry *trackEntry() const { return m_te; }
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
TrackEntry *m_te;
|
||||
|
||||
signals:
|
||||
void signalDelete();
|
||||
void signalStartDrag();
|
||||
void signalStopDrag();
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
#include "track_header.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include <QPainter>
|
||||
#include <QBrush>
|
||||
#include <QPen>
|
||||
#include <QColor>
|
||||
#include <QCursor>
|
||||
#include <QMouseEvent>
|
||||
#include <QFontMetrics>
|
||||
#include <QFont>
|
||||
#include <QTime>
|
||||
#include <QApplication>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
TrackHeader::TrackHeader(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, m_indicatorTime(-1)
|
||||
, m_textMargin(12)
|
||||
, m_textSpacing(10)
|
||||
, m_indicatorLock(false)
|
||||
, m_tools(nullptr)
|
||||
{
|
||||
setCursor(Qt::IBeamCursor);
|
||||
|
||||
m_timeFormat = QStringLiteral("HH:mm:ss");
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::setTools(Tools *tools)
|
||||
{
|
||||
m_tools = tools;
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() != Qt::LeftButton)
|
||||
return;
|
||||
if (!m_indicatorLock)
|
||||
{
|
||||
setIndicatorTime(m_tools->getTime(event->localPos().x()));
|
||||
emit signalHeaderIndicatorTimeUserChanged(m_indicatorTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::setIndicatorTime(int time)
|
||||
{
|
||||
m_indicatorTime = time;
|
||||
emit signalHeaderIndicatorTimeChanged(m_indicatorTime);
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::recreatePositionLabels()
|
||||
{
|
||||
|
||||
QTime t;
|
||||
t.setHMS(23, 59, 59);
|
||||
|
||||
QFontMetrics fm(QApplication::font());
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 11, 0)
|
||||
int currentTextWidth = fm.width(t.toString());
|
||||
#else
|
||||
int currentTextWidth = fm.horizontalAdvance(t.toString());
|
||||
#endif
|
||||
|
||||
if (currentTextWidth < 1 )
|
||||
{
|
||||
qCritical() << "TrackHeader::recreatePositionLabels: invalid text size";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int currentTextWidthTime = m_tools->getDuration(currentTextWidth);
|
||||
|
||||
int time = m_tools->getDuration(m_textMargin);
|
||||
int end = (m_tools->m_timelineLength * 2) + currentTextWidthTime;
|
||||
|
||||
int paintStartTime = m_tools->getTime(0) - currentTextWidthTime;
|
||||
int paintEndTime = m_tools->getTime(width() * 2);
|
||||
int count = 0;
|
||||
|
||||
m_positionMarkers.clear();
|
||||
|
||||
|
||||
|
||||
int textSpacingTime = m_tools->getDuration(m_textSpacing);
|
||||
while (time < end && count < 5000)
|
||||
{
|
||||
|
||||
|
||||
if (time >= paintStartTime && time <= paintEndTime)
|
||||
{
|
||||
|
||||
m_positionMarkers.append(m_tools->getPos(time));
|
||||
}
|
||||
|
||||
time += currentTextWidthTime + textSpacingTime;
|
||||
count++;
|
||||
}
|
||||
|
||||
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
recreatePositionLabels();
|
||||
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::updateMe()
|
||||
{
|
||||
recreatePositionLabels();
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
void TrackHeader::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
QPainter painter(this);
|
||||
|
||||
QWidget::paintEvent(event);
|
||||
|
||||
painter.save();
|
||||
|
||||
|
||||
|
||||
painter.setPen(QGuiApplication::palette().windowText().color());
|
||||
painter.setBrush(QGuiApplication::palette().window().color());
|
||||
|
||||
painter.drawRect(rect().adjusted(0, 0, -1, -1));
|
||||
|
||||
int h = height();
|
||||
|
||||
|
||||
if (m_indicatorTime > -1 && m_indicatorTime <= m_tools->getTime(width()))
|
||||
{
|
||||
painter.setPen(QColor("cyan"));
|
||||
int indicatorPos = m_tools->getPos(m_indicatorTime);
|
||||
painter.drawLine(indicatorPos, h - (h / 4), indicatorPos, h);
|
||||
}
|
||||
|
||||
|
||||
|
||||
painter.setPen(QGuiApplication::palette().windowText().color());
|
||||
|
||||
|
||||
|
||||
for (auto i = m_positionMarkers.constBegin(); i != m_positionMarkers.constEnd(); ++i)
|
||||
{
|
||||
int pos = *i;
|
||||
|
||||
|
||||
int time = m_tools->getTime(pos);
|
||||
|
||||
|
||||
QTime t = QTime::fromMSecsSinceStartOfDay(time * 1000);
|
||||
|
||||
|
||||
QString x = t.toString(m_timeFormat);
|
||||
|
||||
|
||||
painter.drawText(pos, h / 2 , x);
|
||||
|
||||
painter.save();
|
||||
painter.setPen(QGuiApplication::palette().link().color());
|
||||
painter.drawLine(pos, (h / 2) + 2, pos, h);
|
||||
painter.restore();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
#pragma once
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class Tools;
|
||||
|
||||
class TrackHeader : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TrackHeader(QWidget *parent = nullptr);
|
||||
|
||||
|
||||
void recreatePositionLabels();
|
||||
void updateMe();
|
||||
void setIndicatorTime(int time);
|
||||
void lockIndicator(bool lock = true) { m_indicatorLock = lock; }
|
||||
void setTools(Tools *tools);
|
||||
int indicatorTime() const { return m_indicatorTime; }
|
||||
|
||||
private:
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
int m_indicatorTime;
|
||||
int m_textMargin;
|
||||
int m_textSpacing;
|
||||
QString m_timeFormat;
|
||||
QVector<int> m_positionMarkers;
|
||||
bool m_indicatorLock;
|
||||
Tools *m_tools;
|
||||
|
||||
signals:
|
||||
void signalHeaderIndicatorTimeChanged(int time);
|
||||
void signalHeaderIndicatorTimeUserChanged(qint64 time);
|
||||
};
|
||||
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
#include "track_resize_handler.h"
|
||||
#include "track_entry.h"
|
||||
#include "track_widget.h"
|
||||
#include "track_content_widget.h"
|
||||
#include "filter_track_widget.h"
|
||||
#include "filter_background_widget.h"
|
||||
|
||||
#include "tools.h"
|
||||
|
||||
#include <LtsWidgets/lts_message_dialog.h>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
void ResizeHandler::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() != Qt::LeftButton || !m_possible)
|
||||
return;
|
||||
|
||||
TrackEntry *te = m_trackContentWidget->getTrackEntryOnPos(event->globalPos());
|
||||
|
||||
if (te == nullptr)
|
||||
return;
|
||||
|
||||
m_oldLength = te->m_length;
|
||||
m_resizing = true;
|
||||
}
|
||||
|
||||
|
||||
void ResizeHandler::mouseReleaseEvent(QMouseEvent *)
|
||||
{
|
||||
m_resizing = false;
|
||||
|
||||
if (!m_trackContentWidget->m_mainSelected)
|
||||
return;
|
||||
|
||||
QVector<TrackEntry *> vecPreviewTrackEntries = {m_trackContentWidget->m_mainSelected};
|
||||
|
||||
bool msg = true;
|
||||
for (TrackContentWidget *tcw : qAsConst(m_tcwCorresponding))
|
||||
{
|
||||
if (TrackContentWidget::checkForParallelTopics(tcw, vecPreviewTrackEntries, m_trackContentWidget->m_mainSelected->m_startTime))
|
||||
{
|
||||
if (msg)
|
||||
{
|
||||
LtsWidgets::LtsMessageDialog::showMessage(m_trackContentWidget, TrackContentWidget::parallelError(), QObject::tr("Error"));
|
||||
msg = false;
|
||||
}
|
||||
m_trackContentWidget->m_mainSelected->m_length = m_oldLength;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool ResizeHandler::isCollision(int newLength) const
|
||||
{
|
||||
int startTime = m_trackContentWidget->m_mainSelected->m_startTime;
|
||||
int endTime = startTime + newLength;
|
||||
|
||||
|
||||
for (auto i = m_trackContentWidget->m_entryList.constBegin(); i != m_trackContentWidget->m_entryList.constEnd(); ++i)
|
||||
{
|
||||
const TrackEntry *trackEntry = *i;
|
||||
|
||||
if (!trackEntry || trackEntry == m_trackContentWidget->m_mainSelected)
|
||||
continue;
|
||||
|
||||
if (LtsScriptTimeline::isCollision2(startTime, endTime, trackEntry))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const QVector<FilterTrackWidget *> &filterTrackWidgets = m_trackContentWidget->trackWidget()->filterLines();
|
||||
for (const FilterTrackWidget *filterTrackWidget : qAsConst(filterTrackWidgets))
|
||||
{
|
||||
for (auto iFilterContentWidget = filterTrackWidget->fbw()->filterContentWidgets().begin(); iFilterContentWidget != filterTrackWidget->fbw()->filterContentWidgets().end(); ++iFilterContentWidget)
|
||||
{
|
||||
int filterContentWidgetTopicId = iFilterContentWidget.key();
|
||||
if (m_trackContentWidget->m_mainSelected->m_topicId != filterContentWidgetTopicId)
|
||||
continue;
|
||||
|
||||
TrackContentWidget *filterContentWidget = iFilterContentWidget.value();
|
||||
for (auto iTrackEntry = filterContentWidget->m_entryList.constBegin(); iTrackEntry != filterContentWidget->m_entryList.end(); ++iTrackEntry)
|
||||
{
|
||||
const TrackEntry *trackEntry = *iTrackEntry;
|
||||
|
||||
if (!trackEntry || trackEntry == m_trackContentWidget->m_mainSelected)
|
||||
continue;
|
||||
|
||||
if (endTime < startTime + trackEntry->m_startTime + trackEntry->m_length)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ResizeHandler::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
QPoint pos = m_trackContentWidget->mapFromGlobal(event->globalPos());
|
||||
int posX = pos.x();
|
||||
int cursorTime = m_trackContentWidget->m_tools->getTime(posX, m_trackContentWidget->m_isFilter);
|
||||
|
||||
if (m_resizing && m_trackContentWidget->m_mainSelected)
|
||||
{
|
||||
int newLength = cursorTime - m_trackContentWidget->m_mainSelected->m_startTime;
|
||||
int cursorY = pos.y();
|
||||
|
||||
if (cursorY < 0 || cursorY > m_trackContentWidget->height() || newLength < 1 || (m_mainTeLength != -1 && newLength > m_mainTeLength) || isCollision(newLength))
|
||||
{
|
||||
newLength = m_oldLength;
|
||||
m_trackContentWidget->setCursor(Qt::ForbiddenCursor);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_trackContentWidget->setCursor(m_cursor);
|
||||
}
|
||||
|
||||
m_trackContentWidget->m_mainSelected->m_length = newLength;
|
||||
m_trackContentWidget->update();
|
||||
emit m_trackContentWidget->signalChangesMade();
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
TrackEntry *te = m_trackContentWidget->getTrackEntryOnPos(event->globalPos());
|
||||
|
||||
if (m_trackContentWidget->m_isFilter)
|
||||
{
|
||||
TrackEntry *mainTe = m_trackContentWidget->getParentTopicOfFilter(te);
|
||||
|
||||
if (mainTe != nullptr)
|
||||
m_mainTeLength = mainTe->m_length;
|
||||
else
|
||||
m_mainTeLength = -1;
|
||||
}
|
||||
|
||||
|
||||
if (te && (te->m_type == LtsScriptTimeline::TrackEntryType::Audio ||
|
||||
te->m_type == LtsScriptTimeline::TrackEntryType::Video))
|
||||
{
|
||||
m_possible = false;
|
||||
m_trackContentWidget->setCursor(m_cursor = Qt::ArrowCursor);
|
||||
m_trackContentWidget->update();
|
||||
}
|
||||
else if (te && m_trackContentWidget->m_mainSelected && te == m_trackContentWidget->m_mainSelected && m_trackContentWidget->m_selected.count() == 1
|
||||
&& (cursorTime >= (m_trackContentWidget->m_mainSelected->m_startTime + m_trackContentWidget->m_mainSelected->m_length - 4)
|
||||
&& cursorTime <= (m_trackContentWidget->m_mainSelected->m_startTime + m_trackContentWidget->m_mainSelected->m_length)))
|
||||
{
|
||||
m_possible = true;
|
||||
m_trackContentWidget->setCursor(m_cursor = Qt::SizeHorCursor);
|
||||
m_trackContentWidget->update();
|
||||
}
|
||||
else if (!m_resizing)
|
||||
{
|
||||
m_possible = false;
|
||||
m_trackContentWidget->setCursor(m_cursor = Qt::ArrowCursor);
|
||||
m_trackContentWidget->update();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ResizeHandler::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (m_trackContentWidget->m_mainSelected && event->key() == Qt::Key_Escape && m_resizing)
|
||||
{
|
||||
m_trackContentWidget->m_mainSelected->m_length = m_oldLength;
|
||||
m_resizing = false;
|
||||
m_possible = false;
|
||||
m_trackContentWidget->setCursor(Qt::ArrowCursor);
|
||||
m_trackContentWidget->update();
|
||||
}
|
||||
}
|
||||
}
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
#include <LtsScriptTimeline/track_content_widget.h>
|
||||
#include <QCursor>
|
||||
|
||||
class QMouseEvent;
|
||||
class QKeyEvent;
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class LTSSCRIPTTIMELINE_EXPORT ResizeHandler
|
||||
{
|
||||
public:
|
||||
explicit ResizeHandler(TrackContentWidget *_tcw)
|
||||
: m_trackContentWidget(_tcw)
|
||||
, m_resizing(false)
|
||||
, m_possible(false)
|
||||
, m_oldLength(-1)
|
||||
, m_mainTeLength(-1)
|
||||
{}
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
bool mouseMoveEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
TrackContentWidget *m_trackContentWidget;
|
||||
QVector<TrackContentWidget *> m_tcwCorresponding;
|
||||
|
||||
bool m_resizing;
|
||||
bool m_possible;
|
||||
int m_oldLength;
|
||||
int m_mainTeLength;
|
||||
Qt::CursorShape m_cursor;
|
||||
|
||||
private:
|
||||
bool isCollision(int newLength) const;
|
||||
};
|
||||
}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
#include "track_select_handler.h"
|
||||
#include "track_content_widget.h"
|
||||
#include "track_entry.h"
|
||||
|
||||
#include "tools.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QInputDialog>
|
||||
#include <QCoreApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QMouseEvent>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
|
||||
void SelectHandler::slotSetDescription()
|
||||
{
|
||||
if (m_pressedEntry == nullptr)
|
||||
return;
|
||||
|
||||
bool ok;
|
||||
QString iniDescription = m_pressedEntry->m_description;
|
||||
QString text = QInputDialog::getText(tcw,
|
||||
tr("Operator Application"),
|
||||
tr("Topic Description:"), QLineEdit::Normal,
|
||||
iniDescription, &ok, Qt::Popup | Qt::WindowTitleHint | Qt::CustomizeWindowHint);
|
||||
if (ok)
|
||||
{
|
||||
m_pressedEntry->m_description = text;
|
||||
emit tcw->signalChangesMade();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectHandler::mouseDoubleClick(QMouseEvent *event)
|
||||
{
|
||||
if (m_pressedEntry != nullptr
|
||||
&& tcw->m_selected.count() == 1
|
||||
&& !tcw->m_isMultiLineMultiSelectionMode
|
||||
&& event->buttons() == Qt::LeftButton)
|
||||
emit tcw->signalEditEntry(m_pressedEntry->m_topicId);
|
||||
}
|
||||
|
||||
|
||||
void SelectHandler::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() == Qt::LeftButton)
|
||||
{
|
||||
m_pressedEntry = nullptr;
|
||||
|
||||
QPoint clickedPos = tcw->mapFromGlobal(event->globalPos());
|
||||
int clickedPosY = clickedPos.y();
|
||||
int clickedPosX = clickedPos.x();
|
||||
|
||||
if (clickedPosY < 0 || clickedPosY > tcw->height())
|
||||
return;
|
||||
|
||||
int clickedTime = tcw->m_tools->getTime(clickedPosX, tcw->m_isFilter);
|
||||
m_pressedEntry = tcw->getTrackEntryAt(clickedTime);
|
||||
}
|
||||
else if (event->buttons() == Qt::RightButton)
|
||||
{
|
||||
QMenu *contextMenu = new QMenu(tcw);
|
||||
contextMenu->setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
||||
|
||||
contextMenu->addSection(tr("All tracks"));
|
||||
{
|
||||
QAction *action = new QAction(tr("Set topic description"), tcw);
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
action->setIcon(QIcon(QStringLiteral("icon:document-edit.svg")));
|
||||
action->setEnabled(m_pressedEntry);
|
||||
if (!m_pressedEntry)
|
||||
action->setToolTip(tr("Right click directly on a single Topic to edit its description."));
|
||||
connect(action, &QAction::triggered, this, &SelectHandler::slotSetDescription);
|
||||
contextMenu->addAction(action);
|
||||
}
|
||||
|
||||
{
|
||||
QAction *action = new QAction(tr("Remove selected Topic(s)"), tcw);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Delete));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
action->setIcon(QIcon(QStringLiteral("icon:delete.svg")));
|
||||
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalDeleteSelectedTopics);
|
||||
contextMenu->addAction(action);
|
||||
}
|
||||
|
||||
|
||||
contextMenu->addSection(tr("Main track only"));
|
||||
|
||||
{
|
||||
QAction *action = new QAction(tr("Select all topics"), tcw);
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_A));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
action->setIcon(QIcon(QStringLiteral("icon:selection_rec.svg")));
|
||||
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalSelectAllGlobal);
|
||||
contextMenu->addAction(action);
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
QAction *action = new QAction(tr("Cut selected topic(s)"), tcw);
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
action->setIcon(QIcon(QStringLiteral("icon:edit-cut.svg")));
|
||||
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalCutTopics);
|
||||
contextMenu->addAction(action);
|
||||
}
|
||||
|
||||
{
|
||||
QAction *action = new QAction(tr("Copy selected topic(s)"), tcw);
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
action->setIcon(QIcon(QStringLiteral("icon:edit-copy.svg")));
|
||||
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalCopyTopics);
|
||||
contextMenu->addAction(action);
|
||||
}
|
||||
|
||||
{
|
||||
QAction *action = new QAction(tr("Paste topic(s) at indicator position"), tcw);
|
||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
action->setShortcutVisibleInContextMenu(true);
|
||||
#endif
|
||||
action->setIcon(QIcon(QStringLiteral("icon:edit-paste.svg")));
|
||||
connect(action, &QAction::triggered, tcw, &TrackContentWidget::signalPasteTopics);
|
||||
contextMenu->addAction(action);
|
||||
}
|
||||
|
||||
|
||||
contextMenu->popup(event->globalPos());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SelectHandler::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
QPoint clickedPos = tcw->mapFromGlobal(event->globalPos());
|
||||
int clickedPosX = clickedPos.x();
|
||||
int clickedTime = tcw->m_tools->getTime(clickedPosX, tcw->m_isFilter);
|
||||
|
||||
TrackEntry *releasedEntry = tcw->getTrackEntryAt(clickedTime);
|
||||
|
||||
if (!QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier) && (!m_pressedEntry || !releasedEntry))
|
||||
{
|
||||
emit tcw->signalUnselectAll();
|
||||
emit tcw->signalTrackEntrySelectionChanged(nullptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_pressedEntry == releasedEntry)
|
||||
tcw->selectEntry(releasedEntry);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SelectHandler::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
{
|
||||
m_pressedEntry = nullptr;
|
||||
emit tcw->signalUnselectAll();
|
||||
emit tcw->signalTrackEntrySelectionChanged(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
|
||||
|
||||
class QMouseEvent;
|
||||
class QKeyEvent;
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackContentWidget;
|
||||
class TrackEntry;
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT SelectHandler : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SelectHandler(TrackContentWidget *_tcw)
|
||||
: QObject(nullptr)
|
||||
, tcw(_tcw)
|
||||
, m_pressedEntry(nullptr)
|
||||
{}
|
||||
|
||||
void mouseDoubleClick(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
TrackContentWidget *tcw;
|
||||
TrackEntry *m_pressedEntry;
|
||||
|
||||
public slots:
|
||||
void slotSetDescription();
|
||||
};
|
||||
}
|
||||
+559
@@ -0,0 +1,559 @@
|
||||
#include "track_widget.h"
|
||||
#include "ui_track_widget.h"
|
||||
#include "track_entry.h"
|
||||
#include "filter_track_widget.h"
|
||||
#include "filter_background_widget.h"
|
||||
#include "track_content_widget.h"
|
||||
#include "tools.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonValue>
|
||||
#include <QPainter>
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QPen>
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
TrackWidget::TrackWidget(int baseWidth, bool readonly, Tools *tools, bool filtersAllowed, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::TrackWidget)
|
||||
, m_baseWidth(baseWidth)
|
||||
, m_readonly(readonly)
|
||||
, m_tools(tools)
|
||||
{
|
||||
Q_ASSERT(m_tools != nullptr);
|
||||
|
||||
ui->setupUi(this);
|
||||
ui->mainTrack->setTrackWidget(this);
|
||||
ui->mainTrack->setTools(tools);
|
||||
|
||||
ui->chkSelect->hide();
|
||||
|
||||
ui->filtersWidget->hide();
|
||||
ui->leName->hide();
|
||||
ui->pbApply->hide();
|
||||
ui->pbCancel->hide();
|
||||
|
||||
ui->pbEditName->hide();
|
||||
|
||||
if (!filtersAllowed)
|
||||
ui->pbExpand->hide();
|
||||
|
||||
ui->pbAddFilter->hide();
|
||||
|
||||
setBaseWidth(baseWidth);
|
||||
setReadonly(readonly);
|
||||
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalUnselectAll,
|
||||
this, &TrackWidget::signalUnselectAll);
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalTrackEntrySelectionChanged,
|
||||
this, &TrackWidget::signalTrackEntrySelectionChanged);
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalChangesMade,
|
||||
this, &TrackWidget::signalChangesMade);
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalChangesMade,
|
||||
this, &TrackWidget::slotMainChangesMade);
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalTrackEntryAdded,
|
||||
this, &TrackWidget::slotTrackEntryAdded);
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalTrackEntryDeleted,
|
||||
this, &TrackWidget::slotTrackEntryDeleted);
|
||||
connect(ui->mainTrack, &TrackContentWidget::signalEditEntry,
|
||||
this, &TrackWidget::signalEditEntry);
|
||||
|
||||
connect(ui->chkSelect, &QCheckBox::stateChanged,
|
||||
this, &TrackWidget::signalSelectTrack);
|
||||
connect(ui->pbExpand, &QPushButton::clicked,
|
||||
this, &TrackWidget::slotExpand);
|
||||
connect(ui->pbAddFilter, &QPushButton::clicked,
|
||||
this, &TrackWidget::slotAddFilter);
|
||||
}
|
||||
|
||||
|
||||
TrackWidget::~TrackWidget()
|
||||
{
|
||||
m_filterLines.clear();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::setReadonly(bool readonly)
|
||||
{
|
||||
m_readonly = readonly;
|
||||
ui->mainTrack->setReadonly(readonly);
|
||||
|
||||
if (readonly)
|
||||
ui->pbAddFilter->hide();
|
||||
else if (ui->filtersWidget->isVisible())
|
||||
ui->pbAddFilter->show();
|
||||
|
||||
for (auto i3 = m_filterLines.begin(); i3 != m_filterLines.end(); ++i3)
|
||||
{
|
||||
FilterTrackWidget *ftw = *i3;
|
||||
ftw->setReadonly(readonly);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::setScriptTimeline(ScriptTimeline *scriptTimeline)
|
||||
{
|
||||
m_scriptTimeline = scriptTimeline;
|
||||
ui->mainTrack->setScriptTimeline(m_scriptTimeline);
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
getTrackContentWidget()->keyPressEvent(event);
|
||||
}
|
||||
|
||||
|
||||
QVector<TrackEntry *> TrackWidget::getSelectedFilterEntries() const
|
||||
{
|
||||
QVector<TrackEntry *> result;
|
||||
const QVector<FilterTrackWidget *> &ftws = filterLines();
|
||||
|
||||
for (const FilterTrackWidget *ftw : qAsConst(ftws))
|
||||
{
|
||||
const FilterBackgroundWidget *fbw = ftw->fbw();
|
||||
const QMap<int , TrackContentWidget *> &fcws = fbw->filterContentWidgets();
|
||||
|
||||
for (auto i = fcws.constBegin(); i != fcws.constEnd(); ++i)
|
||||
{
|
||||
TrackContentWidget *tcw = i.value();
|
||||
result += tcw->getSelectedEntries();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
const QVector<TrackEntry *> &TrackWidget::getSelectedEntries() const
|
||||
{
|
||||
return ui->mainTrack->getSelectedEntries();
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::slotAddFilter()
|
||||
{
|
||||
FilterTrackWidget *ftw = new FilterTrackWidget(m_baseWidth, m_readonly);
|
||||
ftw->setTrackWidget(this);
|
||||
ftw->setTools(m_tools);
|
||||
ftw->setScriptTimeline(m_scriptTimeline);
|
||||
ui->filtersWidget->layout()->addWidget(ftw);
|
||||
m_filterLines.append(ftw);
|
||||
|
||||
connect(ftw, &FilterTrackWidget::signalChangesMade,
|
||||
this, &TrackWidget::signalChangesMade);
|
||||
|
||||
connect(ftw, &FilterTrackWidget::signalUnselectAll,
|
||||
this, &TrackWidget::signalUnselectAll);
|
||||
|
||||
connect(ftw, &FilterTrackWidget::signalTrackEntrySelectionChanged,
|
||||
this, &TrackWidget::signalTrackEntrySelectionChanged);
|
||||
|
||||
connect(ftw, &FilterTrackWidget::signalEditEntry,
|
||||
this, &TrackWidget::signalEditEntry);
|
||||
|
||||
connect(ftw, &FilterTrackWidget::signalTrackEntryDeleted,
|
||||
this, &TrackWidget::signalTrackEntryDeleted);
|
||||
|
||||
connect(ftw, &FilterTrackWidget::signalDeleteMe,
|
||||
this, [this]()
|
||||
{
|
||||
m_filterLines.removeAll(qobject_cast<FilterTrackWidget *>(sender()));
|
||||
sender()->deleteLater();
|
||||
emit signalChangesMade();
|
||||
});
|
||||
|
||||
emit signalChangesMade();
|
||||
slotMainChangesMade();
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::slotMainChangesMade()
|
||||
{
|
||||
const QVector<TrackEntry *> trackEntries = ui->mainTrack->getTrackEntries();
|
||||
|
||||
for (auto i1 = trackEntries.constBegin(); i1 != trackEntries.constEnd(); ++i1)
|
||||
{
|
||||
const TrackEntry *te = *i1;
|
||||
|
||||
for (auto i3 = m_filterLines.begin(); i3 != m_filterLines.end(); ++i3)
|
||||
{
|
||||
FilterTrackWidget *ftw = *i3;
|
||||
ftw->fbw()->adjustFilterContentWidgets(te);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::slotTrackEntryAdded(TrackEntry *te)
|
||||
{
|
||||
|
||||
|
||||
for (FilterTrackWidget *ftw : qAsConst(m_filterLines))
|
||||
ftw->fbw()->trackEntryAdded(te);
|
||||
|
||||
emit signalTrackEntryAdded(te);
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::slotTrackEntryDeleted(const int topicId)
|
||||
{
|
||||
|
||||
|
||||
for (FilterTrackWidget *ftw : qAsConst(m_filterLines))
|
||||
ftw->fbw()->trackEntryDeleted(topicId);
|
||||
|
||||
emit signalTrackEntryDeleted(topicId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void TrackWidget::slotExpand()
|
||||
{
|
||||
if (ui->filtersWidget->isVisible())
|
||||
{
|
||||
ui->pbExpand->setText(tr("More"));
|
||||
ui->pbAddFilter->hide();
|
||||
ui->filtersWidget->hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->pbExpand->setText(tr("Less"));
|
||||
|
||||
if (!m_readonly)
|
||||
ui->pbAddFilter->show();
|
||||
|
||||
ui->filtersWidget->show();
|
||||
slotMainChangesMade();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::selectEntry(int topicId)
|
||||
{
|
||||
ui->mainTrack->selectEntry(topicId);
|
||||
}
|
||||
|
||||
|
||||
int TrackWidget::getParentTopicIdOfFilter(const TrackEntry *te) const
|
||||
{
|
||||
|
||||
for (const FilterTrackWidget *ftw : m_filterLines)
|
||||
{
|
||||
const FilterBackgroundWidget *fbw = ftw->fbw();
|
||||
const QMap<int , TrackContentWidget *> &filterContentWidgets = fbw->filterContentWidgets();
|
||||
|
||||
|
||||
for (auto i = filterContentWidgets.constBegin(); i != filterContentWidgets.constEnd(); ++i)
|
||||
{
|
||||
int parentTopicId = i.key();
|
||||
const TrackContentWidget *datWidget = i.value();
|
||||
const QVector<TrackEntry *> &filterEntries = datWidget->getTrackEntries();
|
||||
|
||||
for (const TrackEntry *filterTE : filterEntries)
|
||||
{
|
||||
if (filterTE == te)
|
||||
return parentTopicId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
QVector<TrackEntry *> TrackWidget::getTrackEntriesWithFilters(bool selectedEntriesOnly) const
|
||||
{
|
||||
QVector<TrackEntry *> result;
|
||||
const QVector<TrackEntry *> trackEntryList = ui->mainTrack->getTrackEntries();
|
||||
|
||||
for (TrackEntry *te : trackEntryList)
|
||||
{
|
||||
if (selectedEntriesOnly && !ui->mainTrack->getSelectedEntries().contains(te))
|
||||
continue;
|
||||
|
||||
result += te;
|
||||
|
||||
|
||||
QJsonArray jsonFilterLines;
|
||||
|
||||
|
||||
for (const FilterTrackWidget *ftw : qAsConst(m_filterLines))
|
||||
{
|
||||
const FilterBackgroundWidget *fbw = ftw->fbw();
|
||||
const QMap<int , TrackContentWidget *> &filterContentWidgets = fbw->filterContentWidgets();
|
||||
|
||||
|
||||
const TrackContentWidget *datWidget = filterContentWidgets.value(te->m_topicId);
|
||||
|
||||
if (datWidget == nullptr)
|
||||
continue;
|
||||
|
||||
const QVector<TrackEntry *> &filterEntries = datWidget->getTrackEntries();
|
||||
|
||||
if (filterEntries.isEmpty())
|
||||
continue;
|
||||
|
||||
QJsonArray jsonFilterLine;
|
||||
for (const TrackEntry *fte : filterEntries)
|
||||
jsonFilterLine.append(fte->toJson());
|
||||
|
||||
jsonFilterLines.append(jsonFilterLine);
|
||||
}
|
||||
|
||||
te->m_detailData[QStringLiteral("Filters")] = jsonFilterLines;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
QVector<TrackEntry *> TrackWidget::getTrackEntriesFiltersAsEntries(bool selectedEntriesOnly) const
|
||||
{
|
||||
QVector<TrackEntry *> result;
|
||||
const QVector<TrackEntry *> trackEntryList = ui->mainTrack->getTrackEntries();
|
||||
|
||||
for (TrackEntry *te : trackEntryList)
|
||||
{
|
||||
if (selectedEntriesOnly && !ui->mainTrack->getSelectedEntries().contains(te))
|
||||
continue;
|
||||
|
||||
result += te;
|
||||
|
||||
|
||||
for (FilterTrackWidget *ftw : m_filterLines)
|
||||
{
|
||||
const QMap<int , TrackContentWidget *> &filterContentWidgets = ftw->fbw()->filterContentWidgets();
|
||||
|
||||
for (auto i1 = filterContentWidgets.constBegin(); i1 != filterContentWidgets.constEnd(); ++i1)
|
||||
{
|
||||
TrackContentWidget *tcw = i1.value();
|
||||
result += tcw->getTrackEntries();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
QVector<TrackEntry *> TrackWidget::getTrackEntries(bool selectedEntriesOnly) const
|
||||
{
|
||||
QVector<TrackEntry *> result;
|
||||
const QVector<TrackEntry *> trackEntryList = ui->mainTrack->getTrackEntries();
|
||||
|
||||
if (selectedEntriesOnly)
|
||||
{
|
||||
for (TrackEntry *te : trackEntryList)
|
||||
{
|
||||
if (!ui->mainTrack->getSelectedEntries().contains(te))
|
||||
continue;
|
||||
|
||||
result += te;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return trackEntryList;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::setBaseWidth(int width)
|
||||
{
|
||||
m_baseWidth = width;
|
||||
|
||||
ui->mainLeft->setMinimumWidth(width);
|
||||
ui->mainLeft->setMaximumWidth(width);
|
||||
|
||||
for (FilterTrackWidget *ftw : qAsConst(m_filterLines))
|
||||
ftw->setBaseWidth(m_baseWidth);
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::addCorrespondingTrackWidget(TrackContentWidget *pCorrespondingTrackWidget)
|
||||
{
|
||||
ui->mainTrack->addCorrespondingTrackWidget(pCorrespondingTrackWidget);
|
||||
}
|
||||
|
||||
|
||||
TrackContentWidget *TrackWidget::getTrackContentWidget() const
|
||||
{
|
||||
return ui->mainTrack;
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::setInternalName(const QString &name)
|
||||
{
|
||||
m_internalName = name;
|
||||
ui->mainTrack->setTrackName(name);
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::setTrackName(const QString &name)
|
||||
{
|
||||
ui->lblTrackName->setText(name);
|
||||
}
|
||||
|
||||
|
||||
bool TrackWidget::addTrackEntry(TrackEntry *te, bool selectTrackEntry)
|
||||
{
|
||||
if (!ui->mainTrack->addTrackEntry(te, selectTrackEntry))
|
||||
return false;
|
||||
|
||||
const QJsonObject detailData = te->m_detailData;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (detailData.isEmpty())
|
||||
{
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
const QJsonArray filterLines = detailData[QStringLiteral("Filters")].toArray();
|
||||
|
||||
|
||||
if (filterLines.isEmpty())
|
||||
return true;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int missingFilterLines = filterLines.count() - m_filterLines.count();
|
||||
|
||||
while (missingFilterLines > 0)
|
||||
{
|
||||
slotAddFilter();
|
||||
missingFilterLines--;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for (int i1 = 0; i1 != filterLines.count(); i1++)
|
||||
{
|
||||
const QJsonArray filterLine = filterLines.at(i1).toArray();
|
||||
|
||||
for (const QJsonValue &filter : filterLine)
|
||||
{
|
||||
TrackEntry *filterTe = new TrackEntry;
|
||||
filterTe->fromJson(filter.toObject());
|
||||
|
||||
|
||||
m_filterLines.at(i1)->addFilterEntry(te , filterTe);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
emit signalChangesMade();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
QString TrackWidget::trackName() const
|
||||
{
|
||||
return m_internalName;
|
||||
}
|
||||
|
||||
|
||||
bool TrackWidget::isSelected() const
|
||||
{
|
||||
return (ui->chkSelect->checkState() == Qt::CheckState::Checked);
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::unselectAll()
|
||||
{
|
||||
ui->mainTrack->unselectAll();
|
||||
|
||||
for (FilterTrackWidget *ftw : qAsConst(m_filterLines))
|
||||
{
|
||||
const auto fcw = ftw->fbw()->filterContentWidgets();
|
||||
for (TrackContentWidget *tcw : fcw)
|
||||
tcw->unselectAll();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::updateMe()
|
||||
{
|
||||
update();
|
||||
ui->mainTrack->update();
|
||||
slotMainChangesMade();
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::setIndicatorTime(int time)
|
||||
{
|
||||
ui->mainTrack->setIndicatorTime(time);
|
||||
|
||||
for (FilterTrackWidget *ftw : qAsConst(m_filterLines))
|
||||
{
|
||||
const auto filterContentWidgets = ftw->fbw()->filterContentWidgets();
|
||||
|
||||
|
||||
for (auto i1 = filterContentWidgets.begin(); i1 != filterContentWidgets.end(); ++i1)
|
||||
{
|
||||
int mainTeId = i1.key();
|
||||
int mainTeStart = 0;
|
||||
|
||||
const QVector<TrackEntry *> &tes = ui->mainTrack->getTrackEntries();
|
||||
for (const TrackEntry *te : tes)
|
||||
{
|
||||
if (te->m_topicId == mainTeId)
|
||||
{
|
||||
mainTeStart = te->m_startTime;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
TrackContentWidget *filterTcw = i1.value();
|
||||
filterTcw->setIndicatorTime(time - mainTeStart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TrackWidget::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter painter(this);
|
||||
|
||||
painter.save();
|
||||
|
||||
painter.setPen(QGuiApplication::palette().windowText().color());
|
||||
painter.setBrush(QGuiApplication::palette().window().color());
|
||||
painter.drawRect(rect());
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+89
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
#include <LtsScriptTimeline/ltsscripttimeline_export.h>
|
||||
#include "track_entry_painters.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include <functional>
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class TrackWidget;
|
||||
}
|
||||
|
||||
|
||||
namespace LtsScriptTimeline
|
||||
{
|
||||
class TrackEntry;
|
||||
class TrackContentWidget;
|
||||
class FilterTrackWidget;
|
||||
class FilterBackgroundWidget;
|
||||
class ScriptTimeline;
|
||||
class Tools;
|
||||
|
||||
|
||||
class LTSSCRIPTTIMELINE_EXPORT TrackWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TrackWidget(int baseWidth, bool readonly, Tools *tools, bool filtersAllowed, QWidget *parent = nullptr);
|
||||
~TrackWidget();
|
||||
|
||||
void setReadonly(bool readonly);
|
||||
void updateMe();
|
||||
void unselectAll();
|
||||
bool isSelected() const;
|
||||
QString trackName() const;
|
||||
bool addTrackEntry(TrackEntry *te, bool selectTrackEntry);
|
||||
void setTrackName(const QString &name);
|
||||
void addCorrespondingTrackWidget(TrackContentWidget *pCorrespondingTrackWidget);
|
||||
TrackContentWidget *getTrackContentWidget() const;
|
||||
void setBaseWidth(int width);
|
||||
void setIndicatorTime(int time);
|
||||
void selectEntry(int topicId);
|
||||
|
||||
void setInternalName(const QString &name);
|
||||
QVector<TrackEntry *> getTrackEntriesFiltersAsEntries(bool selectedEntriesOnly = false) const;
|
||||
QVector<TrackEntry *> getTrackEntriesWithFilters(bool selectedEntriesOnly = false) const;
|
||||
QVector<TrackEntry *> getTrackEntries(bool selectedEntriesOnly = false) const;
|
||||
QVector<TrackEntry *> getSelectedFilterEntries() const;
|
||||
const QVector<TrackEntry *> &getSelectedEntries() const;
|
||||
int getParentTopicIdOfFilter(const TrackEntry *te) const;
|
||||
void setScriptTimeline(ScriptTimeline *scriptTimeline);
|
||||
const QVector<FilterTrackWidget *> &filterLines() const { return m_filterLines; }
|
||||
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
|
||||
private:
|
||||
QVector<FilterTrackWidget *> m_filterLines;
|
||||
Ui::TrackWidget *ui;
|
||||
int m_baseWidth;
|
||||
QString m_internalName;
|
||||
bool m_readonly;
|
||||
ScriptTimeline *m_scriptTimeline;
|
||||
Tools *m_tools;
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private slots:
|
||||
void slotExpand();
|
||||
void slotTrackEntryAdded(TrackEntry *te);
|
||||
void slotTrackEntryDeleted(const int topicId);
|
||||
void slotMainChangesMade();
|
||||
void slotAddFilter();
|
||||
|
||||
signals:
|
||||
void signalUnselectAll();
|
||||
void signalSelectTrack();
|
||||
void signalTrackEntrySelectionChanged(TrackEntry *te);
|
||||
void signalChangesMade();
|
||||
void signalEditEntry(const int topicId);
|
||||
void signalTrackEntryDeleted(const int topicId);
|
||||
void signalTrackEntryAdded(TrackEntry *te);
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user