id
int64
0
755k
file_name
stringlengths
3
109
file_path
stringlengths
13
185
content
stringlengths
31
9.38M
size
int64
31
9.38M
language
stringclasses
1 value
extension
stringclasses
11 values
total_lines
int64
1
340k
avg_line_length
float64
2.18
149k
max_line_length
int64
7
2.22M
alphanum_fraction
float64
0
1
repo_name
stringlengths
6
65
repo_stars
int64
100
47.3k
repo_forks
int64
0
12k
repo_open_issues
int64
0
3.4k
repo_license
stringclasses
9 values
repo_extraction_date
stringclasses
92 values
exact_duplicates_redpajama
bool
2 classes
near_duplicates_redpajama
bool
2 classes
exact_duplicates_githubcode
bool
2 classes
exact_duplicates_stackv2
bool
1 class
exact_duplicates_stackv1
bool
2 classes
near_duplicates_githubcode
bool
2 classes
near_duplicates_stackv1
bool
2 classes
near_duplicates_stackv2
bool
1 class
13,375
audiolevelstask.h
mltframework_shotcut/src/models/audiolevelstask.h
/* * Copyright (c) 2013-2018 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOLEVELSTASK_H #define AUDIOLEVELSTASK_H #include "multitrackmodel.h" #include <QRunnable> #include <QPersistentModelIndex> #include <QList> #include <MltProducer.h> #include <MltProfile.h> class AudioLevelsTask : public QRunnable { public: AudioLevelsTask(Mlt::Producer &producer, QObject *object, const QModelIndex &index); virtual ~AudioLevelsTask(); static void start(Mlt::Producer &producer, QObject *object, const QModelIndex &index, bool force = false); static void closeAll(); bool operator==(AudioLevelsTask &b); protected: void run(); private: Mlt::Producer *tempProducer(); QString cacheKey(); QObject *m_object; typedef QPair<Mlt::Producer *, QPersistentModelIndex> ProducerAndIndex; QList<ProducerAndIndex> m_producers; QScopedPointer<Mlt::Producer> m_tempProducer; bool m_isCanceled; bool m_isForce; Mlt::Profile m_profile; }; #endif // AUDIOLEVELSTASK_H
1,708
C++
.h
48
32.395833
89
0.746521
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,376
metadatamodel.h
mltframework_shotcut/src/models/metadatamodel.h
/* * Copyright (c) 2014-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef METADATAMODEL_H #define METADATAMODEL_H #include <QSortFilterProxyModel> #include <QList> class QmlMetadata; class MetadataModel : public QSortFilterProxyModel { Q_OBJECT Q_ENUMS(MetadataFilter) Q_PROPERTY(MetadataFilter filter READ filter WRITE setFilter NOTIFY filterChanged) Q_PROPERTY(QString search READ search WRITE setSearch NOTIFY searchChanged) public: enum ModelRoles { NameRole = Qt::UserRole + 1, HiddenRole, FavoriteRole, ServiceRole, IsAudioRole, NeedsGpuRole, PluginTypeRole, }; enum MetadataFilter { NoFilter, FavoritesFilter, VideoFilter, AudioFilter, LinkFilter, FilterSetFilter, GPUFilter, }; enum FilterMaskBits { HiddenMaskBit = 1 << 0, clipOnlyMaskBit = 1 << 1, gpuIncompatibleMaskBit = 1 << 2, gpuAlternativeMaskBit = 1 << 3, needsGPUMaskBit = 1 << 4, linkMaskBit = 1 << 5, trackOnlyMaskBit = 1 << 6, outputOnlyMaskBit = 1 << 7, }; explicit MetadataModel(QObject *parent = 0); Q_INVOKABLE int rowCount(const QModelIndex &parent = QModelIndex()) const; int sourceRowCount(const QModelIndex &parent = QModelIndex()) const; void add(QmlMetadata *data); Q_INVOKABLE QmlMetadata *get(int row) const; QmlMetadata *getFromSource(int index) const; Q_INVOKABLE void saveFilterSet(const QString &name); Q_INVOKABLE void deleteFilterSet(const QString &name); MetadataFilter filter() const { return m_filter; } void setFilter(MetadataFilter); void updateFilterMask(bool isClipProducer, bool isChainProducer, bool isTrackProducer, bool isOutputProducer); QString search() const { return m_search; } void setSearch(const QString &search); signals: void filterChanged(); void searchChanged(); protected: bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const; private: MetadataFilter m_filter; unsigned m_filterMask; QString m_search; bool m_isClipProducer; bool m_isChainProducer; bool m_isTrackProducer; bool m_isOutputProducer; }; class InternalMetadataModel : public QAbstractListModel { public: explicit InternalMetadataModel(QObject *parent = 0) : QAbstractListModel(parent) {}; // Implement QAbstractListModel int rowCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role) const; bool setData(const QModelIndex &index, const QVariant &value, int role); QHash<int, QByteArray> roleNames() const; Qt::ItemFlags flags(const QModelIndex &index) const; // Direct access to QmlMetadata void add(QmlMetadata *data); QmlMetadata *get(int index) const; QList<QmlMetadata *> &list() { return m_list; } void remove(int index); private: typedef QList<QmlMetadata *> MetadataList; MetadataList m_list; unsigned computeFilterMask(const QmlMetadata *meta); }; #endif // METADATAMODEL_H
3,824
C++
.h
114
28.368421
90
0.710377
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,377
motiontrackermodel.h
mltframework_shotcut/src/models/motiontrackermodel.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MOTIONTRACKERMODEL_H #define MOTIONTRACKERMODEL_H #include <MltProducer.h> #include <QAbstractListModel> #include <QString> #include <QMap> #include <QList> #include <QRectF> class QmlFilter; namespace Mlt { class Service; } class MotionTrackerModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QString nameProperty READ trackerNameProperty CONSTANT) Q_PROPERTY(QString operationProperty READ trackerOperationProperty CONSTANT) public: struct TrackingItem { int frame; QRectF rect; }; explicit MotionTrackerModel(QObject *parent = nullptr); void load(Mlt::Producer *producer = nullptr, bool reset = true); QString add(const QString &name, const QString &data); void updateData(const QString &key, const QString &data); void remove(const QString &key); Q_INVOKABLE void setName(QmlFilter *filter, const QString &name); Q_INVOKABLE QString nextName() const; QString keyForRow(int row) const; QString keyForFilter(Mlt::Service *service); Q_INVOKABLE void reset(QmlFilter *filter, const QString &property, int row); QList<TrackingItem> trackingData(const QString &key) const; Q_INVOKABLE QList<QRectF> trackingData(int row) const; Q_INVOKABLE int keyframeIntervalFrames(int row) const; int rowCount(const QModelIndex &parent = QModelIndex()) const override; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; Qt::ItemFlags flags(const QModelIndex &index) const override; Q_INVOKABLE static void undo(QmlFilter *filter = nullptr, const QString &propertyName = QString()); static QString trackerNameProperty() { return QString::fromLatin1("shotcut:motionTracker.name"); } static QString trackerOperationProperty() { return QString::fromLatin1("shotcut:motionTracker.operation"); } public slots: void removeFromService(Mlt::Service *service); private: enum Roles { IdentifierRole = Qt::UserRole, TrackingDataRole = Qt::UserRole + 1 }; struct Item { QString name; QString trackingData; int intervalFrames; }; QMap<QString, Item> m_data; // key is a UUID }; #endif // MOTIONTRACKERMODEL_H
3,058
C++
.h
80
34.0125
103
0.737605
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,378
resourcemodel.h
mltframework_shotcut/src/models/resourcemodel.h
/* * Copyright (c) 2023-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RESOURCEMODEL_H #define RESOURCEMODEL_H #include <MltProducer.h> #include <QAbstractItemModel> class ResourceModel : public QAbstractItemModel { Q_OBJECT public: enum Columns { COLUMN_INFO = 0, COLUMN_NAME, COLUMN_SIZE, COLUMN_VID_DESCRIPTION, COLUMN_AUD_DESCRIPTION, COLUMN_COUNT, }; explicit ResourceModel(QObject *parent = 0); virtual ~ResourceModel(); void search(Mlt::Producer *producer); void add(Mlt::Producer *producer, const QString &location = QString()); QList<Mlt::Producer> getProducers(const QModelIndexList &indices); bool exists(const QString &hash); int producerCount(); Mlt::Producer producer(int index); // Implement QAbstractItemModel int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; private: QList<Mlt::Producer> m_producers; QMap<QString, QString> m_locations; }; #endif // RESOURCEMODEL_H
1,985
C++
.h
52
34.230769
96
0.736869
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,379
keyframesmodel.h
mltframework_shotcut/src/models/keyframesmodel.h
/* * Copyright (c) 2018-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef KEYFRAMESMODEL_H #define KEYFRAMESMODEL_H #include <QAbstractItemModel> #include <QString> #include <MltProperties.h> #include <MltAnimation.h> class QmlMetadata; class QmlFilter; class KeyframesModel : public QAbstractItemModel { Q_OBJECT public: enum InterpolationType { DiscreteInterpolation, LinearInterpolation, SmoothLooseInterpolation, SmoothNaturalInterpolation, SmoothTightInterpolation, EaseInSinusoidal, EaseOutSinusoidal, EaseInOutSinusoidal, EaseInQuadratic, EaseOutQuadratic, EaseInOutQuadratic, EaseInCubic, EaseOutCubic, EaseInOutCubic, EaseInQuartic, EaseOutQuartic, EaseInOutQuartic, EaseInQuintic, EaseOutQuintic, EaseInOutQuintic, EaseInExponential, EaseOutExponential, EaseInOutExponential, EaseInCircular, EaseOutCircular, EaseInOutCircular, EaseInBack, EaseOutBack, EaseInOutBack, EaseInElastic, EaseOutElastic, EaseInOutElastic, EaseInBounce, EaseOutBounce, EaseInOutBounce, }; Q_ENUM(InterpolationType) /// Two level model: parameters and keyframes on parameters enum Roles { NameRole = Qt::UserRole + 1, /// parameter or keyframe PropertyNameRole, /// parameter only IsCurveRole, /// parameter only MinimumValueRole, /// parameter only MaximumValueRole, /// parameter only LowestValueRole, /// parameter only HighestValueRole, /// parameter only FrameNumberRole, /// keyframe only KeyframeTypeRole, /// keyframe only PrevKeyframeTypeRole, /// keyframe only NumericValueRole, /// keyframe only MinimumFrameRole, /// keyframe only MaximumFrameRole /// keyframe only }; explicit KeyframesModel(QObject *parent = 0); virtual ~KeyframesModel(); int rowCount(const QModelIndex &parent) const; int columnCount(const QModelIndex &parent) const; QVariant data(const QModelIndex &index, int role) const; QModelIndex index(int row, int column = 0, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &index) const; QHash<int, QByteArray> roleNames() const; void load(QmlFilter *, QmlMetadata *); Q_INVOKABLE bool remove(int parameterIndex, int keyframeIndex); int previousKeyframePosition(int parameterIndex, int currentPosition); int nextKeyframePosition(int parameterIndex, int currentPosition); Q_INVOKABLE int keyframeIndex(int parameterIndex, int currentPosition); Q_INVOKABLE int parameterIndex(const QString &propertyName) const; Q_INVOKABLE bool setInterpolation(int parameterIndex, int keyframeIndex, InterpolationType type); Q_INVOKABLE void setKeyframePosition(int parameterIndex, int keyframeIndex, int position); Q_INVOKABLE void addKeyframe(int parameterIndex, double value, int position, InterpolationType type); Q_INVOKABLE void addKeyframe(int parameterIndex, int position); Q_INVOKABLE void setKeyframeValue(int parameterIndex, int keyframeIndex, double value); Q_INVOKABLE void setKeyframeValuePosition(int parameterIndex, int keyframeIndex, double value, int position); Q_INVOKABLE bool isKeyframe(int parameterIndex, int position); Q_INVOKABLE bool advancedKeyframesInUse(); Q_INVOKABLE void removeAdvancedKeyframes(); Q_INVOKABLE bool simpleKeyframesInUse(); Q_INVOKABLE void removeSimpleKeyframes(); int keyframeCount(int index) const; signals: void loaded(); void keyframeAdded(QString parameter, int position); public slots: void reload(); void onFilterChanged(const QString &property); void onFilterInChanged(int delta); void trimFilterIn(int in); void trimFilterOut(int out); private: QList<QString> m_propertyNames; QmlMetadata *m_metadata; QmlFilter *m_filter; QList<int> m_keyframeCounts; QList<int> m_metadataIndex; void updateNeighborsMinMax(int parameterIndex, int keyframeIndex); QStringList gangedProperties(int parameterIndex) const; }; #endif // KEYFRAMESMODEL_H
5,050
C++
.h
130
32.453846
101
0.718158
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,381
audiometerwidget.h
mltframework_shotcut/src/widgets/audiometerwidget.h
/* * Copyright (c) 2015 Meltytech, LLC * Author: Brian Matherly <code@brianmatherly.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOMETERWIDGET_H #define AUDIOMETERWIDGET_H #include <QWidget> #include <QVector> #include <QStringList> #include <QLinearGradient> #include <stdint.h> class QLabel; class AudioMeterWidget : public QWidget { Q_OBJECT public: AudioMeterWidget(QWidget *parent = 0); void setDbLabels(const QVector<int> &labels); void setChannelLabels(const QStringList &labels); void setChannelLabelUnits(const QString &units); void setOrientation(Qt::Orientation orientation); public slots: void showAudio(const QVector<double> &dbLevels); protected: void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void resizeEvent(QResizeEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *) Q_DECL_OVERRIDE; private: void calcGraphRect(); void drawDbLabels(QPainter &); void drawChanLabels(QPainter &); void drawBars(QPainter &); void drawPeaks(QPainter &); void updateToolTip(); QRectF m_graphRect; QSizeF m_barSize; Qt::Orientation m_orient; QVector<double> m_levels; QVector<double> m_peaks; QVector<int> m_dbLabels; QStringList m_chanLabels; QLinearGradient m_gradient; double m_maxDb; QString m_chanLabelUnits; }; #endif
1,967
C++
.h
59
30.169492
72
0.753684
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,382
noisewidget.h
mltframework_shotcut/src/widgets/noisewidget.h
/* * Copyright (c) 2012-2017 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NOISEWIDGET_H #define NOISEWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class NoiseWidget; } class NoiseWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit NoiseWidget(QWidget *parent = 0); ~NoiseWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); private: Ui::NoiseWidget *ui; }; #endif // NOISEWIDGET_H
1,187
C++
.h
36
30.638889
72
0.759405
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,384
directshowvideowidget.h
mltframework_shotcut/src/widgets/directshowvideowidget.h
/* * Copyright (c) 2014-2017 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DIRECTSHOWVIDEOWIDGET_H #define DIRECTSHOWVIDEOWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class DirectShowVideoWidget; } class DirectShowVideoWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit DirectShowVideoWidget(QWidget *parent = 0); ~DirectShowVideoWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &profile); void setProducer(Mlt::Producer *producer); signals: void producerChanged(Mlt::Producer *); private slots: void on_videoCombo_activated(int index); void on_audioCombo_activated(int index); private: Ui::DirectShowVideoWidget *ui; }; #endif // DIRECTSHOWVIDEOWIDGET_H
1,480
C++
.h
42
32.666667
75
0.773109
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,385
alsawidget.h
mltframework_shotcut/src/widgets/alsawidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ALSAWIDGET_H #define ALSAWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class AlsaWidget; } class AlsaWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit AlsaWidget(QWidget *parent = 0); ~AlsaWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &profile); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); void setProducer(Mlt::Producer *); private slots: void on_preset_selected(void *p); void on_preset_saveClicked(); void on_applyButton_clicked(); private: Ui::AlsaWidget *ui; }; #endif // ALSAWIDGET_H
1,386
C++
.h
42
30.285714
72
0.750562
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,386
exportpresetstreeview.h
mltframework_shotcut/src/widgets/exportpresetstreeview.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EXPORTPRESETSTREEVIEW_H #define EXPORTPRESETSTREEVIEW_H #include <QTreeView> class ExportPresetsTreeView : public QTreeView { public: ExportPresetsTreeView(QWidget *parent = nullptr); protected slots: void currentChanged(const QModelIndex &current, const QModelIndex &previous); }; #endif // EXPORTPRESETSTREEVIEW_H
1,029
C++
.h
27
36.111111
81
0.779559
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,387
pulseaudiowidget.h
mltframework_shotcut/src/widgets/pulseaudiowidget.h
/* * Copyright (c) 2012-2017 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PULSEAUDIOWIDGET_H #define PULSEAUDIOWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class PulseAudioWidget; } class PulseAudioWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit PulseAudioWidget(QWidget *parent = 0); ~PulseAudioWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &profile); private: Ui::PulseAudioWidget *ui; }; #endif // PULSEAUDIOWIDGET_H
1,234
C++
.h
36
31.944444
72
0.768908
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,388
countproducerwidget.h
mltframework_shotcut/src/widgets/countproducerwidget.h
/* * Copyright (c) 2016-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COUNTPRODUCERWIDGET_H #define COUNTPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class CountProducerWidget; } class CountProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit CountProducerWidget(QWidget *parent = 0); ~CountProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); void producerReopened(bool play); private slots: void on_directionCombo_activated(int index); void on_styleCombo_activated(int index); void on_soundCombo_activated(int index); void on_backgroundCombo_activated(int index); void on_dropCheckBox_clicked(bool checked); void on_durationSpinBox_editingFinished(); void on_preset_selected(void *p); void on_preset_saveClicked(); private: QString detail() const; QString currentDirection() const; QString currentStyle() const; QString currentSound() const; QString currentBackground() const; Ui::CountProducerWidget *ui; }; #endif // COUNTPRODUCERWIDGET_H
1,925
C++
.h
54
32.481481
73
0.761956
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,389
glaxnimateproducerwidget.h
mltframework_shotcut/src/widgets/glaxnimateproducerwidget.h
/* * Copyright (c) 2022-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GLAXNIMATEPRODUCERWIDGET_H #define GLAXNIMATEPRODUCERWIDGET_H #include <QWidget> #include <QPointer> #include <QLocalSocket> #include <QLocalServer> #include <QDataStream> #include <QSharedMemory> #include "sharedframe.h" #include "abstractproducerwidget.h" class GlaxnimateIpcServer : public QObject { Q_OBJECT class ParentResources { public: Mlt::Producer m_producer; std::unique_ptr<Mlt::Profile> m_profile; std::unique_ptr<Mlt::Producer> m_glaxnimateProducer; int m_frameNum = -1; void setProducer(const Mlt::Producer &producer, bool hideCurrentTrack); }; public: std::unique_ptr<ParentResources> parent; std::unique_ptr<QLocalServer> m_server; std::unique_ptr<QDataStream> m_stream; bool m_isProtocolValid = false; std::unique_ptr<QSharedMemory> m_sharedMemory; QPointer<QLocalSocket> m_socket; static GlaxnimateIpcServer &instance(); static void newFile(const QString &filename, int duration); void reset(); void launch(const Mlt::Producer &producer, QString filename = QString(), bool hideCurrentTrack = true); private slots: void onConnect(); void onReadyRead(); void onSocketError(QLocalSocket::LocalSocketError socketError); void onFrameDisplayed(const SharedFrame &frame); private: int toMltFps(float frame) const; bool copyToShared(const QImage &image); SharedFrame m_sharedFrame; }; namespace Ui { class GlaxnimateProducerWidget; } class QFileSystemWatcher; class QLocalServer; class QDataStream; class QSharedMemory; class GlaxnimateProducerWidget : public QWidget, public AbstractProducerWidget { friend GlaxnimateIpcServer; Q_OBJECT public: explicit GlaxnimateProducerWidget(QWidget *parent = 0); ~GlaxnimateProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); virtual void setProducer(Mlt::Producer *); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); void modified(); public slots: void rename(); private slots: void on_colorButton_clicked(); void on_preset_selected(void *p); void on_preset_saveClicked(); void on_lineEdit_editingFinished(); void on_notesTextEdit_textChanged(); void on_editButton_clicked(); void onFileChanged(const QString &path); void on_reloadButton_clicked(); void on_durationSpinBox_editingFinished(); private: Ui::GlaxnimateProducerWidget *ui; QString m_title; std::unique_ptr<QFileSystemWatcher> m_watcher; }; #endif // GLAXNIMATEPRODUCERWIDGET_H
3,372
C++
.h
100
29.97
79
0.75
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,390
timelinepropertieswidget.h
mltframework_shotcut/src/widgets/timelinepropertieswidget.h
/* * Copyright (c) 2015-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TIMELINEPROPERTIESWIDGET_H #define TIMELINEPROPERTIESWIDGET_H #include <QWidget> #include <MltService.h> namespace Ui { class TimelinePropertiesWidget; } class TimelinePropertiesWidget : public QWidget { Q_OBJECT public: explicit TimelinePropertiesWidget(Mlt::Service &service, QWidget *parent = 0); ~TimelinePropertiesWidget(); signals: void editProfile(); private: Ui::TimelinePropertiesWidget *ui; Mlt::Service m_service; }; #endif //TIMELINEPROPERTIESWIDGET_H
1,202
C++
.h
36
31.083333
82
0.774611
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,391
docktoolbar.h
mltframework_shotcut/src/widgets/docktoolbar.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DOCKTOOLBAR_H #define DOCKTOOLBAR_H #include <QToolBar> class DockToolBar : public QToolBar { Q_OBJECT public: explicit DockToolBar(const QString &title, QWidget *parent = nullptr); void setAreaHint(Qt::ToolBarArea area); protected: void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE; private slots: void updateStyle(); private: Qt::ToolBarArea m_area; }; #endif // DOCKTOOLBAR_H
1,113
C++
.h
33
31.333333
74
0.759553
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,392
statuslabelwidget.h
mltframework_shotcut/src/widgets/statuslabelwidget.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef STATUSLABELWIDGET_H #define STATUSLABELWIDGET_H #include <QTimer> #include <QWidget> class QHBoxLayout; class QPropertyAnimation; class QPushButton; class StatusLabelWidget : public QWidget { Q_OBJECT public: StatusLabelWidget(QWidget *parent = nullptr); virtual ~StatusLabelWidget(); void setWidth(int width); void showText(const QString &text, int timeoutSeconds = -1, QAction *action = nullptr, QPalette::ColorRole role = QPalette::ToolTipBase); signals: void statusCleared(); private: void onFadeOutFinished(); QHBoxLayout *m_layout; QPushButton *m_label; QPropertyAnimation *m_fadeIn; QPropertyAnimation *m_fadeOut; QTimer m_timer; int m_width; }; #endif // STATUSLABELWIDGET_H
1,462
C++
.h
44
30.113636
90
0.751064
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,393
resourcewidget.h
mltframework_shotcut/src/widgets/resourcewidget.h
/* * Copyright (c) 2023-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef RESOURCEWIDGET_H #define RESOURCEWIDGET_H #include <Mlt.h> #include <QWidget> class ResourceModel; class QTreeView; class ResourceWidget : public QWidget { Q_OBJECT public: ResourceWidget(QWidget *parent); virtual ~ResourceWidget(); void search(Mlt::Producer *producer); void add(Mlt::Producer *producer); void selectTroubleClips(); bool hasTroubleClips(); int producerCount(); Mlt::Producer producer(int index); QList<Mlt::Producer> getSelected(); void updateSize(); private: ResourceModel *m_model; QTreeView *m_table; }; #endif // RESOURCEWIDGET_H
1,318
C++
.h
41
29.292683
72
0.748423
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,394
playlistlistview.h
mltframework_shotcut/src/widgets/playlistlistview.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLAYLISTLISTVIEW_H #define PLAYLISTLISTVIEW_H #include <QListView> class QDropEvent; class PlaylistListView : public QListView { Q_OBJECT public: PlaylistListView(QWidget *parent = 0); void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; signals: void movedToEnd(); }; #endif // PLAYLISTLISTVIEW_H
1,077
C++
.h
31
32.419355
72
0.765385
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,395
gdigrabwidget.h
mltframework_shotcut/src/widgets/gdigrabwidget.h
/* * Copyright (c) 2015-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GDIGRABWIDGET_H #define GDIGRABWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class GDIgrabWidget; } class GDIgrabWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit GDIgrabWidget(QWidget *parent = 0); ~GDIgrabWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); void setProducer(Mlt::Producer *); private slots: void on_preset_selected(void *p); void on_preset_saveClicked(); void on_applyButton_clicked(); private: Ui::GDIgrabWidget *ui; QString URL(Mlt::Profile &) const; }; #endif // GDIGRABWIDGET_H
1,442
C++
.h
43
30.767442
72
0.751079
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,396
audioscale.h
mltframework_shotcut/src/widgets/audioscale.h
/* * Copyright (c) 2015 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOSCALE_H #define AUDIOSCALE_H #include <QWidget> class AudioScale : public QWidget { Q_OBJECT public: explicit AudioScale(QWidget *parent = 0); protected: void paintEvent(QPaintEvent *); private: QVector<int> dbscale; }; #endif // AUDIOSCALE_H
1,013
C++
.h
31
30.419355
72
0.754872
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,397
isingwidget.h
mltframework_shotcut/src/widgets/isingwidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ISINGWIDGET_H #define ISINGWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class IsingWidget; } class IsingWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit IsingWidget(QWidget *parent = 0); ~IsingWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_tempDial_valueChanged(int value); void on_tempSpinner_valueChanged(double arg1); void on_borderGrowthDial_valueChanged(int value); void on_borderGrowthSpinner_valueChanged(double arg1); void on_spontGrowthDial_valueChanged(int value); void on_spontGrowthSpinner_valueChanged(double arg1); void on_preset_selected(void *p); void on_preset_saveClicked(); private: Ui::IsingWidget *ui; }; #endif // ISINGWIDGET_H
1,687
C++
.h
48
32.208333
72
0.760589
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,398
avfoundationproducerwidget.h
mltframework_shotcut/src/widgets/avfoundationproducerwidget.h
/* * Copyright (c) 2015-2017 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AVFOUNDATIONPRODUCERWIDGET_H #define AVFOUNDATIONPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class AvfoundationProducerWidget; } class AvfoundationProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit AvfoundationProducerWidget(QWidget *parent = 0); ~AvfoundationProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &profile); void setProducer(Mlt::Producer *producer); signals: void producerChanged(Mlt::Producer *); private slots: void on_videoCombo_activated(int index); void on_audioCombo_activated(int index); private: Ui::AvfoundationProducerWidget *ui; }; #endif // AVFOUNDATIONPRODUCERWIDGET_H
1,520
C++
.h
42
33.619048
80
0.779292
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,399
newprojectfolder.h
mltframework_shotcut/src/widgets/newprojectfolder.h
/* * Copyright (c) 2018-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NEWPROJECTFOLDER_H #define NEWPROJECTFOLDER_H #include <QWidget> #include <QModelIndex> #include <QStandardItemModel> #include <QMenu> #include <QString> namespace Ui { class NewProjectFolder; } class QAction; class QActionGroup; class NewProjectFolder : public QWidget { Q_OBJECT public: explicit NewProjectFolder(QWidget *parent = 0); ~NewProjectFolder(); protected: void showEvent(QShowEvent *); void hideEvent(QHideEvent *); bool event(QEvent *event); public slots: void updateRecentProjects(); signals: void deletedProject(const QString &); private slots: void on_projectsFolderButton_clicked(); void on_videoModeButton_clicked(); void onProfileTriggered(QAction *action); void on_actionAddCustomProfile_triggered(); void on_actionProfileRemove_triggered(); void on_startButton_clicked(); void on_projectNameLineEdit_textChanged(const QString &arg1); void on_recentListView_clicked(const QModelIndex &index); void on_recentListView_doubleClicked(const QModelIndex &index); void on_recentListView_customContextMenuRequested(const QPoint &pos); void on_actionRecentRemove_triggered(); private: void setColors(); void setProjectFolderButtonText(const QString &text); Ui::NewProjectFolder *ui; QActionGroup *m_profileGroup; QMenu m_videoModeMenu; QMenu *m_customProfileMenu; QString m_profile; QStandardItemModel m_model; QString m_projectName; bool m_isOpening; }; #endif // NEWPROJECTFOLDER_H
2,241
C++
.h
67
30.149254
73
0.76755
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,400
textproducerwidget.h
mltframework_shotcut/src/widgets/textproducerwidget.h
/* * Copyright (c) 2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TEXTPRODUCERWIDGET_H #define TEXTPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class TextProducerWidget; } class TextProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit TextProducerWidget(QWidget *parent = 0); ~TextProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_colorButton_clicked(); void on_preset_selected(void *p); void on_preset_saveClicked(); private: Mlt::Filter *createFilter(Mlt::Profile &, Mlt::Producer *); Ui::TextProducerWidget *ui; }; #endif // TEXTPRODUCERWIDGET_H
1,516
C++
.h
44
31.704545
72
0.757866
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,401
timespinbox.h
mltframework_shotcut/src/widgets/timespinbox.h
/* * Copyright (c) 2012-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TIMESPINBOX_H #define TIMESPINBOX_H #include <QSpinBox> #include <QLineEdit> class QRegularExpressionValidator; class TimeSpinBox : public QSpinBox { Q_OBJECT public: explicit TimeSpinBox(QWidget *parent = 0); protected: QValidator::State validate(QString &input, int &pos) const; int valueFromText(const QString &text) const; QString textFromValue(int val) const; void keyPressEvent(QKeyEvent *event); signals: void accepted(); private: QRegularExpressionValidator *m_validator; }; class TimeSpinBoxLineEdit : public QLineEdit { Q_OBJECT public: explicit TimeSpinBoxLineEdit(QWidget *parent = 0); protected: void focusInEvent(QFocusEvent *event); void focusOutEvent(QFocusEvent *event); void mousePressEvent(QMouseEvent *event); private: bool m_selectOnMousePress; }; #endif // TIMESPINBOX_H
1,568
C++
.h
49
29.285714
72
0.76826
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,402
d3dvideowidget.h
mltframework_shotcut/src/widgets/d3dvideowidget.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef D3DVIDEOWIDGET_H #define D3DVIDEOWIDGET_H #include "videowidget.h" #include <d3d11.h> #include <directxmath.h> class D3DVideoWidget : public Mlt::VideoWidget { Q_OBJECT public: explicit D3DVideoWidget(QObject *parent = nullptr); virtual ~D3DVideoWidget(); public slots: virtual void initialize(); virtual void beforeRendering(); virtual void renderVideo(); private: enum Stage { VertexStage, FragmentStage }; void prepareShader(Stage stage); QByteArray compileShader(Stage stage, const QByteArray &source, const QByteArray &entryPoint); ID3D11ShaderResourceView *initTexture(const void *p, int width, int height); ID3D11Device *m_device = nullptr; ID3D11DeviceContext *m_context = nullptr; QByteArray m_vert; QByteArray m_vertEntryPoint; QByteArray m_frag; QByteArray m_fragEntryPoint; bool m_initialized = false; ID3D11Buffer *m_vbuf = nullptr; ID3D11Buffer *m_cbuf = nullptr; ID3D11VertexShader *m_vs = nullptr; ID3D11PixelShader *m_ps = nullptr; ID3D11InputLayout *m_inputLayout = nullptr; ID3D11RasterizerState *m_rastState = nullptr; ID3D11DepthStencilState *m_dsState = nullptr; ID3D11ShaderResourceView *m_texture[3] = {nullptr, nullptr, nullptr}; struct ConstantBuffer { int32_t colorspace; }; ConstantBuffer m_constants; }; #endif // D3DVIDEOWIDGET_H
2,170
C++
.h
62
30.387097
80
0.723891
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,403
networkproducerwidget.h
mltframework_shotcut/src/widgets/networkproducerwidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NETWORKPRODUCERWIDGET_H #define NETWORKPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class NetworkProducerWidget; } class NetworkProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit NetworkProducerWidget(QWidget *parent = 0); ~NetworkProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); void setProducer(Mlt::Producer *); private slots: void on_preset_selected(void *p); void on_preset_saveClicked(); private: Ui::NetworkProducerWidget *ui; void on_applyButton_clicked(); }; #endif // NETWORKPRODUCERWIDGET_H
1,508
C++
.h
43
32.372093
75
0.763736
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,404
metalvideowidget.h
mltframework_shotcut/src/widgets/metalvideowidget.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef METALVIDEOWIDGET_H #define METALVIDEOWIDGET_H #include "videowidget.h" class MetalVideoRenderer; class MetalVideoWidget : public Mlt::VideoWidget { Q_OBJECT public: explicit MetalVideoWidget(QObject *parent); virtual ~MetalVideoWidget(); public slots: virtual void initialize(); virtual void renderVideo(); private: std::unique_ptr<MetalVideoRenderer> m_renderer; }; #endif // METALVIDEOWIDGET_H
1,128
C++
.h
33
31.787879
72
0.768382
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,405
playlisttable.h
mltframework_shotcut/src/widgets/playlisttable.h
/* * Copyright (c) 2015-2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _PLAYLISTTABLE_H #define _PLAYLISTTABLE_H #include <QTableView> class PlaylistTable : public QTableView { Q_OBJECT public: PlaylistTable(QWidget *parent = nullptr); void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; void dropEvent(QDropEvent *event) Q_DECL_OVERRIDE; signals: void movedToEnd(); }; #endif
1,034
C++
.h
30
32.133333
72
0.75976
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,406
jackproducerwidget.h
mltframework_shotcut/src/widgets/jackproducerwidget.h
/* * Copyright (c) 2012-2017 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef JACKPRODUCERWIDGET_H #define JACKPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class JackProducerWidget; } class JackProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit JackProducerWidget(QWidget *parent = 0); ~JackProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &profile); private: Ui::JackProducerWidget *ui; }; #endif // JACKPRODUCERWIDGET_H
1,250
C++
.h
36
32.388889
72
0.771973
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,407
openglvideowidget.h
mltframework_shotcut/src/widgets/openglvideowidget.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OPENGLVIDEOWIDGET_H #define OPENGLVIDEOWIDGET_H #include "videowidget.h" #include <QOpenGLFunctions> #include <QOpenGLShaderProgram> #include <QOpenGLFramebufferObject> #include <QOpenGLContext> #include <QOffscreenSurface> class OpenGLVideoWidget : public Mlt::VideoWidget, protected QOpenGLFunctions { Q_OBJECT public: explicit OpenGLVideoWidget(QObject *parent = nullptr); virtual ~OpenGLVideoWidget(); public slots: virtual void initialize(); virtual void renderVideo(); virtual void onFrameDisplayed(const SharedFrame &frame); private: void createShader(); QOffscreenSurface m_offscreenSurface; std::unique_ptr<QOpenGLShaderProgram> m_shader; GLint m_projectionLocation; GLint m_modelViewLocation; GLint m_vertexLocation; GLint m_texCoordLocation; GLint m_colorspaceLocation; GLint m_textureLocation[3]; QOpenGLContext *m_quickContext; std::unique_ptr<QOpenGLContext> m_context; GLuint m_renderTexture[3]; GLuint m_displayTexture[3]; bool m_isThreadedOpenGL; }; #endif // OPENGLVIDEOWIDGET_H
1,847
C++
.h
51
32
78
0.750844
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,408
blipproducerwidget.h
mltframework_shotcut/src/widgets/blipproducerwidget.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BLIPPRODUCERWIDGET_H #define BLIPPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class BlipProducerWidget; } class BlipProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit BlipProducerWidget(QWidget *parent = 0); ~BlipProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_periodSpinBox_valueChanged(int); void on_preset_selected(void *p); void on_preset_saveClicked(); private: QString detail() const; Ui::BlipProducerWidget *ui; }; #endif // BLIPPRODUCERWIDGET_H
1,490
C++
.h
44
31.113636
72
0.761838
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,409
iecscale.h
mltframework_shotcut/src/widgets/iecscale.h
/* * Copyright (c) 2015 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IECSCALE_H #define IECSCALE_H //---------------------------------------------------------------------------- // IEC standard dB scaling -- as borrowed from meterbridge (c) Steve Harris static inline double IEC_Scale(double dB) { double fScale = 1.0f; if (dB < -70.0f) fScale = 0.0f; else if (dB < -60.0f) fScale = (dB + 70.0f) * 0.0025f; else if (dB < -50.0f) fScale = (dB + 60.0f) * 0.005f + 0.025f; else if (dB < -40.0) fScale = (dB + 50.0f) * 0.0075f + 0.075f; else if (dB < -30.0f) fScale = (dB + 40.0f) * 0.015f + 0.15f; else if (dB < -20.0f) fScale = (dB + 30.0f) * 0.02f + 0.3f; else if (dB < -0.001f || dB > 0.001f) /* if (dB < 0.0f) */ fScale = (dB + 20.0f) * 0.025f + 0.5f; return fScale; } static inline double IEC_ScaleMax(double dB, double max) { return IEC_Scale(dB) / IEC_Scale(max); } #endif // IECSCALE_H
1,627
C++
.h
44
33.295455
78
0.617386
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,410
toneproducerwidget.h
mltframework_shotcut/src/widgets/toneproducerwidget.h
/* * Copyright (c) 2015-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TONEPRODUCERWIDGET_H #define TONEPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class ToneProducerWidget; } class ToneProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit ToneProducerWidget(QWidget *parent = 0); ~ToneProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void modified(); private slots: void on_frequencySpinBox_valueChanged(int); void on_levelSpinBox_valueChanged(int); void on_preset_selected(void *p); void on_preset_saveClicked(); private: QString detail() const; Ui::ToneProducerWidget *ui; }; #endif // TONEPRODUCERWIDGET_H
1,520
C++
.h
45
30.977778
72
0.761775
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,411
slideshowgeneratorwidget.h
mltframework_shotcut/src/widgets/slideshowgeneratorwidget.h
/* * Copyright (c) 2020-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SLIDESHOWGENERATORWIDGET_H #define SLIDESHOWGENERATORWIDGET_H #include <MltProducer.h> #include <QFuture> #include <QMutex> #include <QWidget> class QComboBox; class QDoubleSpinBox; class QSlider; class QSpinBox; namespace Mlt { class Filter; class Playlist; class Transition; } class ProducerPreviewWidget; class SlideshowGeneratorWidget : public QWidget { Q_OBJECT public: SlideshowGeneratorWidget(Mlt::Playlist *clips, QWidget *parent = 0); virtual ~SlideshowGeneratorWidget(); Mlt::Playlist *getSlideshow(); private slots: void on_parameterChanged(); private: struct SlideshowConfig { double clipDuration; int aspectConversion; int zoomPercent; double transitionDuration; int transitionStyle; int transitionSoftness; }; void attachAffineFilter(SlideshowConfig &config, Mlt::Producer *producer, int endPosition); void attachBlurFilter(SlideshowConfig &config, Mlt::Producer *producer); void applyLumaTransitionProperties(Mlt::Transition *luma, SlideshowConfig &config); void generatePreviewSlideshow(); Q_INVOKABLE void startPreview(); QDoubleSpinBox *m_clipDurationSpinner; QComboBox *m_aspectConversionCombo; QSpinBox *m_zoomPercentSpinner; QDoubleSpinBox *m_transitionDurationSpinner; QComboBox *m_transitionStyleCombo; QSpinBox *m_softnessSpinner; ProducerPreviewWidget *m_preview; Mlt::Playlist *m_clips; // Mutext Protected Members QFuture<void> m_future; QMutex m_mutex; bool m_refreshPreview; SlideshowConfig m_config; Mlt::Producer m_previewProducer; }; #endif // SLIDESHOWGENERATORWIDGET_H
2,374
C++
.h
71
29.901408
95
0.766376
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,412
frameratewidget.h
mltframework_shotcut/src/widgets/frameratewidget.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FRAMERATEWIDGET_H #define FRAMERATEWIDGET_H #include <QWidget> class QDoubleSpinBox; class QComboBox; class FrameRateWidget : public QWidget { Q_OBJECT public: explicit FrameRateWidget(QWidget *parent = nullptr); double fps(); public slots: void setFps(double); signals: void fpsChanged(double); private slots: void on_fpsSpinner_editingFinished(); void on_fpsComboBox_activated(const QString &arg1); private: QDoubleSpinBox *m_fpsSpinner; QComboBox *m_fpsComboBox; double m_fps; }; #endif // FRAMERATEWIDGET_H
1,262
C++
.h
40
28.925
72
0.762376
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,413
colorproducerwidget.h
mltframework_shotcut/src/widgets/colorproducerwidget.h
/* * Copyright (c) 2012-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COLORPRODUCERWIDGET_H #define COLORPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class ColorProducerWidget; } class ColorProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit ColorProducerWidget(QWidget *parent = 0); ~ColorProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); void modified(); public slots: void rename(); private slots: void on_colorButton_clicked(); void on_preset_selected(void *p); void on_preset_saveClicked(); void on_lineEdit_editingFinished(); void on_notesTextEdit_textChanged(); private: Ui::ColorProducerWidget *ui; QString m_title; }; #endif // COLORPRODUCERWIDGET_H
1,622
C++
.h
49
30.183673
73
0.757362
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,414
plasmawidget.h
mltframework_shotcut/src/widgets/plasmawidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLASMAWIDGET_H #define PLASMAWIDGET_H #include <QWidget> #include <abstractproducerwidget.h> namespace Ui { class PlasmaWidget; } class PlasmaWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit PlasmaWidget(QWidget *parent = 0); ~PlasmaWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_speed1Dial_valueChanged(int value); void on_speed1Spinner_valueChanged(double arg1); void on_speed2Dial_valueChanged(int value); void on_speed2Spinner_valueChanged(double arg1); void on_speed3Dial_valueChanged(int value); void on_speed3Spinner_valueChanged(double arg1); void on_speed4Dial_valueChanged(int value); void on_speed4Spinner_valueChanged(double arg1); void on_move1Dial_valueChanged(int value); void on_move1Spinner_valueChanged(double arg1); void on_move2Dial_valueChanged(int value); void on_move2Spinner_valueChanged(double arg1); void on_preset_selected(void *p); void on_preset_saveClicked(); private: Ui::PlasmaWidget *ui; }; #endif // PLASMAWIDGET_H
2,017
C++
.h
55
33.527273
72
0.760758
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,415
producerpreviewwidget.h
mltframework_shotcut/src/widgets/producerpreviewwidget.h
/* * Copyright (c) 2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PRODUCERPREVIEWWIDGET_H #define PRODUCERPREVIEWWIDGET_H #include "dataqueue.h" #include <MltProducer.h> #include <QFuture> #include <QPixmap> #include <QWidget> class QLabel; class ScrubBar; class ProducerPreviewWidget : public QWidget { Q_OBJECT public: explicit ProducerPreviewWidget(double dar, int width = 320); virtual ~ProducerPreviewWidget(); void start(const Mlt::Producer &producer); void stop(bool releaseProducer = true); void showText(QString text); void setLooping(bool enabled); public slots: void restart(); private slots: void seeked(int); private: void timerEvent(QTimerEvent *) override; void frameGeneratorThread(); void generateFrame(); QSize m_previewSize; QLabel *m_imageLabel; ScrubBar *m_scrubber; QLabel *m_posLabel; int m_seekTo; int m_timerId; Mlt::Producer m_producer; struct QueueItem { QPixmap pixmap; int position; QString positionText; }; DataQueue<QueueItem> m_queue; QFuture<void> m_future; bool m_generateFrames; bool m_isLooping; }; #endif // PRODUCERPREVIEWWIDGET_H
1,841
C++
.h
61
26.688525
72
0.739106
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,416
editmarkerwidget.h
mltframework_shotcut/src/widgets/editmarkerwidget.h
/* * Copyright (c) 2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EDITMARKERWIDGET_H #define EDITMARKERWIDGET_H #include <QWidget> class QLabel; class QLineEdit; class QPushButton; class TimeSpinBox; class EditMarkerWidget : public QWidget { Q_OBJECT public: EditMarkerWidget(QWidget *parent); EditMarkerWidget(QWidget *parent, const QString &text, const QColor &color, int start, int end, int maxEnd); virtual ~EditMarkerWidget(); QString getText(); QColor getColor(); int getStart(); int getEnd(); void setValues(const QString &text, const QColor &color, int start, int end, int maxEnd); signals: void valuesChanged(); private slots: void on_colorButton_clicked(); void on_startSpinner_valueChanged(int); void on_endSpinner_valueChanged(int); private: void updateDuration(); QLineEdit *m_textField; QPushButton *m_colorButton; QLabel *m_colorLabel; TimeSpinBox *m_startSpinner; TimeSpinBox *m_endSpinner; QLabel *m_durationLabel; }; #endif // EDITMARKERWIDGET_H
1,710
C++
.h
52
29.461538
99
0.742718
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,417
imageproducerwidget.h
mltframework_shotcut/src/widgets/imageproducerwidget.h
/* * Copyright (c) 2012-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef IMAGEPRODUCERWIDGET_H #define IMAGEPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" #include "mltcontroller.h" namespace Ui { class ImageProducerWidget; } class ImageProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit ImageProducerWidget(QWidget *parent = 0); ~ImageProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); virtual void setProducer(Mlt::Producer *); signals: void producerChanged(Mlt::Producer *); void producerReopened(bool play); void modified(); public slots: void updateDuration(); void rename(); private slots: void on_resetButton_clicked(); void on_aspectNumSpinBox_valueChanged(int ); void on_aspectDenSpinBox_valueChanged(int ); void on_durationSpinBox_editingFinished(); void on_sequenceCheckBox_clicked(bool checked); void on_repeatSpinBox_editingFinished(); void on_defaultDurationButton_clicked(); void on_notesTextEdit_textChanged(); void on_menuButton_clicked(); void on_actionCopyFullFilePath_triggered(); void on_actionOpenFolder_triggered(); void on_actionSetFileDate_triggered(); void on_filenameLabel_editingFinished(); void on_actionDisableProxy_triggered(bool checked); void on_actionMakeProxy_triggered(); void on_actionDeleteProxy_triggered(); void on_actionCopyHashCode_triggered(); void on_proxyButton_clicked(); private: Ui::ImageProducerWidget *ui; int m_defaultDuration; void reopen(Mlt::Producer *p); void recreateProducer(); }; #endif // IMAGEPRODUCERWIDGET_H
2,376
C++
.h
66
32.333333
73
0.761947
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,418
servicepresetwidget.h
mltframework_shotcut/src/widgets/servicepresetwidget.h
/* * Copyright (c) 2012-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SERVICEPRESETWIDGET_H #define SERVICEPRESETWIDGET_H #include <QWidget> #include <MltProperties.h> namespace Ui { class ServicePresetWidget; } class ServicePresetWidget : public QWidget { Q_OBJECT public: explicit ServicePresetWidget(QWidget *parent = 0); ~ServicePresetWidget(); void loadPresets(); void saveDefaultPreset(const Mlt::Properties &); void savePreset(const Mlt::Properties &); void savePreset(const Mlt::Properties &properties, QString name); signals: void selected(void *properties); void saveClicked(); private slots: void on_presetCombo_activated(int index); void on_savePresetButton_clicked(); void on_deletePresetButton_clicked(); private: Ui::ServicePresetWidget *ui; QString m_widgetName; }; #endif // SERVICEPRESETWIDGET_H
1,516
C++
.h
45
30.888889
72
0.762491
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,419
lumamixtransition.h
mltframework_shotcut/src/widgets/lumamixtransition.h
/* * Copyright (c) 2014-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LUMAMIXTRANSITION_H #define LUMAMIXTRANSITION_H #include <QWidget> #include <MltProducer.h> #include <MltTransition.h> namespace Ui { class LumaMixTransition; } class ProducerPreviewWidget; class LumaMixTransition : public QWidget { Q_OBJECT public: explicit LumaMixTransition(Mlt::Producer &transition, QWidget *parent = 0); ~LumaMixTransition(); public slots: void onPlaying(); signals: void modified(); private slots: void on_invertCheckBox_clicked(bool checked); void on_softnessSlider_valueChanged(int value); void on_crossfadeRadioButton_clicked(); void on_mixRadioButton_clicked(); void on_mixSlider_valueChanged(int value); void on_lumaCombo_currentRowChanged(int index); void startPreview(); void on_previewCheckBox_clicked(bool checked); void on_favoriteButton_clicked(); private: Ui::LumaMixTransition *ui; Mlt::Producer m_producer; int m_maxStockIndex; ProducerPreviewWidget *m_preview; Mlt::Producer m_previewProducer; Mlt::Transition *getTransition(const QString &name); void updateCustomLumaLabel(Mlt::Transition &transition); }; #endif // LUMAMIXTRANSITION_H
1,884
C++
.h
55
31.109091
79
0.765746
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,420
trackpropertieswidget.h
mltframework_shotcut/src/widgets/trackpropertieswidget.h
/* * Copyright (c) 2015 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TRACKPROPERTIESWIDGET_H #define TRACKPROPERTIESWIDGET_H #include <QWidget> #include <MltProducer.h> namespace Ui { class TrackPropertiesWidget; } namespace Mlt { class Transition; } class TrackPropertiesWidget : public QWidget { Q_OBJECT public: explicit TrackPropertiesWidget(Mlt::Producer &track, QWidget *parent = 0); ~TrackPropertiesWidget(); private slots: void on_blendModeCombo_currentIndexChanged(int index); void onModeChanged(QString &mode); private: Mlt::Transition *getTransition(const QString &name); Ui::TrackPropertiesWidget *ui; Mlt::Producer m_track; }; #endif // TRACKPROPERTIESWIDGET_H
1,388
C++
.h
42
30.690476
78
0.771129
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,421
lissajouswidget.h
mltframework_shotcut/src/widgets/lissajouswidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef LISSAJOUSWIDGET_H #define LISSAJOUSWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Mlt { class Producer; } namespace Ui { class LissajousWidget; } class LissajousWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit LissajousWidget(QWidget *parent = 0); ~LissajousWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_xratioDial_valueChanged(int value); void on_xratioSpinner_valueChanged(double arg1); void on_yratioDial_valueChanged(int value); void on_yratioSpinner_valueChanged(double arg1); void on_preset_selected(void *p); void on_preset_saveClicked(); private: Ui::LissajousWidget *ui; }; #endif // LISSAJOUSWIDGET_H
1,635
C++
.h
49
30.612245
72
0.76254
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,422
x11grabwidget.h
mltframework_shotcut/src/widgets/x11grabwidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef X11GRABWIDGET_H #define X11GRABWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class X11grabWidget; } class X11grabWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit X11grabWidget(QWidget *parent = 0); ~X11grabWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); void setProducer(Mlt::Producer *); signals: void producerChanged(Mlt::Producer *); private slots: void on_positionComboBox_activated(int index); void on_audioComboBox_activated(int index); void on_preset_selected(void *p); void on_preset_saveClicked(); void on_applyButton_clicked(); private: Ui::X11grabWidget *ui; QWidget *m_audioWidget; QString URL(Mlt::Profile &) const; }; #endif // X11GRABWIDGET_H
1,622
C++
.h
48
30.854167
72
0.751279
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,424
decklinkproducerwidget.h
mltframework_shotcut/src/widgets/decklinkproducerwidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DECKLINKPRODUCERWIDGET_H #define DECKLINKPRODUCERWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class DecklinkProducerWidget; } class DecklinkProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit DecklinkProducerWidget(QWidget *parent = 0); ~DecklinkProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_deviceCombo_activated(int index); void on_profileCombo_activated(int index); private: Ui::DecklinkProducerWidget *ui; }; #endif // DECKLINKPRODUCERWIDGET_H
1,476
C++
.h
42
32.47619
76
0.772312
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,425
playlisticonview.h
mltframework_shotcut/src/widgets/playlisticonview.h
/* * Copyright (c) 2016-2021 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SRC_WIDGETS_PLAYLISTICONVIEW_H #define SRC_WIDGETS_PLAYLISTICONVIEW_H #include <QAbstractItemView> class PlaylistIconView : public QAbstractItemView { Q_OBJECT public: PlaylistIconView(QWidget *parent); void resetMultiSelect(); QRect visualRect(const QModelIndex &index) const Q_DECL_OVERRIDE; void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible) Q_DECL_OVERRIDE; QModelIndex indexAt(const QPoint &point) const Q_DECL_OVERRIDE; QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) Q_DECL_OVERRIDE; int horizontalOffset() const Q_DECL_OVERRIDE; int verticalOffset() const Q_DECL_OVERRIDE; bool isIndexHidden(const QModelIndex &index) const Q_DECL_OVERRIDE; void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command) Q_DECL_OVERRIDE; QRegion visualRegionForSelection(const QItemSelection &selection) const Q_DECL_OVERRIDE; void currentChanged(const QModelIndex &current, const QModelIndex &previous) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void dragMoveEvent(QDragMoveEvent *e) Q_DECL_OVERRIDE; void dragLeaveEvent(QDragLeaveEvent *e) Q_DECL_OVERRIDE; void dropEvent(QDropEvent *e) Q_DECL_OVERRIDE; void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE; void setModel(QAbstractItemModel *model) Q_DECL_OVERRIDE; void keyPressEvent(QKeyEvent *event) Q_DECL_OVERRIDE; void keyReleaseEvent(QKeyEvent *event) Q_DECL_OVERRIDE; void rowsInserted(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE; void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) Q_DECL_OVERRIDE; void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>()) Q_DECL_OVERRIDE; protected slots: void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) Q_DECL_OVERRIDE; private slots: void updateSizes(); private: int rowWidth() const; QAbstractItemView::DropIndicatorPosition position(const QPoint &pos, const QRect &rect, const QModelIndex &index) const; QSize m_gridSize; QPoint m_draggingOverPos; int m_itemsPerRow; bool m_isToggleSelect {false}; bool m_isRangeSelect {false}; QModelIndex m_pendingSelect; }; #endif
3,218
C++
.h
65
44.4
103
0.754297
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,426
avformatproducerwidget.h
mltframework_shotcut/src/widgets/avformatproducerwidget.h
/* * Copyright (c) 2012-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AVFORMATPRODUCERWIDGET_H #define AVFORMATPRODUCERWIDGET_H #include <QWidget> #include <QRunnable> #include "abstractproducerwidget.h" #include "dialogs/transcodedialog.h" namespace Ui { class AvformatProducerWidget; } class AvformatProducerWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit AvformatProducerWidget(QWidget *parent = 0); ~AvformatProducerWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); void setProducer(Mlt::Producer *); public slots: void updateDuration(); void rename(); void offerConvert(QString message, bool set709Convert = false, bool setSubClip = false); signals: void producerChanged(Mlt::Producer *); void producerReopened(bool play); void modified(); protected: void keyPressEvent(QKeyEvent *event); private slots: void onProducerChanged(Mlt::Producer *); void on_videoTrackComboBox_activated(int index); void on_audioTrackComboBox_activated(int index); void on_scanComboBox_activated(int index); void on_fieldOrderComboBox_activated(int index); void on_aspectNumSpinBox_valueChanged(int ); void on_aspectDenSpinBox_valueChanged(int ); void on_durationSpinBox_editingFinished(); void on_speedSpinBox_editingFinished(); void on_pitchCheckBox_stateChanged(int state); void on_syncSlider_valueChanged(int value); void on_actionOpenFolder_triggered(); void on_menuButton_clicked(); void on_actionCopyFullFilePath_triggered(); void on_notesTextEdit_textChanged(); void on_actionFFmpegInfo_triggered(); void on_actionFFmpegIntegrityCheck_triggered(); void on_actionFFmpegConvert_triggered(); void on_reverseButton_clicked(); void on_actionExtractSubclip_triggered(); void on_actionExtractSubtitles_triggered(); void on_actionSetFileDate_triggered(); void on_rangeComboBox_activated(int index); void on_filenameLabel_editingFinished(); void on_convertButton_clicked(); void on_actionDisableProxy_triggered(bool checked); void on_actionMakeProxy_triggered(); void on_actionDeleteProxy_triggered(); void on_actionCopyHashCode_triggered(); void on_proxyButton_clicked(); void on_actionReset_triggered(); void on_actionSetEquirectangular_triggered(); void on_actionFFmpegVideoQuality_triggered(); void on_rotationComboBox_activated(int index); void on_actionExportGPX_triggered(); void on_speedComboBox_textActivated(const QString &arg1); private: Ui::AvformatProducerWidget *ui; int m_defaultDuration; bool m_recalcDuration; bool m_askToConvert; void reopen(Mlt::Producer *p); void recreateProducer(bool getFrame = false); bool revertToOriginalResource(); void setSyncVisibility(); double fps(); private slots: void reloadProducerValues(); void on_actionBitrateViewer_triggered(); }; class ProbeTask : public QObject, public QRunnable { Q_OBJECT public: explicit ProbeTask(Mlt::Producer *producer); void run(); signals: void probeFinished(); private: Mlt::Producer m_producer; }; #endif // AVFORMATPRODUCERWIDGET_H
3,923
C++
.h
107
32.598131
92
0.763752
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,427
screenselector.h
mltframework_shotcut/src/widgets/screenselector.h
/* * Copyright (c) 2014-2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SCREENSELECTOR_H #define SCREENSELECTOR_H #include <QFrame> class ScreenSelector : public QFrame { Q_OBJECT public: ScreenSelector(QWidget *parent = 0); void setFixedSize(const QSize &size); void setBoundingRect(const QRect &rect); void setSelectedRect(const QRect &rect); public slots: void startSelection(QPoint initialPos = QPoint(-1, -1)); signals: void screenSelected(const QRect &); void pointSelected(const QPoint &); void cancelled(); public: bool onMousePressEvent(QMouseEvent *event); bool onMouseMoveEvent(QMouseEvent *event); bool onMouseReleaseEvent(QMouseEvent *event); bool onKeyPressEvent(QKeyEvent *event); protected: bool eventFilter(QObject *, QEvent *event); private: void lockGeometry(const QRect &rect); void release(); bool m_selectionInProgress; QRect m_selectionRect; QPoint m_selectionPoint; QSize m_fixedSize; QRect m_boundingRect; }; #endif // SCREENSELECTOR_H
1,689
C++
.h
50
30.6
72
0.752609
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,428
colorbarswidget.h
mltframework_shotcut/src/widgets/colorbarswidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COLORBARSWIDGET_H #define COLORBARSWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class ColorBarsWidget; } class ColorBarsWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit ColorBarsWidget(QWidget *parent = 0); ~ColorBarsWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); signals: void producerChanged(Mlt::Producer *); private slots: void on_comboBox_activated(int index); private: Ui::ColorBarsWidget *ui; }; #endif // COLORBARSWIDGET_H
1,369
C++
.h
41
30.804878
72
0.762519
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,429
video4linuxwidget.h
mltframework_shotcut/src/widgets/video4linuxwidget.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * Author: Dan Dennedy <dan@dennedy.org> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEO4LINUXWIDGET_H #define VIDEO4LINUXWIDGET_H #include <QWidget> #include "abstractproducerwidget.h" namespace Ui { class Video4LinuxWidget; } class Video4LinuxWidget : public QWidget, public AbstractProducerWidget { Q_OBJECT public: explicit Video4LinuxWidget(QWidget *parent = 0); ~Video4LinuxWidget(); // AbstractProducerWidget overrides Mlt::Producer *newProducer(Mlt::Profile &); Mlt::Properties getPreset() const; void loadPreset(Mlt::Properties &); void setProducer(Mlt::Producer *); signals: void producerChanged(Mlt::Producer *); private slots: void on_v4lAudioComboBox_activated(int index); void on_preset_selected(void *p); void on_preset_saveClicked(); void on_applyButton_clicked(); private: Ui::Video4LinuxWidget *ui; QWidget *m_audioWidget; QString URL() const; }; #endif // VIDEO4LINUXWIDGET_H
1,633
C++
.h
48
31.145833
72
0.755556
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,430
audiospectrumscopewidget.h
mltframework_shotcut/src/widgets/scopes/audiospectrumscopewidget.h
/* * Copyright (c) 2015 Meltytech, LLC * Author: Brian Matherly <code@brianmatherly.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOSPECTRUMSCOPEWIDGET_H #define AUDIOSPECTRUMSCOPEWIDGET_H #include "scopewidget.h" #include <MltFilter.h> class AudioMeterWidget; class AudioSpectrumScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit AudioSpectrumScopeWidget(); ~AudioSpectrumScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: // Functions run in scope thread. void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void processSpectrum(); // Members accessed by scope thread. Mlt::Filter *m_filter; // Members accessed only in the GUI thread AudioMeterWidget *m_audioMeter; }; #endif // AUDIOSPECTRUMSCOPEWIDGET_H
1,433
C++
.h
39
33.948718
72
0.765173
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,431
videowaveformscopewidget.h
mltframework_shotcut/src/widgets/scopes/videowaveformscopewidget.h
/* * Copyright (c) 2015-2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOWAVEFORMSCOPEWIDGET_H #define VIDEOWAVEFORMSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class VideoWaveformScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit VideoWaveformScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; SharedFrame m_frame; QImage m_renderImg; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; QImage m_displayImg; }; #endif // VIDEOWAVEFORMSCOPEWIDGET_H
1,397
C++
.h
38
34
72
0.76758
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,432
audiovectorscopewidget.h
mltframework_shotcut/src/widgets/scopes/audiovectorscopewidget.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOVECTORSCOPEWIDGET_H #define AUDIOVECTORSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class QComboBox; class QLabel; class AudioVectorScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit AudioVectorScopeWidget(); ~AudioVectorScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: // Functions run in scope thread. void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; // Functions run in GUI thread. void setComboBoxOptions(); Q_INVOKABLE void onNewDisplayImage(); // Members accessed only in scope thread (no thread protection). QImage m_renderImg; SharedFrame m_frame; // Members accessed only in GUI thread (no thread protection). QComboBox *m_c1Combo; QComboBox *m_c2Combo; QLabel *m_imgLabel; // Members accessed in multiple threads (mutex protected). QMutex m_mutex; QImage m_displayImg; int m_c1Index; int m_c2Index; }; #endif // AUDIOVECTORSCOPEWIDGET_H
1,730
C++
.h
50
31.36
72
0.75045
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,433
videovectorscopewidget.h
mltframework_shotcut/src/widgets/scopes/videovectorscopewidget.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOVECTORSCOPEWIDGET_H #define VIDEOVECTORSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class VideoVectorScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit VideoVectorScopeWidget(); virtual ~VideoVectorScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: enum { BLUE_75 = 0, CYAN_75, GREEN_75, YELLOW_75, RED_75, MAGENTA_75, BLUE_100, CYAN_100, GREEN_100, YELLOW_100, RED_100, MAGENTA_100, COLOR_POINT_COUNT, }; // Called in scope thread void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void drawGraticuleLines(QPainter &p, qreal lineWidth); void drawSkinToneLine(QPainter &p, qreal lineWidth); void drawGraticuleMark(QPainter &p, const QPoint &point, QColor color, qreal lineWidth, qreal LineLength); // Called in UI thread void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; QRect getCenteredSquare(); // Only accessed by the scope thread SharedFrame m_frame; QImage m_renderImg; QImage m_graticuleImg; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; QImage m_displayImg; QPoint m_points[COLOR_POINT_COUNT]; bool m_profileChanged; private slots: void profileChanged(); }; #endif // VIDEOVECTORSCOPEWIDGET_H
2,212
C++
.h
67
28.179104
91
0.709934
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,434
audiopeakmeterscopewidget.h
mltframework_shotcut/src/widgets/scopes/audiopeakmeterscopewidget.h
/* * Copyright (c) 2015-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOPEAKMETERSCOPEWIDGET_H #define AUDIOPEAKMETERSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> #include <QVector> class AudioMeterWidget; class AudioPeakMeterScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit AudioPeakMeterScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; void setOrientation(Qt::Orientation orientation) Q_DECL_OVERRIDE; private: // Functions run in scope thread. void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; // Members accessed by GUI thread. AudioMeterWidget *m_audioMeter; Qt::Orientation m_orientation; int m_channels; private slots: void reconfigureMeter(); }; #endif // AUDIOPEAKMETERSCOPEWIDGET_H
1,455
C++
.h
41
32.829268
72
0.770107
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,435
videorgbwaveformscopewidget.h
mltframework_shotcut/src/widgets/scopes/videorgbwaveformscopewidget.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEORGBWAVEFORMSCOPEWIDGET_H #define VIDEORGBWAVEFORMSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class VideoRgbWaveformScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit VideoRgbWaveformScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; SharedFrame m_frame; QImage m_renderImg; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; QImage m_displayImg; }; #endif // VIDEORGBWAVEFORMSCOPEWIDGET_H
1,407
C++
.h
38
34.263158
72
0.770022
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,436
audioloudnessscopewidget.h
mltframework_shotcut/src/widgets/scopes/audioloudnessscopewidget.h
/* * Copyright (c) 2016-2017 Meltytech, LLC * Author: Brian Matherly <code@brianmatherly.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOLOUDNESSSCOPEWIDGET_H #define AUDIOLOUDNESSSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> #include <QVector> #include <MltFilter.h> class QQuickWidget; class QLabel; class QTimer; class AudioLoudnessScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit AudioLoudnessScopeWidget(); ~AudioLoudnessScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; void setOrientation(Qt::Orientation orientation) Q_DECL_OVERRIDE; void setOrientation(Qt::Orientation orientation, bool force); protected: bool event(QEvent *event) Q_DECL_OVERRIDE; private slots: void resetQview(); void onResetButtonClicked(); void onIntegratedToggled(bool checked); void onShorttermToggled(bool checked); void onMomentaryToggled(bool checked); void onRangeToggled(bool checked); void onPeakToggled(bool checked); void onTruePeakToggled(bool checked); void updateMeters(void); private: // Functions run in scope thread. void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; // Members accessed by scope thread. Mlt::Filter *m_loudnessFilter; double m_peak; double m_true_peak; bool m_newData; // Members accessed by GUI thread. Qt::Orientation m_orientation; QQuickWidget *m_qview; QLabel *m_timeLabel; QTimer *m_timer; }; #endif // AUDIOLOUDNESSSCOPEWIDGET_H
2,168
C++
.h
63
31.206349
72
0.760267
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,437
audiowaveformscopewidget.h
mltframework_shotcut/src/widgets/scopes/audiowaveformscopewidget.h
/* * Copyright (c) 2015-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOWAVEFORMSCOPEWIDGET_H #define AUDIOWAVEFORMSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class AudioWaveformScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit AudioWaveformScopeWidget(); ~AudioWaveformScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: // Functions run in scope thread. void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void createGrid(const QSize &size); // Functions run in GUI thread. void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; void leaveEvent(QEvent *event) Q_DECL_OVERRIDE; // Members accessed only in scope thread (no thread protection). QImage m_renderWave; int m_graphTopPadding; int m_graphLeftPadding; int m_channels; // Members accessed only in GUI thread (no thread protection). int m_cursorPos; // Members accessed in multiple threads (mutex protected). QMutex m_mutex; QImage m_displayWave; QImage m_displayGrid; SharedFrame m_frame; }; #endif // AUDIOWAVEFORMSCOPEWIDGET_H
1,855
C++
.h
50
33.76
72
0.75376
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,438
videozoomwidget.h
mltframework_shotcut/src/widgets/scopes/videozoomwidget.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOZOOMWIDGET_H #define VIDEOZOOMWIDGET_H #include "sharedframe.h" #include <QWidget> #include <QMutex> class VideoZoomWidget : public QWidget { Q_OBJECT public: struct PixelValues { uint8_t y; uint8_t u; uint8_t v; uint8_t r; uint8_t g; uint8_t b; }; explicit VideoZoomWidget(); // May be called from a worker thread. void putFrame(SharedFrame frame); QPoint getSelectedPixel(); void setSelectedPixel(QPoint pixel); QRect getPixelRect(); int getZoom(); PixelValues getPixelValues(const QPoint &pixel); void setOffset(QPoint offset); signals: void pixelSelected(const QPoint &); void zoomChanged(int zoom); public slots: void lock(bool locked); private: virtual QSize sizeHint() const Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event)Q_DECL_OVERRIDE; void mousePressEvent(QMouseEvent *event)Q_DECL_OVERRIDE; void wheelEvent(QWheelEvent *event)Q_DECL_OVERRIDE; QPoint pixelToPos(const QPoint &pixel); QPoint posToPixel(const QPoint &pos); PixelValues pixelToValues(const QPoint &pixel); bool m_locked; bool m_selectionInProgress; int m_zoom; QPoint m_imageOffset; QPoint m_mouseGrabPixel; QPoint m_selectedPixel; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; SharedFrame m_frame; }; #endif // VIDEOZOOMWIDGET_H
2,192
C++
.h
67
28.626866
72
0.731626
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,439
videohistogramscopewidget.h
mltframework_shotcut/src/widgets/scopes/videohistogramscopewidget.h
/* * Copyright (c) 2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOHISTOGRAMSCOPEWIDGET_H #define VIDEOHISTOGRAMSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QVector> class VideoHistogramScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit VideoHistogramScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void drawHistogram(QPainter &p, QString title, QColor color, QColor outline, QVector<unsigned int> &bins, QRect rect); void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; SharedFrame m_frame; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; QVector<unsigned int> m_yBins; QVector<unsigned int> m_rBins; QVector<unsigned int> m_gBins; QVector<unsigned int> m_bBins; }; #endif // VIDEOHISTOGRAMSCOPEWIDGET_H
1,635
C++
.h
42
35.5
80
0.753943
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,440
videorgbparadescopewidget.h
mltframework_shotcut/src/widgets/scopes/videorgbparadescopewidget.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEORGBPARADESCOPEWIDGET_H #define VIDEORGBPARADESCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class VideoRgbParadeScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit VideoRgbParadeScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE; SharedFrame m_frame; QImage m_renderImg; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; QImage m_displayImg; }; #endif // VIDEORGBPARADESCOPEWIDGET_H
1,397
C++
.h
38
34
72
0.76832
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,441
videozoomscopewidget.h
mltframework_shotcut/src/widgets/scopes/videozoomscopewidget.h
/* * Copyright (c) 2019 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOZOOMSCOPEWIDGET_H #define VIDEOZOOMSCOPEWIDGET_H #include "scopewidget.h" #include "widgets/screenselector.h" #include <QMutex> #include <QPoint> #include <QString> class QLabel; class QToolButton; class VideoZoomWidget; class VideoZoomScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit VideoZoomScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private slots: void onScreenSelectStarted(); void onLockToggled(bool enabled); void onScreenRectSelected(const QRect &rect); void onScreenPointSelected(const QPoint &point); void onPixelSelected(const QPoint &pixel); void onZoomChanged(int zoom); private: // Called from the scope thread void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; // Called from UI thread Q_INVOKABLE void updateLabels(); VideoZoomWidget *m_zoomWidget; ScreenSelector m_selector; QLabel *m_zoomLabel; QLabel *m_pixelXLabel; QLabel *m_pixelYLabel; QLabel *m_rLabel; QLabel *m_gLabel; QLabel *m_bLabel; QLabel *m_yLabel; QLabel *m_uLabel; QLabel *m_vLabel; QToolButton *m_lockButton; }; #endif // VIDEOZOOMSCOPEWIDGET_H
1,894
C++
.h
58
29.482759
72
0.755068
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,442
audiosurroundscopewidget.h
mltframework_shotcut/src/widgets/scopes/audiosurroundscopewidget.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef AUDIOSURROUNDSCOPEWIDGET_H #define AUDIOSURROUNDSCOPEWIDGET_H #include "scopewidget.h" #include <QMutex> #include <QImage> class AudioSurroundScopeWidget Q_DECL_FINAL : public ScopeWidget { Q_OBJECT public: explicit AudioSurroundScopeWidget(); virtual ~AudioSurroundScopeWidget(); QString getTitle() Q_DECL_OVERRIDE; private: // Called in scope thread void refreshScope(const QSize &size, bool full) Q_DECL_OVERRIDE; void drawGraticule(QPainter &p, qreal lineWidth); // Called in UI thread void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE; // Only accessed by the scope thread SharedFrame m_frame; QImage m_renderImg; QImage m_graticuleImg; // Variables accessed from multiple threads (mutex protected) QMutex m_mutex; QImage m_displayImg; bool m_channelsChanged; int m_channels; }; #endif // AUDIOSURROUNDSCOPEWIDGET_H
1,602
C++
.h
45
32.422222
72
0.757439
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,444
subtitlecommands.h
mltframework_shotcut/src/commands/subtitlecommands.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SUBTITLECOMMANDS_H #define SUBTITLECOMMANDS_H #include "models/subtitlesmodel.h" #include <QUndoCommand> namespace Subtitles { enum { UndoIdSubText = 400, UndoIdSubStart, UndoIdSubEnd, UndoIdSubMove, }; class InsertTrackCommand : public QUndoCommand { public: InsertTrackCommand(SubtitlesModel &model, const SubtitlesModel::SubtitleTrack &track, int index); void redo(); void undo(); private: SubtitlesModel &m_model; SubtitlesModel::SubtitleTrack m_track; int m_index; }; class RemoveTrackCommand : public QUndoCommand { public: RemoveTrackCommand(SubtitlesModel &model, int trackIndex); void redo(); void undo(); private: SubtitlesModel &m_model; int m_trackIndex; SubtitlesModel::SubtitleTrack m_saveTrack; QList<Subtitles::SubtitleItem> m_saveSubtitles; }; class EditTrackCommand : public QUndoCommand { public: EditTrackCommand(SubtitlesModel &model, const SubtitlesModel::SubtitleTrack &track, int index); void redo(); void undo(); private: SubtitlesModel &m_model; SubtitlesModel::SubtitleTrack m_oldTrack; SubtitlesModel::SubtitleTrack m_newTrack; int m_index; }; class OverwriteSubtitlesCommand : public QUndoCommand { public: OverwriteSubtitlesCommand(SubtitlesModel &model, int trackIndex, const QList<Subtitles::SubtitleItem> &items); void redo(); void undo(); protected: QList<Subtitles::SubtitleItem> m_newSubtitles; private: SubtitlesModel &m_model; int m_trackIndex; QList<Subtitles::SubtitleItem> m_saveSubtitles; }; class RemoveSubtitlesCommand : public QUndoCommand { public: RemoveSubtitlesCommand(SubtitlesModel &model, int trackIndex, const QList<Subtitles::SubtitleItem> &items); void redo(); void undo(); private: SubtitlesModel &m_model; int m_trackIndex; QList<Subtitles::SubtitleItem> m_items; }; class SetTextCommand : public QUndoCommand { public: SetTextCommand(SubtitlesModel &model, int trackIndex, int itemIndex, const QString &text); void redo(); void undo(); protected: int id() const { return UndoIdSubText; } bool mergeWith(const QUndoCommand *other); private: SubtitlesModel &m_model; int m_trackIndex; int m_itemIndex; QString m_newText; QString m_oldText; }; class SetStartCommand : public QUndoCommand { public: SetStartCommand(SubtitlesModel &model, int trackIndex, int itemIndex, int64_t msTime); void redo(); void undo(); protected: int id() const { return UndoIdSubStart; } bool mergeWith(const QUndoCommand *other); private: SubtitlesModel &m_model; int m_trackIndex; int m_itemIndex; int64_t m_newStart; int64_t m_oldStart; }; class SetEndCommand : public QUndoCommand { public: SetEndCommand(SubtitlesModel &model, int trackIndex, int itemIndex, int64_t msTime); void redo(); void undo(); protected: int id() const { return UndoIdSubEnd; } bool mergeWith(const QUndoCommand *other); private: SubtitlesModel &m_model; int m_trackIndex; int m_itemIndex; int64_t m_newEnd; int64_t m_oldEnd; }; class MoveSubtitlesCommand : public QUndoCommand { public: MoveSubtitlesCommand(SubtitlesModel &model, int trackIndex, const QList<Subtitles::SubtitleItem> &items, int64_t msTime); void redo(); void undo(); protected: int id() const { return UndoIdSubMove; } bool mergeWith(const QUndoCommand *other); private: SubtitlesModel &m_model; int m_trackIndex; QList<Subtitles::SubtitleItem> m_oldSubtitles; QList<Subtitles::SubtitleItem> m_newSubtitles; }; } #endif // SUBTITLECOMMANDS_H
4,487
C++
.h
166
23.138554
101
0.728054
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,445
timelinecommands.h
mltframework_shotcut/src/commands/timelinecommands.h
/* * Copyright (c) 2013-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COMMANDS_H #define COMMANDS_H #include "models/multitrackmodel.h" #include "models/markersmodel.h" #include "docks/timelinedock.h" #include "undohelper.h" #include <QUndoCommand> #include <QString> #include <QObject> #include <QUuid> #include <MltTransition.h> #include <MltProducer.h> #include <vector> namespace Timeline { enum { UndoIdTrimClipIn = 100, UndoIdTrimClipOut, UndoIdFadeIn, UndoIdFadeOut, UndoIdTrimTransitionIn, UndoIdTrimTransitionOut, UndoIdAddTransitionByTrimIn, UndoIdAddTransitionByTrimOut, UndoIdUpdate, UndoIdMoveClip }; struct ClipPosition { ClipPosition(int track, int clip) { trackIndex = track; clipIndex = clip; } bool operator < (const ClipPosition &rhs) const { if (trackIndex == rhs.trackIndex) { return clipIndex < rhs.clipIndex; } else { return trackIndex < rhs.trackIndex; } } int trackIndex; int clipIndex; }; class AppendCommand : public QUndoCommand { public: AppendCommand(MultitrackModel &model, int trackIndex, const QString &xml, bool skipProxy = false, bool seek = true, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; QString m_xml; UndoHelper m_undoHelper; bool m_skipProxy; bool m_seek; }; class InsertCommand : public QUndoCommand { public: InsertCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int position, const QString &xml, bool seek = true, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; MarkersModel &m_markersModel; int m_trackIndex; int m_position; QString m_xml; QStringList m_oldTracks; UndoHelper m_undoHelper; bool m_seek; bool m_rippleAllTracks; bool m_rippleMarkers; int m_markersShift; }; class OverwriteCommand : public QUndoCommand { public: OverwriteCommand(MultitrackModel &model, int trackIndex, int position, const QString &xml, bool seek = true, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; int m_position; QString m_xml; UndoHelper m_undoHelper; bool m_seek; }; class LiftCommand : public QUndoCommand { public: LiftCommand(MultitrackModel &model, int trackIndex, int clipIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; UndoHelper m_undoHelper; }; class RemoveCommand : public QUndoCommand { public: RemoveCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int clipIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; MarkersModel &m_markersModel; int m_trackIndex; int m_clipIndex; UndoHelper m_undoHelper; bool m_rippleAllTracks; bool m_rippleMarkers; int m_markerRemoveStart; int m_markerRemoveEnd; QList<Markers::Marker> m_markers; }; class GroupCommand : public QUndoCommand { public: GroupCommand(MultitrackModel &model, QUndoCommand *parent = 0); void addToGroup(int trackIndex, int clipIndex); void redo(); void undo(); private: MultitrackModel &m_model; QList<ClipPosition> m_clips; QMap<ClipPosition, int> m_prevGroups; }; class UngroupCommand : public QUndoCommand { public: UngroupCommand(MultitrackModel &model, QUndoCommand *parent = 0); void removeFromGroup(int trackIndex, int clipIndex); void redo(); void undo(); private: MultitrackModel &m_model; QMap<ClipPosition, int> m_prevGroups; }; class NameTrackCommand : public QUndoCommand { public: NameTrackCommand(MultitrackModel &model, int trackIndex, const QString &name, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; QString m_name; QString m_oldName; }; class MergeCommand : public QUndoCommand { public: MergeCommand(MultitrackModel &model, int trackIndex, int clipIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; UndoHelper m_undoHelper; }; class MuteTrackCommand : public QUndoCommand { public: MuteTrackCommand(MultitrackModel &model, int trackIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; bool m_oldValue; }; class HideTrackCommand : public QUndoCommand { public: HideTrackCommand(MultitrackModel &model, int trackIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; bool m_oldValue; }; class CompositeTrackCommand : public QUndoCommand { public: CompositeTrackCommand(MultitrackModel &model, int trackIndex, bool value, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; bool m_value; bool m_oldValue; }; class LockTrackCommand : public QUndoCommand { public: LockTrackCommand(MultitrackModel &model, int trackIndex, bool value, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; bool m_value; bool m_oldValue; }; class MoveClipCommand : public QUndoCommand { public: MoveClipCommand(TimelineDock &timeline, int trackDelta, int positionDelta, bool ripple, QUndoCommand *parent = 0); void addClip(int trackIndex, int clipIndex); void redo(); void undo(); protected: int id() const { return UndoIdMoveClip; } bool mergeWith(const QUndoCommand *other); private: void redoMarkers(); TimelineDock &m_timeline; MultitrackModel &m_model; MarkersModel &m_markersModel; struct Info { int trackIndex; int clipIndex; int frame_in; int frame_out; int start; int group; QUuid uuid; Info() : trackIndex(-1) , clipIndex(-1) , frame_in(-1) , frame_out(-1) , start(0) , group(-1) {} }; int m_trackDelta; int m_positionDelta; bool m_ripple; bool m_rippleAllTracks; bool m_rippleMarkers; UndoHelper m_undoHelper; QMultiMap<int, Info> m_clips; // ordered by position bool m_redo; int m_earliestStart; QList<Markers::Marker> m_markers; }; class TrimCommand : public QUndoCommand { public: explicit TrimCommand(QUndoCommand *parent = 0) : QUndoCommand(parent) {} void setUndoHelper(UndoHelper *helper) { m_undoHelper.reset(helper); } protected: QScopedPointer<UndoHelper> m_undoHelper; }; class TrimClipInCommand : public TrimCommand { public: TrimClipInCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int clipIndex, int delta, bool ripple, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdTrimClipIn; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; MarkersModel &m_markersModel; int m_trackIndex; int m_clipIndex; int m_delta; bool m_ripple; bool m_rippleAllTracks; bool m_rippleMarkers; bool m_redo; int m_markerRemoveStart; int m_markerRemoveEnd; QList<Markers::Marker> m_markers; }; class TrimClipOutCommand : public TrimCommand { public: TrimClipOutCommand(MultitrackModel &model, MarkersModel &markersModel, int trackIndex, int clipIndex, int delta, bool ripple, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdTrimClipOut; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; MarkersModel &m_markersModel; int m_trackIndex; int m_clipIndex; int m_delta; bool m_ripple; bool m_rippleAllTracks; bool m_rippleMarkers; bool m_redo; int m_markerRemoveStart; int m_markerRemoveEnd; QList<Markers::Marker> m_markers; }; class SplitCommand : public QUndoCommand { public: SplitCommand(MultitrackModel &model, const std::vector<int> &trackIndex, const std::vector<int> &clipIndex, int position, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; std::vector<int> m_trackIndex; std::vector<int> m_clipIndex; int m_position; UndoHelper m_undoHelper; }; class FadeInCommand : public QUndoCommand { public: FadeInCommand(MultitrackModel &model, int trackIndex, int clipIndex, int duration, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdFadeIn; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_duration; int m_previous; }; class FadeOutCommand : public QUndoCommand { public: FadeOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int duration, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdFadeOut; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_duration; int m_previous; }; class AddTransitionCommand : public QUndoCommand { public: AddTransitionCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int position, bool ripple, QUndoCommand *parent = 0); void redo(); void undo(); int getTransitionIndex() const { return m_transitionIndex; } private: TimelineDock &m_timeline; MultitrackModel &m_model; MarkersModel &m_markersModel; int m_trackIndex; int m_clipIndex; int m_position; int m_transitionIndex; bool m_ripple; UndoHelper m_undoHelper; bool m_rippleAllTracks; bool m_rippleMarkers; int m_markerOldStart; int m_markerNewStart; QList<Markers::Marker> m_markers; }; class TrimTransitionInCommand : public TrimCommand { public: TrimTransitionInCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdTrimTransitionIn; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_delta; bool m_notify; bool m_redo; }; class TrimTransitionOutCommand : public TrimCommand { public: TrimTransitionOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdTrimTransitionOut; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_delta; bool m_notify; bool m_redo; }; class AddTransitionByTrimInCommand : public TrimCommand { public: AddTransitionByTrimInCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int duration, int trimDelta, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdAddTransitionByTrimIn; } bool mergeWith(const QUndoCommand *other); private: TimelineDock &m_timeline; int m_trackIndex; int m_clipIndex; int m_duration; int m_trimDelta; bool m_notify; bool m_redo; }; class RemoveTransitionByTrimInCommand : public TrimCommand { public: RemoveTransitionByTrimInCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, QString xml, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_delta; QString m_xml; bool m_redo; }; class RemoveTransitionByTrimOutCommand : public TrimCommand { public: RemoveTransitionByTrimOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int delta, QString xml, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_delta; QString m_xml; bool m_redo; }; class AddTransitionByTrimOutCommand : public TrimCommand { public: AddTransitionByTrimOutCommand(MultitrackModel &model, int trackIndex, int clipIndex, int duration, int trimDelta, bool redo = true, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdAddTransitionByTrimOut; } bool mergeWith(const QUndoCommand *other); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; int m_duration; int m_trimDelta; bool m_notify; bool m_redo; }; class AddTrackCommand: public QUndoCommand { public: AddTrackCommand(MultitrackModel &model, bool isVideo, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; bool m_isVideo; QUuid m_uuid; }; class InsertTrackCommand : public QUndoCommand { public: InsertTrackCommand(MultitrackModel &model, int trackIndex, TrackType trackType = PlaylistTrackType, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; TrackType m_trackType; QUuid m_uuid; }; class RemoveTrackCommand : public QUndoCommand { public: RemoveTrackCommand(MultitrackModel &model, int trackIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; TrackType m_trackType; QString m_trackName; UndoHelper m_undoHelper; QScopedPointer<Mlt::Producer> m_filtersProducer; QUuid m_uuid; }; class MoveTrackCommand : public QUndoCommand { public: MoveTrackCommand(MultitrackModel &model, int fromTrackIndex, int toTrackIndex, QUndoCommand *parent = 0); void redo(); void undo(); private: MultitrackModel &m_model; int m_fromTrackIndex; int m_toTrackIndex; }; class ChangeBlendModeCommand : public QObject, public QUndoCommand { Q_OBJECT public: ChangeBlendModeCommand(Mlt::Transition &transition, const QString &propertyName, const QString &mode, QUndoCommand *parent = 0); void redo(); void undo(); signals: void modeChanged(QString &mode); private: Mlt::Transition m_transition; QString m_propertyName; QString m_newMode; QString m_oldMode; }; class UpdateCommand : public QUndoCommand { public: UpdateCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int position, QUndoCommand *parent = 0); void setXmlAfter(const QString &xml); void setPosition(int trackIndex, int clipIndex, int position); void setRippleAllTracks(bool); int trackIndex() const { return m_trackIndex; } int clipIndex() const { return m_clipIndex; } int position() const { return m_position; } void redo(); void undo(); private: TimelineDock &m_timeline; int m_trackIndex; int m_clipIndex; int m_position; QString m_xmlAfter; bool m_isFirstRedo; UndoHelper m_undoHelper; bool m_ripple; bool m_rippleAllTracks; }; class DetachAudioCommand: public QUndoCommand { public: DetachAudioCommand(TimelineDock &timeline, int trackIndex, int clipIndex, int position, const QString &xml, QUndoCommand *parent = 0); void redo(); void undo(); private: TimelineDock &m_timeline; int m_trackIndex; int m_clipIndex; int m_position; int m_targetTrackIndex; QString m_xml; UndoHelper m_undoHelper; bool m_trackAdded; QUuid m_uuid; }; class ReplaceCommand : public QUndoCommand { public: ReplaceCommand(MultitrackModel &model, int trackIndex, int clipIndex, const QString &xml, QUndoCommand *parent = nullptr); void redo(); void undo(); private: MultitrackModel &m_model; int m_trackIndex; int m_clipIndex; QString m_xml; bool m_isFirstRedo; UndoHelper m_undoHelper; }; class AlignClipsCommand : public QUndoCommand { public: AlignClipsCommand(MultitrackModel &model, QUndoCommand *parent = 0); void addAlignment(QUuid uuid, int offset, double speedCompensation); void redo(); void undo(); private: MultitrackModel &m_model; UndoHelper m_undoHelper; bool m_redo; struct Alignment { QUuid uuid; int offset; double speed; }; QVector<Alignment> m_alignments; }; class ApplyFiltersCommand : public QUndoCommand { public: ApplyFiltersCommand(MultitrackModel &model, const QString &filterProducerXml, QUndoCommand *parent = 0); void addClip(int trackIndex, int clipIndex); void redo(); void undo(); private: MultitrackModel &m_model; QString m_xml; QMap<ClipPosition, QString> m_prevFilters; }; } // namespace Timeline #endif
18,718
C++
.h
712
21.497191
106
0.692719
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,446
playlistcommands.h
mltframework_shotcut/src/commands/playlistcommands.h
/* * Copyright (c) 2013-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLAYLISTCOMMANDS_H #define PLAYLISTCOMMANDS_H #include "models/playlistmodel.h" #include <QUndoCommand> #include <QString> #include <QUuid> namespace Playlist { enum { UndoIdTrimClipIn = 0, UndoIdTrimClipOut, UndoIdUpdate }; class AppendCommand : public QUndoCommand { public: AppendCommand(PlaylistModel &model, const QString &xml, bool emitModified = true, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; QString m_xml; bool m_emitModified; QUuid m_uuid; }; class InsertCommand : public QUndoCommand { public: InsertCommand(PlaylistModel &model, const QString &xml, int row, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; QString m_xml; int m_row; QUuid m_uuid; }; class UpdateCommand : public QUndoCommand { public: UpdateCommand(PlaylistModel &model, const QString &xml, int row, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdUpdate; } bool mergeWith(const QUndoCommand *other); private: PlaylistModel &m_model; QString m_newXml; QString m_oldXml; int m_row; QUuid m_uuid; }; class RemoveCommand : public QUndoCommand { public: RemoveCommand(PlaylistModel &model, int row, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; QString m_xml; int m_row; QUuid m_uuid; }; class MoveCommand : public QUndoCommand { public: MoveCommand(PlaylistModel &model, int from, int to, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; int m_from; int m_to; }; class ClearCommand : public QUndoCommand { public: ClearCommand(PlaylistModel &model, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; QString m_xml; QVector<QUuid> m_uuids; }; class SortCommand : public QUndoCommand { public: SortCommand(PlaylistModel &model, int column, Qt::SortOrder order, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; int m_column; Qt::SortOrder m_order; QString m_xml; QVector<QUuid> m_uuids; }; class TrimClipInCommand : public QUndoCommand { public: TrimClipInCommand(PlaylistModel &model, int row, int in, QUndoCommand *parent = nullptr); void redo(); void undo(); protected: int id() const { return UndoIdTrimClipIn; } bool mergeWith(const QUndoCommand *other); private: PlaylistModel &m_model; int m_row; int m_oldIn; int m_newIn; int m_out; }; class TrimClipOutCommand : public QUndoCommand { public: TrimClipOutCommand(PlaylistModel &model, int row, int out, QUndoCommand *parent = nullptr); void redo(); void undo(); protected: int id() const { return UndoIdTrimClipOut; } bool mergeWith(const QUndoCommand *other); private: PlaylistModel &m_model; int m_row; int m_in; int m_oldOut; int m_newOut; }; class ReplaceCommand : public QUndoCommand { public: ReplaceCommand(PlaylistModel &model, const QString &xml, int row, QUndoCommand *parent = 0); void redo(); void undo(); private: PlaylistModel &m_model; QString m_newXml; QString m_oldXml; int m_row; QUuid m_uuid; }; } #endif // PLAYLISTCOMMANDS_H
4,169
C++
.h
172
20.767442
97
0.708867
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,447
undohelper.h
mltframework_shotcut/src/commands/undohelper.h
/* * Copyright (c) 2015-2020 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UNDOHELPER_H #define UNDOHELPER_H #include "models/multitrackmodel.h" #include <MltPlaylist.h> #include <QString> #include <QMap> #include <QList> #include <QSet> class UndoHelper { public: enum OptimizationHints { NoHints, SkipXML, RestoreTracks }; UndoHelper(MultitrackModel &model); void recordBeforeState(); void recordAfterState(); void undoChanges(); void setHints(OptimizationHints hints); QSet<int> affectedTracks() const { return m_affectedTracks; } private: void debugPrintState(const QString &title); void restoreAffectedTracks(); void fixTransitions(Mlt::Playlist playlist, int clipIndex, Mlt::Producer clip); enum ChangeFlags { NoChange = 0x0, ClipInfoModified = 0x1, XMLModified = 0x2, Moved = 0x4, Removed = 0x8 }; struct Info { int oldTrackIndex; int oldClipIndex; int newTrackIndex; int newClipIndex; bool isBlank; QString xml; int frame_in; int frame_out; int in_delta; int out_delta; int group; int changes; Info() : oldTrackIndex(-1) , oldClipIndex(-1) , newTrackIndex(-1) , newClipIndex(-1) , isBlank(false) , frame_in(-1) , frame_out(-1) , in_delta(0) , out_delta(0) , changes(NoChange) , group(-1) {} }; QMap<QUuid, Info> m_state; QList<QUuid> m_clipsAdded; QList<QUuid> m_insertedOrder; QSet<int> m_affectedTracks; MultitrackModel &m_model; OptimizationHints m_hints; }; #endif // UNDOHELPER_H
2,441
C++
.h
87
22.091954
83
0.646055
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,448
markercommands.h
mltframework_shotcut/src/commands/markercommands.h
/* * Copyright (c) 2021-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MARKERCOMMANDS_H #define MARKERCOMMANDS_H #include "models/markersmodel.h" #include <QUndoCommand> namespace Markers { enum { UndoIdUpdate = 200, }; class DeleteCommand : public QUndoCommand { public: DeleteCommand(MarkersModel &model, const Marker &delMarker, int index); void redo(); void undo(); private: MarkersModel &m_model; Marker m_delMarker; int m_index; }; class AppendCommand : public QUndoCommand { public: AppendCommand(MarkersModel &model, const Marker &newMarker, int index); void redo(); void undo(); private: MarkersModel &m_model; Marker m_newMarker; int m_index; }; class UpdateCommand : public QUndoCommand { public: UpdateCommand(MarkersModel &model, const Marker &newMarker, const Marker &oldMarker, int index); void redo(); void undo(); protected: int id() const { return UndoIdUpdate; } bool mergeWith(const QUndoCommand *other); private: MarkersModel &m_model; Marker m_newMarker; Marker m_oldMarker; int m_index; }; class ClearCommand : public QUndoCommand { public: ClearCommand(MarkersModel &model, QList<Marker> &clearMarkers); void redo(); void undo(); private: MarkersModel &m_model; QList<Marker> m_clearMarkers; }; } #endif // MARKERCOMMANDS_H
2,017
C++
.h
76
23.578947
100
0.736406
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,449
filtercommands.h
mltframework_shotcut/src/commands/filtercommands.h
/* * Copyright (c) 2021-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FILTERCOMMANDS_H #define FILTERCOMMANDS_H #include "models/attachedfiltersmodel.h" #include <MltService.h> #include <MltProducer.h> #include <QUndoCommand> #include <QString> #include <QUuid> class QmlMetadata; class FilterController; namespace Filter { enum { UndoIdAdd = 300, UndoIdMove, UndoIdDisable, UndoIdChangeParameter, UndoIdChangeAddKeyframe, UndoIdChangeRemoveKeyframe, UndoIdChangeKeyframe, }; class AddCommand : public QUndoCommand { public: typedef enum { AddSingle, AddSet, AddSetLast, } AddType; AddCommand(AttachedFiltersModel &model, const QString &name, Mlt::Service &service, int row, AddCommand::AddType type = AddCommand::AddSingle, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdAdd; } bool mergeWith(const QUndoCommand *other); private: AttachedFiltersModel &m_model; std::vector<int> m_rows; std::vector<Mlt::Service> m_services; Mlt::Producer m_producer; QUuid m_producerUuid; AddType m_type; }; class RemoveCommand : public QUndoCommand { public: RemoveCommand(AttachedFiltersModel &model, const QString &name, Mlt::Service &service, int row, QUndoCommand *parent = 0); void redo(); void undo(); private: AttachedFiltersModel &m_model; int m_index; int m_row; Mlt::Producer m_producer; QUuid m_producerUuid; Mlt::Service m_service; }; class MoveCommand : public QUndoCommand { public: MoveCommand(AttachedFiltersModel &model, const QString &name, int fromRow, int toRow, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdMove; } private: AttachedFiltersModel &m_model; int m_fromRow; int m_toRow; Mlt::Producer m_producer; QUuid m_producerUuid; }; class DisableCommand : public QUndoCommand { public: DisableCommand(AttachedFiltersModel &model, const QString &name, int row, bool disabled, QUndoCommand *parent = 0); void redo(); void undo(); protected: int id() const { return UndoIdDisable; } bool mergeWith(const QUndoCommand *other); private: AttachedFiltersModel &m_model; int m_row; Mlt::Producer m_producer; QUuid m_producerUuid; bool m_disabled; }; class UndoParameterCommand : public QUndoCommand { public: UndoParameterCommand(const QString &name, FilterController *controller, int row, Mlt::Properties &before, const QString &desc = QString(), QUndoCommand *parent = 0); void update(const QString &propertyName); void redo(); void undo(); protected: int id() const { return UndoIdChangeParameter; } bool mergeWith(const QUndoCommand *other); private: int m_row; QUuid m_producerUuid; Mlt::Properties m_before; Mlt::Properties m_after; FilterController *m_filterController; bool m_firstRedo; }; class UndoAddKeyframeCommand : public UndoParameterCommand { public: UndoAddKeyframeCommand(const QString &name, FilterController *controller, int row, Mlt::Properties &before) : UndoParameterCommand(name, controller, row, before, QObject::tr("add keyframe")) {} protected: int id() const { return UndoIdChangeAddKeyframe; } bool mergeWith(const QUndoCommand *other) { return false; } }; class UndoRemoveKeyframeCommand : public UndoParameterCommand { public: UndoRemoveKeyframeCommand(const QString &name, FilterController *controller, int row, Mlt::Properties &before) : UndoParameterCommand(name, controller, row, before, QObject::tr("remove keyframe")) {} protected: int id() const { return UndoIdChangeRemoveKeyframe; } bool mergeWith(const QUndoCommand *other) { return false; } }; class UndoModifyKeyframeCommand : public UndoParameterCommand { public: UndoModifyKeyframeCommand(const QString &name, FilterController *controller, int row, Mlt::Properties &before, int paramIndex, int keyframeIndex) : UndoParameterCommand(name, controller, row, before, QObject::tr("modify keyframe")) , m_paramIndex(paramIndex) , m_keyframeIndex(keyframeIndex) {} protected: int id() const { return UndoIdChangeRemoveKeyframe; } bool mergeWith(const QUndoCommand *other) { auto *that = dynamic_cast<const UndoModifyKeyframeCommand *>(other); if (!that || m_paramIndex != that->m_paramIndex || m_keyframeIndex != that->m_keyframeIndex) return false; else return UndoParameterCommand::mergeWith(other); } private: int m_paramIndex; int m_keyframeIndex; }; } // namespace Filter #endif // FILTERCOMMANDS_H
5,680
C++
.h
200
23.545
110
0.696559
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,450
filtercontroller.h
mltframework_shotcut/src/controllers/filtercontroller.h
/* * Copyright (c) 2014-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FILTERCONTROLLER_H #define FILTERCONTROLLER_H #include <QObject> #include <QScopedPointer> #include <QFuture> #include "models/metadatamodel.h" #include "models/motiontrackermodel.h" #include "models/attachedfiltersmodel.h" #include "qmltypes/qmlmetadata.h" #include "qmltypes/qmlfilter.h" class QTimerEvent; class FilterController : public QObject { Q_OBJECT public: explicit FilterController(QObject *parent = 0); MetadataModel *metadataModel(); MotionTrackerModel *motionTrackerModel() { return &m_motionTrackerModel; } AttachedFiltersModel *attachedModel(); QmlMetadata *metadata(const QString &id); QmlMetadata *metadataForService(Mlt::Service *service); QmlFilter *currentFilter() const { return m_currentFilter.data(); } bool isOutputTrackSelected() const; void onUndoOrRedo(Mlt::Service &service); int currentIndex() const { return m_currentFilterIndex; } void addOrEditFilter(Mlt::Filter *filter, const QStringList &key_properties); protected: void timerEvent(QTimerEvent *); signals: void currentFilterChanged(QmlFilter *filter, QmlMetadata *meta, int index); void statusChanged(QString); void filterChanged(Mlt::Service *); void undoOrRedo(); public slots: void setProducer(Mlt::Producer *producer = 0); void setCurrentFilter(int attachedIndex); void onFadeInChanged(); void onFadeOutChanged(); void onServiceInChanged(int delta, Mlt::Service *service = 0); void onServiceOutChanged(int delta, Mlt::Service *service = 0); void removeCurrent(); void onProducerChanged(); private slots: void handleAttachedModelChange(); void handleAttachedModelAboutToReset(); void addMetadata(QmlMetadata *); void handleAttachedRowsAboutToBeRemoved(const QModelIndex &parent, int first, int last); void handleAttachedRowsRemoved(const QModelIndex &parent, int first, int last); void handleAttachedRowsInserted(const QModelIndex &parent, int first, int last); void handleAttachDuplicateFailed(int index); void onQmlFilterChanged(const QString &name); private: void loadFilterSets(); void loadFilterMetadata(); QFuture<void> m_future; QScopedPointer<QmlFilter> m_currentFilter; Mlt::Service m_mltService; MetadataModel m_metadataModel; MotionTrackerModel m_motionTrackerModel; AttachedFiltersModel m_attachedModel; int m_currentFilterIndex; }; #endif // FILTERCONTROLLER_H
3,201
C++
.h
88
32.590909
92
0.7596
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,451
scopecontroller.h
mltframework_shotcut/src/controllers/scopecontroller.h
/* * Copyright (c) 2015-2016 Meltytech, LLC * Author: Brian Matherly <code@brianmatherly.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SCOPECONTROLLER_H #define SCOPECONTROLLER_H #include <QObject> #include <QString> #include "sharedframe.h" class QMainWindow; class QMenu; class QWidget; class ScopeController Q_DECL_FINAL : public QObject { Q_OBJECT public: ScopeController(QMainWindow *mainWindow, QMenu *menu); signals: void newFrame(const SharedFrame &frame); private: template<typename ScopeTYPE> void createScopeDock(QMainWindow *mainWindow, QMenu *menu); }; #endif // SCOPECONTROLLER_H
1,241
C++
.h
36
32.333333
92
0.775084
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,452
meltjob.h
mltframework_shotcut/src/jobs/meltjob.h
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MELTJOB_H #define MELTJOB_H #include "abstractjob.h" #include <QTemporaryFile> #include <MltProfile.h> class MeltJob : public AbstractJob { Q_OBJECT public: MeltJob(const QString &name, const QString &xml, int frameRateNum, int frameRateDen, QThread::Priority priority = Settings.jobPriority()); MeltJob(const QString &name, const QStringList &args, int frameRateNum, int frameRateDen); MeltJob(const QString &name, const QString &xml, const QStringList &args, int frameRateNum, int frameRateDen); virtual ~MeltJob(); QString xml(); QString xmlPath() const { return m_xml->fileName(); } void setIsStreaming(bool streaming); void setUseMultiConsumer(bool multi = true); void setInAndOut(int in, int out); public slots: void start(); void onViewXmlTriggered(); protected slots: virtual void onOpenTiggered(); virtual void onFinished(int exitCode, QProcess::ExitStatus exitStatus); void onShowFolderTriggered(); void onReadyRead(); protected: QScopedPointer<QTemporaryFile> m_xml; private: bool m_isStreaming; int m_previousPercent; QStringList m_args; int m_currentFrame; Mlt::Profile m_profile; bool m_useMultiConsumer; int m_in {-1}; int m_out {-1}; }; #endif // MELTJOB_H
2,028
C++
.h
60
30.066667
95
0.730985
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,453
ffprobejob.h
mltframework_shotcut/src/jobs/ffprobejob.h
/* * Copyright (c) 2016-2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FFPROBEJOB_H #define FFPROBEJOB_H #include "abstractjob.h" #include <QStringList> class FfprobeJob : public AbstractJob { Q_OBJECT public: FfprobeJob(const QString &name, const QStringList &args); virtual ~FfprobeJob(); void start(); protected slots: virtual void onFinished(int exitCode, QProcess::ExitStatus exitStatus); private: QStringList m_args; }; #endif // FFPROBEJOB_H
1,114
C++
.h
33
31.393939
75
0.76
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,455
ffmpegjob.h
mltframework_shotcut/src/jobs/ffmpegjob.h
/* * Copyright (c) 2016-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FFMPEGJOB_H #define FFMPEGJOB_H #include "abstractjob.h" #include <QStringList> class FfmpegJob : public AbstractJob { Q_OBJECT public: FfmpegJob(const QString &name, const QStringList &args, bool isOpenLog = true, QThread::Priority priority = Settings.jobPriority()); virtual ~FfmpegJob(); void start(); public slots: virtual void stop(); private slots: void onOpenTriggered(); void onReadyRead(); private: QStringList m_args; QString m_duration; bool m_outputMsgRead; int m_totalFrames; int m_previousPercent; bool m_isOpenLog; }; #endif // FFMPEGJOB_H
1,334
C++
.h
42
28.666667
82
0.7393
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,456
abstractjob.h
mltframework_shotcut/src/jobs/abstractjob.h
/* * Copyright (c) 2012-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ABSTRACTJOB_H #define ABSTRACTJOB_H #include "postjobaction.h" #include "settings.h" #include <QProcess> #include <QModelIndex> #include <QList> #include <QElapsedTimer> #include <QThread> class QAction; class QStandardItem; class AbstractJob : public QProcess { Q_OBJECT public: explicit AbstractJob(const QString &name, QThread::Priority priority = Settings.jobPriority()); virtual ~AbstractJob() {} void setStandardItem(QStandardItem *item); QStandardItem *standardItem(); bool ran() const; bool stopped() const; void appendToLog(const QString &); QString log() const; QString label() const { return m_label; } void setLabel(const QString &label); QList<QAction *> standardActions() const { return m_standardActions; } QList<QAction *> successActions() const { return m_successActions; } QTime estimateRemaining(int percent); QElapsedTimer time() const { return m_totalTime; } void setPostJobAction(PostJobAction *action); bool paused() const; public slots: void start(const QString &program, const QStringList &arguments); virtual void start(); virtual void stop(); void pause(); void resume(); signals: void progressUpdated(QStandardItem *item, int percent); void finished(AbstractJob *job, bool isSuccess, QString failureTime = QString()); protected: QList<QAction *> m_standardActions; QList<QAction *> m_successActions; QStandardItem *m_item; protected slots: virtual void onFinished(int exitCode, QProcess::ExitStatus exitStatus = QProcess::NormalExit); virtual void onReadyRead(); virtual void onStarted(); private slots: void onProgressUpdated(QStandardItem *, int percent); private: bool m_ran; bool m_killed; QString m_log; QString m_label; QElapsedTimer m_estimateTime; int m_startingPercent; QElapsedTimer m_totalTime; QScopedPointer<PostJobAction> m_postJobAction; QThread::Priority m_priority; QAction *m_actionPause; QAction *m_actionResume; }; #endif // ABSTRACTJOB_H
2,839
C++
.h
92
27.032609
99
0.730432
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,457
gopro2gpxjob.h
mltframework_shotcut/src/jobs/gopro2gpxjob.h
/* * Copyright (c) 2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef GOPRO2GPXJOB_H #define GOPRO2GPXJOB_H #include "abstractjob.h" #include <QStringList> class GoPro2GpxJob : public AbstractJob { Q_OBJECT public: GoPro2GpxJob(const QString &name, const QStringList &args); virtual ~GoPro2GpxJob() {}; void start(); private: QStringList m_args; }; #endif // GOPRO2GPXJOB_H
1,030
C++
.h
31
30.935484
72
0.755533
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,458
whisperjob.h
mltframework_shotcut/src/jobs/whisperjob.h
/* * Copyright (c) 2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef WHISPERJOB_H #define WHISPERJOB_H #include "abstractjob.h" #include <QTemporaryFile> class WhisperJob : public AbstractJob { Q_OBJECT public: WhisperJob(const QString &name, const QString &iWavFile, const QString &oSrtFile, const QString &lang, bool translate, int maxLength, QThread::Priority priority = Settings.jobPriority()); virtual ~WhisperJob(); public slots: void start(); void onViewSrtTriggered(); protected slots: void onReadyRead(); private: const QString m_iWavFile; const QString m_oSrtFile; const QString m_lang; const bool m_translate; const int m_maxLength; int m_previousPercent; }; #endif // WHISPERJOB_H
1,410
C++
.h
42
30.190476
85
0.739162
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,459
encodejob.h
mltframework_shotcut/src/jobs/encodejob.h
/* * Copyright (c) 2012-2022 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ENCODEJOB_H #define ENCODEJOB_H #include "meltjob.h" #include <QThread> class EncodeJob : public MeltJob { Q_OBJECT public: EncodeJob(const QString &name, const QString &xml, int frameRateNum, int frameRateDen, const QThread::Priority priority); private slots: void onVideoQualityTriggered(); void onSpatialMediaTriggered(); protected slots: void onFinished(int exitCode, QProcess::ExitStatus exitStatus); }; #endif // ENCODEJOB_H
1,177
C++
.h
33
33
90
0.758348
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,460
postjobaction.h
mltframework_shotcut/src/jobs/postjobaction.h
/* * Copyright (c) 2018-2024 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef POSTJOBACTION_H #define POSTJOBACTION_H #include <QString> #include <QUuid> class PostJobAction { public: virtual ~PostJobAction() {} virtual void doAction() = 0; }; class FilePropertiesPostJobAction : public PostJobAction { public: FilePropertiesPostJobAction(const QString &srcFile, const QString &dstFile) : m_srcFile(srcFile) , m_dstFile(dstFile) {} virtual ~FilePropertiesPostJobAction() {} virtual void doAction(); protected: QString m_srcFile; QString m_dstFile; }; class OpenPostJobAction : public FilePropertiesPostJobAction { public: OpenPostJobAction(const QString &srcFile, const QString &dstFile, const QString &fileNameToRemove) : FilePropertiesPostJobAction(srcFile, dstFile) , m_fileNameToRemove(fileNameToRemove) {} void doAction(); private: QString m_fileNameToRemove; }; class ReplaceOnePostJobAction : public FilePropertiesPostJobAction { public: ReplaceOnePostJobAction(const QString &srcFile, const QString &dstFile, const QString &fileNameToRemove, const QUuid &srcUuid, int in) : FilePropertiesPostJobAction(srcFile, dstFile) , m_fileNameToRemove(fileNameToRemove) , m_uuid(srcUuid) , m_in(in) {} void doAction(); private: QString m_fileNameToRemove; QUuid m_uuid; int m_in; }; class ReplaceAllPostJobAction : public FilePropertiesPostJobAction { public: ReplaceAllPostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash) : FilePropertiesPostJobAction(srcFile, dstFile) , m_hash(srcHash) {} void doAction(); private: QString m_hash; }; class ProxyReplacePostJobAction : public FilePropertiesPostJobAction { public: ProxyReplacePostJobAction(const QString &srcFile, const QString &dstFile, const QString &srcHash) : FilePropertiesPostJobAction(srcFile, dstFile) , m_srcFile(srcFile) , m_dstFile(dstFile) , m_hash(srcHash) {} void doAction(); private: QString m_srcFile; QString m_dstFile; QString m_hash; }; class ProxyFinalizePostJobAction : public FilePropertiesPostJobAction { public: ProxyFinalizePostJobAction(const QString &srcFile, const QString &dstFile) : FilePropertiesPostJobAction(srcFile, dstFile) , m_dstFile(dstFile) {} void doAction(); private: QString m_dstFile; }; class SubtitlesDock; class ImportSrtPostJobAction : public PostJobAction { public: ImportSrtPostJobAction(const QString &srtFile, const QString &trackName, const QString &lang, bool includeNonspoken, SubtitlesDock *dock) : m_srtFile(srtFile) , m_trackName(trackName) , m_lang(lang) , m_includeNonspoken(includeNonspoken) , m_dock(dock) {} virtual ~ImportSrtPostJobAction() {} void doAction(); protected: const QString m_srtFile; const QString m_trackName; const QString m_lang; const bool m_includeNonspoken; SubtitlesDock *m_dock; }; #endif // POSTJOBACTION_H
3,808
C++
.h
125
26.096
102
0.728985
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,461
videoqualityjob.h
mltframework_shotcut/src/jobs/videoqualityjob.h
/* * Copyright (c) 2012-2018 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef VIDEOQUALITYJOB_H #define VIDEOQUALITYJOB_H #include "meltjob.h" class VideoQualityJob : public MeltJob { Q_OBJECT public: VideoQualityJob(const QString &name, const QString &xml, const QString &reportPath, int frameRateNum, int frameRateDen); private slots: void onOpenTiggered(); void onViewReportTriggered(); private: QString m_reportPath; }; #endif // VIDEOQUALITYJOB_H
1,126
C++
.h
32
32.28125
83
0.753676
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,462
bitrateviewerjob.h
mltframework_shotcut/src/jobs/bitrateviewerjob.h
/* * Copyright (c) 2023 Meltytech, LLC * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef BITRATEVIEWERJOB_H #define BITRATEVIEWERJOB_H #include "ffprobejob.h" #include <QJsonArray> class BitrateViewerJob : public FfprobeJob { Q_OBJECT public: BitrateViewerJob(const QString &name, const QStringList &args, double fps); virtual ~BitrateViewerJob(); private slots: virtual void onFinished(int exitCode, QProcess::ExitStatus exitStatus); void onOpenTriggered(); private: QString m_resource; double m_fps {0.0}; QJsonArray m_data; }; #endif // BITRATEVIEWERJOB_H
1,250
C++
.h
35
32.028571
80
0.739817
mltframework/shotcut
10,796
1,118
50
GPL-3.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,463
DaemonApp.cpp
deskflow_deskflow/src/lib/deskflow/DaemonApp.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012 Symless Ltd. * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // TODO: split this class into windows and unix to get rid // of all the #ifdefs! #include "deskflow/DaemonApp.h" #include "arch/XArch.h" #include "base/EventQueue.h" #include "base/Log.h" #include "base/TMethodEventJob.h" #include "base/log_outputters.h" #include "common/constants.h" #include "common/ipc.h" #include "deskflow/App.h" #include "deskflow/ArgParser.h" #include "deskflow/ClientArgs.h" #include "deskflow/ServerArgs.h" #include "ipc/IpcClientProxy.h" #include "ipc/IpcLogOutputter.h" #include "ipc/IpcMessage.h" #include "ipc/IpcSettingMessage.h" #include "net/SocketMultiplexer.h" #if SYSAPI_WIN32 #include "arch/win32/ArchMiscWindows.h" #include "deskflow/Screen.h" #include "platform/MSWindowsDebugOutputter.h" #include "platform/MSWindowsEventQueueBuffer.h" #include "platform/MSWindowsWatchdog.h" #define WIN32_LEAN_AND_MEAN #include <Windows.h> #elif SYSAPI_UNIX #include <iostream> #endif #include <memory> #include <sstream> #include <string> using namespace std; const char *const kLogFilename = "deskflow-daemon.log"; namespace { void updateSetting(const IpcMessage &message) { try { auto setting = static_cast<const IpcSettingMessage &>(message); ARCH->setting(setting.getName(), setting.getValue()); } catch (const XArch &e) { LOG((CLOG_ERR "failed to save setting: %s", e.what())); } } bool isServerCommandLine(const std::vector<String> &cmd) { auto isServer = false; if (cmd.size() > 1) { isServer = (cmd[0].find("deskflow-server") != String::npos) || (cmd[0].find("deskflow-core") != String::npos && cmd[1] == "server"); } return isServer; } } // namespace DaemonApp *DaemonApp::s_instance = nullptr; int mainLoopStatic() { DaemonApp::s_instance->mainLoop(true); return kExitSuccess; } int unixMainLoopStatic(int, const char **) { return mainLoopStatic(); } #if SYSAPI_WIN32 int winMainLoopStatic(int, const char **) { return ArchMiscWindows::runDaemon(mainLoopStatic); } #endif DaemonApp::DaemonApp() { s_instance = this; } DaemonApp::~DaemonApp() { s_instance = nullptr; } int DaemonApp::run(int argc, char **argv) { #if SYSAPI_WIN32 // win32 instance needed for threading, etc. ArchMiscWindows::setInstanceWin32(GetModuleHandle(NULL)); #endif Arch arch; arch.init(); Log log; m_events = std::make_unique<EventQueue>(); bool uninstall = false; try { #if SYSAPI_WIN32 // TODO: maybe we should only add this if not using /f? // sends debug messages to visual studio console window. log.insert(new MSWindowsDebugOutputter()); #endif // default log level to system setting. if (string logLevel = arch.setting("LogLevel"); logLevel != "") log.setFilter(logLevel.c_str()); bool foreground = false; for (int i = 1; i < argc; ++i) { string arg(argv[i]); if (arg == "/f" || arg == "-f") { foreground = true; } #if SYSAPI_WIN32 else if (arg == "/install") { LOG((CLOG_PRINT "installing windows daemon")); uninstall = true; arch.installDaemon(); return kExitSuccess; } else if (arg == "/uninstall") { LOG((CLOG_PRINT "uninstalling windows daemon")); arch.uninstallDaemon(); return kExitSuccess; } #endif else { stringstream ss; ss << "Unrecognized argument: " << arg; foregroundError(ss.str().c_str()); return kExitArgs; } } if (foreground) { LOG((CLOG_PRINT "starting daemon in foreground")); // run process in foreground instead of daemonizing. // useful for debugging. mainLoop(false, foreground); } else { #if SYSAPI_WIN32 LOG((CLOG_PRINT "daemonizing windows service")); arch.daemonize(kAppName, winMainLoopStatic); #elif SYSAPI_UNIX LOG((CLOG_PRINT "daemonizing unix service")); arch.daemonize(kAppName, unixMainLoopStatic); #endif } return kExitSuccess; } catch (XArch &e) { String message = e.what(); if (uninstall && (message.find("The service has not been started") != String::npos)) { // TODO: if we're keeping this use error code instead (what is it?!). // HACK: this message happens intermittently, not sure where from but // it's quite misleading for the user. they thing something has gone // horribly wrong, but it's just the service manager reporting a false // positive (the service has actually shut down in most cases). } else { foregroundError(message.c_str()); } return kExitFailed; } catch (std::exception &e) { foregroundError(e.what()); return kExitFailed; } catch (...) { foregroundError("Unrecognized error."); return kExitFailed; } } void DaemonApp::mainLoop(bool logToFile, bool foreground) { try { DAEMON_RUNNING(true); if (logToFile) { m_fileLogOutputter = std::make_unique<FileLogOutputter>(logFilename().c_str()); CLOG->insert(m_fileLogOutputter.get()); } // create socket multiplexer. this must happen after daemonization // on unix because threads evaporate across a fork(). SocketMultiplexer multiplexer; // uses event queue, must be created here. m_ipcServer = std::make_unique<IpcServer>(m_events.get(), &multiplexer); // send logging to gui via ipc, log system adopts outputter. m_ipcLogOutputter = std::make_unique<IpcLogOutputter>(*m_ipcServer, IpcClientType::GUI, true); CLOG->insert(m_ipcLogOutputter.get()); #if SYSAPI_WIN32 m_watchdog = std::make_unique<MSWindowsWatchdog>(false, *m_ipcServer, *m_ipcLogOutputter, foreground); m_watchdog->setFileLogOutputter(m_fileLogOutputter.get()); #endif m_events->adoptHandler( m_events->forIpcServer().messageReceived(), m_ipcServer.get(), new TMethodEventJob<DaemonApp>(this, &DaemonApp::handleIpcMessage) ); m_ipcServer->listen(); #if SYSAPI_WIN32 // install the platform event queue to handle service stop events. m_events->adoptBuffer(new MSWindowsEventQueueBuffer(m_events.get())); String command = ARCH->setting("Command"); bool elevate = ARCH->setting("Elevate") == "1"; if (command != "") { LOG((CLOG_INFO "using last known command: %s", command.c_str())); m_watchdog->setCommand(command, elevate); } m_watchdog->startAsync(); #endif m_events->loop(); #if SYSAPI_WIN32 m_watchdog->stop(); #endif m_events->removeHandler(m_events->forIpcServer().messageReceived(), m_ipcServer.get()); CLOG->remove(m_ipcLogOutputter.get()); DAEMON_RUNNING(false); } catch (std::exception &e) { LOG((CLOG_CRIT "an error occurred: %s", e.what())); } catch (...) { LOG((CLOG_CRIT "an unknown error occurred.\n")); } } void DaemonApp::foregroundError(const char *message) { #if SYSAPI_WIN32 MessageBox(NULL, message, "Deskflow Service", MB_OK | MB_ICONERROR); #elif SYSAPI_UNIX cerr << message << endl; #endif } std::string DaemonApp::logFilename() { string logFilename; logFilename = ARCH->setting("LogFilename"); if (logFilename.empty()) { logFilename = ARCH->getLogDirectory(); logFilename.append("/"); logFilename.append(kLogFilename); } return logFilename; } void DaemonApp::handleIpcMessage(const Event &e, void *) { IpcMessage *m = static_cast<IpcMessage *>(e.getDataObject()); switch (m->type()) { case IpcMessageType::Command: { IpcCommandMessage *cm = static_cast<IpcCommandMessage *>(m); String command = cm->command(); // if empty quotes, clear. if (command == "\"\"") { command.clear(); } if (!command.empty()) { LOG((CLOG_DEBUG "daemon got new core command")); LOG((CLOG_DEBUG2 "new command, elevate=%d command=%s", cm->elevate(), command.c_str())); std::vector<String> argsArray; ArgParser::splitCommandString(command, argsArray); ArgParser argParser(NULL); const char **argv = argParser.getArgv(argsArray); int argc = static_cast<int>(argsArray.size()); if (isServerCommandLine(argsArray)) { auto serverArgs = new deskflow::ServerArgs(); argParser.parseServerArgs(*serverArgs, argc, argv); } else { auto clientArgs = new deskflow::ClientArgs(); argParser.parseClientArgs(*clientArgs, argc, argv); } delete[] argv; String logLevel(ArgParser::argsBase().m_logFilter); if (!logLevel.empty()) { try { // change log level based on that in the command string // and change to that log level now. ARCH->setting("LogLevel", logLevel); CLOG->setFilter(logLevel.c_str()); } catch (XArch &e) { LOG((CLOG_ERR "failed to save LogLevel setting, %s", e.what())); } } } else { LOG((CLOG_DEBUG "empty command, elevate=%d", cm->elevate())); } try { // store command in system settings. this is used when the daemon // next starts. ARCH->setting("Command", command); // TODO: it would be nice to store bools/ints... ARCH->setting("Elevate", String(cm->elevate() ? "1" : "0")); } catch (XArch &e) { LOG((CLOG_ERR "failed to save settings, %s", e.what())); } #if SYSAPI_WIN32 // tell the relauncher about the new command. this causes the // relauncher to stop the existing command and start the new // command. m_watchdog->setCommand(command, cm->elevate()); #endif break; } case IpcMessageType::Hello: { IpcHelloMessage *hm = static_cast<IpcHelloMessage *>(m); String type; switch (hm->clientType()) { case IpcClientType::GUI: type = "gui"; break; case IpcClientType::Node: type = "node"; break; default: type = "unknown"; break; } LOG((CLOG_DEBUG "ipc hello, type=%s", type.c_str())); // TODO: implement hello back handling in s1 gui and node (server/client). if (hm->clientType() == IpcClientType::GUI) { LOG((CLOG_DEBUG "sending ipc hello back")); IpcHelloBackMessage hbm; m_ipcServer->send(hbm, hm->clientType()); } #if SYSAPI_WIN32 String watchdogStatus = m_watchdog->isProcessActive() ? "active" : "idle"; LOG((CLOG_INFO "service status: %s", watchdogStatus.c_str())); #endif m_ipcLogOutputter->notifyBuffer(); break; } case IpcMessageType::Setting: updateSetting(*m); break; default: LOG((CLOG_DEBUG "ipc message ignored")); break; } }
11,130
C++
.cpp
337
28.682493
106
0.678012
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,464
ServerArgs.cpp
deskflow_deskflow/src/lib/deskflow/ServerArgs.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2014-2020 Symless Ltd. * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ServerArgs.h" namespace deskflow { ServerArgs::~ServerArgs() { } ServerArgs::ServerArgs() { m_classType = kServer; } } // namespace deskflow
848
C++
.cpp
26
30.807692
72
0.760391
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,466
IPlatformScreen.cpp
deskflow_deskflow/src/lib/deskflow/IPlatformScreen.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2016 Symless. * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file COPYING that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/IPlatformScreen.h" bool IPlatformScreen::fakeMediaKey(KeyID id) { return false; }
787
C++
.cpp
21
35.571429
72
0.767016
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,467
protocol_types.cpp
deskflow_deskflow/src/lib/deskflow/protocol_types.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/protocol_types.h" const char *const kSynergyProtocolName = "Synergy"; const char *const kBarrierProtocolName = "Barrier"; // The protocol name string within the hello and hello back messages must be // 7 chars for backward compatibility (Synergy and Barrier are 7 chars). const char *const kMsgHello = "%7s%2i%2i"; const char *const kMsgHelloArgs = "%2i%2i"; const char *const kMsgHelloBack = "%7s%2i%2i%s"; const char *const kMsgHelloBackArgs = "%2i%2i%s"; const char *const kMsgCNoop = "CNOP"; const char *const kMsgCClose = "CBYE"; const char *const kMsgCEnter = "CINN%2i%2i%4i%2i"; const char *const kMsgCLeave = "COUT"; const char *const kMsgCClipboard = "CCLP%1i%4i"; const char *const kMsgCScreenSaver = "CSEC%1i"; const char *const kMsgCResetOptions = "CROP"; const char *const kMsgCInfoAck = "CIAK"; const char *const kMsgCKeepAlive = "CALV"; const char *const kMsgDKeyDownLang = "DKDL%2i%2i%2i%s"; const char *const kMsgDKeyDown = "DKDN%2i%2i%2i"; const char *const kMsgDKeyDown1_0 = "DKDN%2i%2i"; const char *const kMsgDKeyRepeat = "DKRP%2i%2i%2i%2i%s"; const char *const kMsgDKeyRepeat1_0 = "DKRP%2i%2i%2i"; const char *const kMsgDKeyUp = "DKUP%2i%2i%2i"; const char *const kMsgDKeyUp1_0 = "DKUP%2i%2i"; const char *const kMsgDMouseDown = "DMDN%1i"; const char *const kMsgDMouseUp = "DMUP%1i"; const char *const kMsgDMouseMove = "DMMV%2i%2i"; const char *const kMsgDMouseRelMove = "DMRM%2i%2i"; const char *const kMsgDMouseWheel = "DMWM%2i%2i"; const char *const kMsgDMouseWheel1_0 = "DMWM%2i"; const char *const kMsgDClipboard = "DCLP%1i%4i%1i%s"; const char *const kMsgDInfo = "DINF%2i%2i%2i%2i%2i%2i%2i"; const char *const kMsgDSetOptions = "DSOP%4I"; const char *const kMsgDFileTransfer = "DFTR%1i%s"; const char *const kMsgDDragInfo = "DDRG%2i%s"; const char *const kMsgDSecureInputNotification = "SECN%s"; const char *const kMsgDLanguageSynchronisation = "LSYN%s"; const char *const kMsgQInfo = "QINF"; const char *const kMsgEIncompatible = "EICV%2i%2i"; const char *const kMsgEBusy = "EBSY"; const char *const kMsgEUnknown = "EUNK"; const char *const kMsgEBad = "EBAD";
2,841
C++
.cpp
60
46.033333
76
0.75414
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,468
PlatformScreen.cpp
deskflow_deskflow/src/lib/deskflow/PlatformScreen.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2004 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/PlatformScreen.h" #include "deskflow/App.h" #include "deskflow/ArgsBase.h" PlatformScreen::PlatformScreen(IEventQueue *events, deskflow::ClientScrollDirection scrollDirection) : IPlatformScreen(events), m_draggingStarted(false), m_fakeDraggingStarted(false), m_clientScrollDirection(scrollDirection) { } PlatformScreen::~PlatformScreen() { // do nothing } void PlatformScreen::updateKeyMap() { getKeyState()->updateKeyMap(); } void PlatformScreen::updateKeyState() { getKeyState()->updateKeyState(); updateButtons(); } void PlatformScreen::setHalfDuplexMask(KeyModifierMask mask) { getKeyState()->setHalfDuplexMask(mask); } void PlatformScreen::fakeKeyDown(KeyID id, KeyModifierMask mask, KeyButton button, const String &lang) { getKeyState()->fakeKeyDown(id, mask, button, lang); } bool PlatformScreen::fakeKeyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button, const String &lang) { return getKeyState()->fakeKeyRepeat(id, mask, count, button, lang); } bool PlatformScreen::fakeKeyUp(KeyButton button) { return getKeyState()->fakeKeyUp(button); } void PlatformScreen::fakeAllKeysUp() { getKeyState()->fakeAllKeysUp(); } bool PlatformScreen::fakeCtrlAltDel() { return getKeyState()->fakeCtrlAltDel(); } bool PlatformScreen::isKeyDown(KeyButton button) const { return getKeyState()->isKeyDown(button); } KeyModifierMask PlatformScreen::getActiveModifiers() const { return getKeyState()->getActiveModifiers(); } KeyModifierMask PlatformScreen::pollActiveModifiers() const { return getKeyState()->pollActiveModifiers(); } SInt32 PlatformScreen::pollActiveGroup() const { return getKeyState()->pollActiveGroup(); } void PlatformScreen::pollPressedKeys(KeyButtonSet &pressedKeys) const { getKeyState()->pollPressedKeys(pressedKeys); } bool PlatformScreen::isDraggingStarted() { if (App::instance().argsBase().m_enableDragDrop) { return m_draggingStarted; } return false; } SInt32 PlatformScreen::mapClientScrollDirection(SInt32 x) const { return (x * m_clientScrollDirection); }
2,825
C++
.cpp
95
27.705263
118
0.786136
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
true
false
false
13,469
App.cpp
deskflow_deskflow/src/lib/deskflow/App.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/App.h" #include "DisplayInvalidException.h" #include "arch/Arch.h" #include "arch/XArch.h" #include "base/EventQueue.h" #include "base/Log.h" #include "base/TMethodEventJob.h" #include "base/XBase.h" #include "base/log_outputters.h" #include "common/constants.h" #include "common/copyright.h" #include "common/ipc.h" #include "common/version.h" #include "deskflow/ArgsBase.h" #include "deskflow/Config.h" #include "deskflow/XDeskflow.h" #include "deskflow/protocol_types.h" #include "ipc/IpcMessage.h" #include "ipc/IpcServerProxy.h" #if SYSAPI_WIN32 #include "arch/win32/ArchMiscWindows.h" #include "base/IEventQueue.h" #include "base/TMethodJob.h" #endif #if WINAPI_CARBON #include "platform/OSXDragSimulator.h" #endif #include <charconv> #include <filesystem> #include <iostream> #include <sstream> #include <stdexcept> #include <stdio.h> #include <vector> #if WINAPI_CARBON #include <ApplicationServices/ApplicationServices.h> #endif #include <CLI/CLI.hpp> using namespace deskflow; App *App::s_instance = nullptr; // // App // App::App(IEventQueue *events, CreateTaskBarReceiverFunc createTaskBarReceiver, deskflow::ArgsBase *args) : m_bye(&exit), m_taskBarReceiver(NULL), m_suspended(false), m_events(events), m_args(args), m_fileLog(nullptr), m_createTaskBarReceiver(createTaskBarReceiver), m_appUtil(events), m_ipcClient(nullptr), m_socketMultiplexer(nullptr) { assert(s_instance == nullptr); s_instance = this; } App::~App() { s_instance = nullptr; delete m_args; } void App::version() { const auto version = deskflow::version(); const auto kBufferLength = 1024; std::vector<char> buffer(kBufferLength); std::snprintf( // NOSONAR buffer.data(), kBufferLength, "%s v%s, protocol v%d.%d\n%s", // argsBase().m_pname, version.c_str(), kProtocolMajorVersion, kProtocolMinorVersion, deskflow::kCopyright ); std::cout << std::string(buffer.data()) << std::endl; } int App::run(int argc, char **argv) { #if MAC_OS_X_VERSION_10_7 // dock hide only supported on lion :( ProcessSerialNumber psn = {0, kCurrentProcess}; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" GetCurrentProcess(&psn); #pragma GCC diagnostic pop TransformProcessType(&psn, kProcessTransformToBackgroundApplication); #endif // install application in to arch appUtil().adoptApp(this); // HACK: fail by default (saves us setting result in each catch) int result = kExitFailed; try { result = appUtil().run(argc, argv); } catch (XExitApp &e) { // instead of showing a nasty error, just exit with the error code. // not sure if i like this behaviour, but it's probably better than // using the exit(int) function! result = e.getCode(); } catch (DisplayInvalidException &die) { LOG((CLOG_CRIT "a display invalid exception error occurred: %s\n", die.what())); // display invalid exceptions can occur when going to sleep. When this // process exits, the UI will restart us instantly. We don't really want // that behevior, so we quies for a bit ARCH->sleep(10); } catch (std::runtime_error &re) { LOG((CLOG_CRIT "a runtime error occurred: %s\n", re.what())); } catch (std::exception &e) { LOG((CLOG_CRIT "an error occurred: %s\n", e.what())); } catch (...) { LOG((CLOG_CRIT "an unknown error occurred\n")); } appUtil().beforeAppExit(); return result; } int App::daemonMainLoop(int, const char **) { #if SYSAPI_WIN32 SystemLogger sysLogger(daemonName(), false); #else SystemLogger sysLogger(daemonName(), true); #endif return mainLoop(); } void App::setupFileLogging() { if (argsBase().m_logFile != NULL) { m_fileLog = new FileLogOutputter(argsBase().m_logFile); CLOG->insert(m_fileLog); LOG((CLOG_DEBUG1 "logging to file (%s) enabled", argsBase().m_logFile)); } } void App::loggingFilterWarning() { if (CLOG->getFilter() > CLOG->getConsoleMaxLevel()) { if (argsBase().m_logFile == NULL) { LOG( (CLOG_WARN "log messages above %s are NOT sent to console (use file logging)", CLOG->getFilterName(CLOG->getConsoleMaxLevel())) ); } } } void App::initApp(int argc, const char **argv) { std::string configFilename; CLI::App cliApp{kAppDescription}; cliApp.add_option("--config-toml", configFilename, "Use TOML configuration file"); // Allow legacy args. cliApp.allow_extras(); // Having the help argument crashes without try / catch around it try { cliApp.parse(argc, argv); } catch (const CLI::Error &e) { cliApp.exit(e); } if (!configFilename.empty()) { Config config(configFilename, configSection()); if (config.load(argv[0])) { parseArgs(config.argc(), config.argv()); } } else { parseArgs(argc, argv); } ARCH->setProfileDirectory(argsBase().m_profileDirectory); ARCH->setPluginDirectory(argsBase().m_pluginDirectory); // set log filter if (!CLOG->setFilter(argsBase().m_logFilter)) { LOG(( CLOG_CRIT "%s: unrecognized log level `%s'" BYE, argsBase().m_pname, argsBase().m_logFilter, argsBase().m_pname )); m_bye(kExitArgs); } loggingFilterWarning(); // setup file logging after parsing args setupFileLogging(); // load configuration loadConfig(); if (!argsBase().m_disableTray && m_createTaskBarReceiver) { // create a log buffer so we can show the latest message // as a tray icon tooltip BufferedLogOutputter *logBuffer = new BufferedLogOutputter(1000); CLOG->insert(logBuffer, true); // make the task bar receiver. the user can control this app // through the task bar. m_taskBarReceiver = m_createTaskBarReceiver(logBuffer, m_events); } } void App::initIpcClient() { m_ipcClient = new IpcClient(m_events, m_socketMultiplexer); m_ipcClient->connect(); m_events->adoptHandler( m_events->forIpcClient().messageReceived(), m_ipcClient, new TMethodEventJob<App>(this, &App::handleIpcMessage) ); } void App::cleanupIpcClient() { m_ipcClient->disconnect(); m_events->removeHandler(m_events->forIpcClient().messageReceived(), m_ipcClient); delete m_ipcClient; } void App::handleIpcMessage(const Event &e, void *) { IpcMessage *m = static_cast<IpcMessage *>(e.getDataObject()); if (m->type() == IpcMessageType::Shutdown) { LOG((CLOG_INFO "got ipc shutdown message")); m_events->addEvent(Event(Event::kQuit)); } } void App::runEventsLoop(void *) { m_events->loop(); #if defined(MAC_OS_X_VERSION_10_7) stopCocoaLoop(); #endif } // // MinimalApp // MinimalApp::MinimalApp() : App(NULL, NULL, new deskflow::ArgsBase()) { m_arch.init(); setEvents(m_events); } MinimalApp::~MinimalApp() { } int MinimalApp::standardStartup(int argc, char **argv) { return 0; } int MinimalApp::runInner(int argc, char **argv, ILogOutputter *outputter, StartupFunc startup) { return 0; } void MinimalApp::startNode() { } int MinimalApp::mainLoop() { return 0; } int MinimalApp::foregroundStartup(int argc, char **argv) { return 0; } deskflow::Screen *MinimalApp::createScreen() { return NULL; } void MinimalApp::loadConfig() { } bool MinimalApp::loadConfig(const String &pathname) { return false; } const char *MinimalApp::daemonInfo() const { return ""; } const char *MinimalApp::daemonName() const { return ""; } void MinimalApp::parseArgs(int argc, const char *const *argv) { }
8,233
C++
.cpp
283
26.314488
119
0.713688
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,470
IKeyState.cpp
deskflow_deskflow/src/lib/deskflow/IKeyState.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2004 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/IKeyState.h" #include <cstdint> #include <cstdlib> #include <cstring> // // IKeyState // IKeyState::IKeyState(IEventQueue *events) { } // // IKeyState::KeyInfo // IKeyState::KeyInfo *IKeyState::KeyInfo::alloc(KeyID id, KeyModifierMask mask, KeyButton button, SInt32 count) { KeyInfo *info = (KeyInfo *)malloc(sizeof(KeyInfo)); info->m_key = id; info->m_mask = mask; info->m_button = button; info->m_count = count; info->m_screens = NULL; info->m_screensBuffer[0] = '\0'; return info; } IKeyState::KeyInfo *IKeyState::KeyInfo::alloc( KeyID id, KeyModifierMask mask, KeyButton button, SInt32 count, const std::set<String> &destinations ) { String screens = join(destinations); const char *buffer = screens.c_str(); // build structure KeyInfo *info = (KeyInfo *)malloc(sizeof(KeyInfo) + screens.size()); info->m_key = id; info->m_mask = mask; info->m_button = button; info->m_count = count; info->m_screens = info->m_screensBuffer; std::copy(buffer, buffer + screens.size() + 1, info->m_screensBuffer); return info; } IKeyState::KeyInfo *IKeyState::KeyInfo::alloc(const KeyInfo &x) { auto bufferLen = strnlen(x.m_screensBuffer, SIZE_MAX); auto info = (KeyInfo *)malloc(sizeof(KeyInfo) + bufferLen); info->m_key = x.m_key; info->m_mask = x.m_mask; info->m_button = x.m_button; info->m_count = x.m_count; info->m_screens = x.m_screens ? info->m_screensBuffer : NULL; memcpy(info->m_screensBuffer, x.m_screensBuffer, bufferLen + 1); return info; } bool IKeyState::KeyInfo::isDefault(const char *screens) { return (screens == NULL || screens[0] == '\0'); } bool IKeyState::KeyInfo::contains(const char *screens, const String &name) { // special cases if (isDefault(screens)) { return false; } if (screens[0] == '*') { return true; } // search String match; match.reserve(name.size() + 2); match += ":"; match += name; match += ":"; return (strstr(screens, match.c_str()) != NULL); } bool IKeyState::KeyInfo::equal(const KeyInfo *a, const KeyInfo *b) { return ( a->m_key == b->m_key && a->m_mask == b->m_mask && a->m_button == b->m_button && a->m_count == b->m_count && strcmp(a->m_screensBuffer, b->m_screensBuffer) == 0 ); } String IKeyState::KeyInfo::join(const std::set<String> &destinations) { // collect destinations into a string. names are surrounded by ':' // which makes searching easy. the string is empty if there are no // destinations and "*" means all destinations. String screens; for (auto i = destinations.begin(); i != destinations.end(); ++i) { if (*i == "*") { screens = "*"; break; } else { if (screens.empty()) { screens = ":"; } screens += *i; screens += ":"; } } return screens; } void IKeyState::KeyInfo::split(const char *screens, std::set<String> &dst) { dst.clear(); if (isDefault(screens)) { return; } if (screens[0] == '*') { dst.insert("*"); return; } const char *i = screens + 1; while (*i != '\0') { const char *j = strchr(i, ':'); dst.insert(String(i, j - i)); i = j + 1; } }
3,890
C++
.cpp
134
26.149254
113
0.66631
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
true
false
false
13,471
key_types.cpp
deskflow_deskflow/src/lib/deskflow/key_types.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/key_types.h" const KeyNameMapEntry kKeyNameMap[] = { {"AltGr", kKeyAltGr}, {"Alt_L", kKeyAlt_L}, {"Alt_R", kKeyAlt_R}, {"AppMail", kKeyAppMail}, {"AppMedia", kKeyAppMedia}, {"AppUser1", kKeyAppUser1}, {"AppUser2", kKeyAppUser2}, {"AudioDown", kKeyAudioDown}, {"AudioMute", kKeyAudioMute}, {"AudioNext", kKeyAudioNext}, {"AudioPlay", kKeyAudioPlay}, {"AudioPrev", kKeyAudioPrev}, {"AudioStop", kKeyAudioStop}, {"AudioUp", kKeyAudioUp}, {"BackSpace", kKeyBackSpace}, {"Begin", kKeyBegin}, {"Break", kKeyBreak}, {"Cancel", kKeyCancel}, {"CapsLock", kKeyCapsLock}, {"Clear", kKeyClear}, {"Control_L", kKeyControl_L}, {"Control_R", kKeyControl_R}, {"Delete", kKeyDelete}, {"Down", kKeyDown}, {"Eject", kKeyEject}, {"End", kKeyEnd}, {"Escape", kKeyEscape}, {"Execute", kKeyExecute}, {"F1", kKeyF1}, {"F2", kKeyF2}, {"F3", kKeyF3}, {"F4", kKeyF4}, {"F5", kKeyF5}, {"F6", kKeyF6}, {"F7", kKeyF7}, {"F8", kKeyF8}, {"F9", kKeyF9}, {"F10", kKeyF10}, {"F11", kKeyF11}, {"F12", kKeyF12}, {"F13", kKeyF13}, {"F14", kKeyF14}, {"F15", kKeyF15}, {"F16", kKeyF16}, {"F17", kKeyF17}, {"F18", kKeyF18}, {"F19", kKeyF19}, {"F20", kKeyF20}, {"F21", kKeyF21}, {"F22", kKeyF22}, {"F23", kKeyF23}, {"F24", kKeyF24}, {"F25", kKeyF25}, {"F26", kKeyF26}, {"F27", kKeyF27}, {"F28", kKeyF28}, {"F29", kKeyF29}, {"F30", kKeyF30}, {"F31", kKeyF31}, {"F32", kKeyF32}, {"F33", kKeyF33}, {"F34", kKeyF34}, {"F35", kKeyF35}, {"Find", kKeyFind}, {"Help", kKeyHelp}, {"Henkan", kKeyHenkan}, {"Home", kKeyHome}, {"Hyper_L", kKeyHyper_L}, {"Hyper_R", kKeyHyper_R}, {"Insert", kKeyInsert}, {"KP_0", kKeyKP_0}, {"KP_1", kKeyKP_1}, {"KP_2", kKeyKP_2}, {"KP_3", kKeyKP_3}, {"KP_4", kKeyKP_4}, {"KP_5", kKeyKP_5}, {"KP_6", kKeyKP_6}, {"KP_7", kKeyKP_7}, {"KP_8", kKeyKP_8}, {"KP_9", kKeyKP_9}, {"KP_Add", kKeyKP_Add}, {"KP_Begin", kKeyKP_Begin}, {"KP_Decimal", kKeyKP_Decimal}, {"KP_Delete", kKeyKP_Delete}, {"KP_Divide", kKeyKP_Divide}, {"KP_Down", kKeyKP_Down}, {"KP_End", kKeyKP_End}, {"KP_Enter", kKeyKP_Enter}, {"KP_Equal", kKeyKP_Equal}, {"KP_F1", kKeyKP_F1}, {"KP_F2", kKeyKP_F2}, {"KP_F3", kKeyKP_F3}, {"KP_F4", kKeyKP_F4}, {"KP_Home", kKeyKP_Home}, {"KP_Insert", kKeyKP_Insert}, {"KP_Left", kKeyKP_Left}, {"KP_Multiply", kKeyKP_Multiply}, {"KP_PageDown", kKeyKP_PageDown}, {"KP_PageUp", kKeyKP_PageUp}, {"KP_Right", kKeyKP_Right}, {"KP_Separator", kKeyKP_Separator}, {"KP_Space", kKeyKP_Space}, {"KP_Subtract", kKeyKP_Subtract}, {"KP_Tab", kKeyKP_Tab}, {"KP_Up", kKeyKP_Up}, {"Left", kKeyLeft}, {"LeftTab", kKeyLeftTab}, {"Linefeed", kKeyLinefeed}, {"Menu", kKeyMenu}, {"Meta_L", kKeyMeta_L}, {"Meta_R", kKeyMeta_R}, {"NumLock", kKeyNumLock}, {"PageDown", kKeyPageDown}, {"PageUp", kKeyPageUp}, {"Pause", kKeyPause}, {"Print", kKeyPrint}, {"Redo", kKeyRedo}, {"Return", kKeyReturn}, {"Right", kKeyRight}, {"ScrollLock", kKeyScrollLock}, {"Select", kKeySelect}, {"ShiftLock", kKeyShiftLock}, {"Shift_L", kKeyShift_L}, {"Shift_R", kKeyShift_R}, {"Sleep", kKeySleep}, {"Super_L", kKeySuper_L}, {"Super_R", kKeySuper_R}, {"SysReq", kKeySysReq}, {"Tab", kKeyTab}, {"Undo", kKeyUndo}, {"Up", kKeyUp}, {"WWWBack", kKeyWWWBack}, {"WWWFavorites", kKeyWWWFavorites}, {"WWWForward", kKeyWWWForward}, {"WWWHome", kKeyWWWHome}, {"WWWRefresh", kKeyWWWRefresh}, {"WWWSearch", kKeyWWWSearch}, {"WWWStop", kKeyWWWStop}, {"Zenkaku", kKeyZenkaku}, {"Space", 0x0020}, {"Exclaim", 0x0021}, {"DoubleQuote", 0x0022}, {"Number", 0x0023}, {"Dollar", 0x0024}, {"Percent", 0x0025}, {"Ampersand", 0x0026}, {"Apostrophe", 0x0027}, {"ParenthesisL", 0x0028}, {"ParenthesisR", 0x0029}, {"Asterisk", 0x002a}, {"Plus", 0x002b}, {"Comma", 0x002c}, {"Minus", 0x002d}, {"Period", 0x002e}, {"Slash", 0x002f}, {"Colon", 0x003a}, {"Semicolon", 0x003b}, {"Less", 0x003c}, {"Equal", 0x003d}, {"Greater", 0x003e}, {"Question", 0x003f}, {"At", 0x0040}, {"BracketL", 0x005b}, {"Backslash", 0x005c}, {"BracketR", 0x005d}, {"Circumflex", 0x005e}, {"Underscore", 0x005f}, {"Grave", 0x0060}, {"BraceL", 0x007b}, {"Bar", 0x007c}, {"BraceR", 0x007d}, {"Tilde", 0x007e}, {NULL, 0}, }; const KeyModifierNameMapEntry kModifierNameMap[] = { {"Alt", KeyModifierAlt}, {"AltGr", KeyModifierAltGr}, // { "CapsLock", KeyModifierCapsLock }, {"Control", KeyModifierControl}, {"Meta", KeyModifierMeta}, // { "NumLock", KeyModifierNumLock }, // { "ScrollLock", KeyModifierScrollLock }, {"Shift", KeyModifierShift}, {"Super", KeyModifierSuper}, {NULL, 0}, };
5,872
C++
.cpp
205
23.980488
72
0.585805
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,472
FileChunk.cpp
deskflow_deskflow/src/lib/deskflow/FileChunk.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2015-2016 Symless Ltd. * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/FileChunk.h" #include "base/Log.h" #include "base/Stopwatch.h" #include "deskflow/ProtocolUtil.h" #include "deskflow/protocol_types.h" #include "io/IStream.h" static const UInt16 kIntervalThreshold = 1; FileChunk::FileChunk(size_t size) : Chunk(size) { m_dataSize = size - FILE_CHUNK_META_SIZE; } FileChunk *FileChunk::start(const String &size) { size_t sizeLength = size.size(); FileChunk *start = new FileChunk(sizeLength + FILE_CHUNK_META_SIZE); char *chunk = start->m_chunk; chunk[0] = kDataStart; memcpy(&chunk[1], size.c_str(), sizeLength); chunk[sizeLength + 1] = '\0'; return start; } FileChunk *FileChunk::data(UInt8 *data, size_t dataSize) { FileChunk *chunk = new FileChunk(dataSize + FILE_CHUNK_META_SIZE); char *chunkData = chunk->m_chunk; chunkData[0] = kDataChunk; memcpy(&chunkData[1], data, dataSize); chunkData[dataSize + 1] = '\0'; return chunk; } FileChunk *FileChunk::end() { FileChunk *end = new FileChunk(FILE_CHUNK_META_SIZE); char *chunk = end->m_chunk; chunk[0] = kDataEnd; chunk[1] = '\0'; return end; } int FileChunk::assemble(deskflow::IStream *stream, String &dataReceived, size_t &expectedSize) { // parse UInt8 mark = 0; String content; static size_t receivedDataSize; static double elapsedTime; static Stopwatch stopwatch; if (!ProtocolUtil::readf(stream, kMsgDFileTransfer + 4, &mark, &content)) { return kError; } switch (mark) { case kDataStart: dataReceived.clear(); expectedSize = deskflow::string::stringToSizeType(content); receivedDataSize = 0; elapsedTime = 0; stopwatch.reset(); if (CLOG->getFilter() >= kDEBUG2) { LOG((CLOG_DEBUG2 "recv file size=%s", content.c_str())); stopwatch.start(); } return kStart; case kDataChunk: dataReceived.append(content); if (CLOG->getFilter() >= kDEBUG2) { LOG((CLOG_DEBUG2 "recv file chunk size=%i", content.size())); double interval = stopwatch.getTime(); receivedDataSize += content.size(); LOG((CLOG_DEBUG2 "recv file interval=%f s", interval)); if (interval >= kIntervalThreshold) { double averageSpeed = receivedDataSize / interval / 1000; LOG((CLOG_DEBUG2 "recv file average speed=%f kb/s", averageSpeed)); receivedDataSize = 0; elapsedTime += interval; stopwatch.reset(); } } return kNotFinish; case kDataEnd: if (expectedSize != dataReceived.size()) { LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", expectedSize, dataReceived.size())); return kError; } if (CLOG->getFilter() >= kDEBUG2) { LOG((CLOG_DEBUG2 "file transfer finished")); elapsedTime += stopwatch.getTime(); double averageSpeed = expectedSize / elapsedTime / 1000; LOG((CLOG_DEBUG2 "file transfer finished: total time consumed=%f s", elapsedTime)); LOG((CLOG_DEBUG2 "file transfer finished: total data received=%i kb", expectedSize / 1000)); LOG((CLOG_DEBUG2 "file transfer finished: total average speed=%f kb/s", averageSpeed)); } return kFinish; } return kError; } void FileChunk::send(deskflow::IStream *stream, UInt8 mark, char *data, size_t dataSize) { String chunk(data, dataSize); switch (mark) { case kDataStart: LOG((CLOG_DEBUG2 "sending file chunk start: size=%s", data)); break; case kDataChunk: LOG((CLOG_DEBUG2 "sending file chunk: size=%i", chunk.size())); break; case kDataEnd: LOG((CLOG_DEBUG2 "sending file finished")); break; } ProtocolUtil::writef(stream, kMsgDFileTransfer, mark, &chunk); }
4,333
C++
.cpp
126
30.603175
117
0.699737
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,473
ProtocolUtil.cpp
deskflow_deskflow/src/lib/deskflow/ProtocolUtil.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/ProtocolUtil.h" #include "base/Log.h" #include "common/stdvector.h" #include "io/IStream.h" #include <array> #include <iterator> #include <cctype> #include <cstring> // // ProtocolUtil // namespace { void writeInt(UInt32 Value, UInt32 Length, std::vector<UInt8> &Buffer) { switch (Length) { case 1: Buffer.push_back(static_cast<UInt8>(Value & 0xffU)); break; case 4: Buffer.push_back(static_cast<UInt8>((Value >> 24U) & 0xffU)); Buffer.push_back(static_cast<UInt8>((Value >> 16U) & 0xffU)); Buffer.push_back(static_cast<UInt8>((Value >> 8U) & 0xffU)); Buffer.push_back(static_cast<UInt8>(Value & 0xffU)); break; case 2: Buffer.push_back(static_cast<UInt8>((Value >> 8U) & 0xffU)); Buffer.push_back(static_cast<UInt8>(Value & 0xffU)); break; default: assert(0 && "invalid integer format length"); return; } } template <typename T> void writeVectorInt(const std::vector<T> *VectorData, std::vector<UInt8> &Buffer) { if (VectorData) { const std::vector<T> &Vector = *VectorData; writeInt((UInt32)Vector.size(), sizeof(UInt32), Buffer); for (size_t i = 0; i < Vector.size(); ++i) { writeInt(Vector[i], sizeof(T), Buffer); } } } void writeString(const String *StringData, std::vector<UInt8> &Buffer) { const UInt32 len = (StringData != NULL) ? (UInt32)StringData->size() : 0; writeInt(len, sizeof(len), Buffer); if (len != 0) { std::copy(StringData->begin(), StringData->end(), std::back_inserter(Buffer)); } } } // namespace void ProtocolUtil::writef(deskflow::IStream *stream, const char *fmt, ...) { assert(stream != NULL); assert(fmt != NULL); LOG((CLOG_DEBUG2 "writef(%s)", fmt)); va_list args; va_start(args, fmt); UInt32 size = getLength(fmt, args); va_end(args); va_start(args, fmt); vwritef(stream, fmt, size, args); va_end(args); } bool ProtocolUtil::readf(deskflow::IStream *stream, const char *fmt, ...) { bool result = false; if (stream && fmt) { LOG((CLOG_DEBUG2 "readf(%s)", fmt)); va_list args; va_start(args, fmt); try { vreadf(stream, fmt, args); result = true; } catch (XIO &) { result = false; } catch (const std::bad_alloc &) { result = false; } va_end(args); } return result; } void ProtocolUtil::vwritef(deskflow::IStream *stream, const char *fmt, UInt32 size, va_list args) { assert(stream != NULL); assert(fmt != NULL); // done if nothing to write if (size == 0) { return; } // fill buffer std::vector<UInt8> Buffer; writef(Buffer, fmt, args); try { // write buffer stream->write(Buffer.data(), size); LOG((CLOG_DEBUG2 "wrote %d bytes", size)); } catch (const XBase &exception) { LOG((CLOG_DEBUG2 "exception <%s> during wrote %d bytes into stream", exception.what(), size)); throw; } } void ProtocolUtil::vreadf(deskflow::IStream *stream, const char *fmt, va_list args) { assert(stream != NULL); assert(fmt != NULL); // begin scanning while (*fmt) { if (*fmt == '%') { // format specifier. determine argument size. ++fmt; UInt32 len = eatLength(&fmt); switch (*fmt) { case 'i': { void *destination = va_arg(args, void *); switch (len) { case 1: // 1 byte integer *static_cast<UInt8 *>(destination) = read1ByteInt(stream); break; case 2: // 2 byte integer *static_cast<UInt16 *>(destination) = read2BytesInt(stream); break; case 4: // 4 byte integer *static_cast<UInt32 *>(destination) = read4BytesInt(stream); break; default: // the length is wrong LOG((CLOG_ERR "read: length to be read is wrong: '%d' should be 1,2, or 4", len)); assert(false); // assert for debugging break; } break; } case 'I': { void *destination = va_arg(args, void *); switch (len) { case 1: // 1 byte integer readVector1ByteInt(stream, *static_cast<std::vector<UInt8> *>(destination)); break; case 2: // 2 byte integer readVector2BytesInt(stream, *static_cast<std::vector<UInt16> *>(destination)); break; case 4: // 4 byte integer readVector4BytesInt(stream, *static_cast<std::vector<UInt32> *>(destination)); break; default: // the length is wrong LOG((CLOG_ERR "read: length to be read is wrong: '%d' should be 1,2, or 4", len)); assert(false); // assert for debugging break; } break; } case 's': { String *destination = va_arg(args, String *); readBytes(stream, len, destination); break; } case '%': assert(len == 0); break; default: assert(0 && "invalid format specifier"); } // next format character ++fmt; } else { // read next character char buffer[1]; read(stream, buffer, 1); // verify match if (buffer[0] != *fmt) { LOG((CLOG_DEBUG2 "readf: format mismatch: %c vs %c", *fmt, buffer[0])); throw XIOReadMismatch(); } // next format character ++fmt; } } } UInt32 ProtocolUtil::getLength(const char *fmt, va_list args) { UInt32 n = 0; while (*fmt) { if (*fmt == '%') { // format specifier. determine argument size. ++fmt; UInt32 len = eatLength(&fmt); switch (*fmt) { case 'i': assert(len == 1 || len == 2 || len == 4); (void)va_arg(args, UInt32); break; case 'I': assert(len == 1 || len == 2 || len == 4); switch (len) { case 1: len = (UInt32)(va_arg(args, std::vector<UInt8> *))->size() + 4; break; case 2: len = 2 * (UInt32)(va_arg(args, std::vector<UInt16> *))->size() + 4; break; case 4: len = 4 * (UInt32)(va_arg(args, std::vector<UInt32> *))->size() + 4; break; } break; case 's': assert(len == 0); len = (UInt32)(va_arg(args, String *))->size() + 4; break; case 'S': assert(len == 0); len = va_arg(args, UInt32) + 4; break; case '%': assert(len == 0); len = 1; break; default: assert(0 && "invalid format specifier"); } // accumulate size n += len; ++fmt; } else { // regular character ++n; ++fmt; } } return n; } void ProtocolUtil::writef(std::vector<UInt8> &buffer, const char *fmt, va_list args) { while (*fmt) { if (*fmt == '%') { // format specifier. determine argument size. ++fmt; UInt32 len = eatLength(&fmt); switch (*fmt) { case 'i': { const UInt32 v = va_arg(args, UInt32); writeInt(v, len, buffer); break; } case 'I': { switch (len) { case 1: { // 1 byte integers const std::vector<UInt8> *list = va_arg(args, const std::vector<UInt8> *); writeVectorInt(list, buffer); break; } case 2: { // 2 byte integers const std::vector<UInt16> *list = va_arg(args, const std::vector<UInt16> *); writeVectorInt(list, buffer); break; } case 4: { // 4 byte integers const std::vector<UInt32> *list = va_arg(args, const std::vector<UInt32> *); writeVectorInt(list, buffer); break; } default: assert(0 && "invalid integer vector format length"); return; } break; } case 's': { assert(len == 0); const String *src = va_arg(args, String *); writeString(src, buffer); break; } case 'S': { assert(len == 0); const UInt32 len = va_arg(args, UInt32); const UInt8 *src = va_arg(args, UInt8 *); writeInt(len, sizeof(len), buffer); std::copy(src, src + len, std::back_inserter(buffer)); break; } case '%': assert(len == 0); buffer.push_back('%'); break; default: assert(0 && "invalid format specifier"); } // next format character ++fmt; } else { // copy regular character buffer.push_back(*fmt++); } } } UInt32 ProtocolUtil::eatLength(const char **pfmt) { const char *fmt = *pfmt; UInt32 n = 0; for (;;) { UInt32 d; switch (*fmt) { case '0': d = 0; break; case '1': d = 1; break; case '2': d = 2; break; case '3': d = 3; break; case '4': d = 4; break; case '5': d = 5; break; case '6': d = 6; break; case '7': d = 7; break; case '8': d = 8; break; case '9': d = 9; break; default: *pfmt = fmt; return n; } n = 10 * n + d; ++fmt; } } void ProtocolUtil::read(deskflow::IStream *stream, void *vbuffer, UInt32 count) { assert(stream != NULL); assert(vbuffer != NULL); UInt8 *buffer = static_cast<UInt8 *>(vbuffer); while (count > 0) { // read more UInt32 n = stream->read(buffer, count); // bail if stream has hungup if (n == 0) { LOG((CLOG_DEBUG2 "unexpected disconnect in readf(), %d bytes left", count)); throw XIOEndOfStream(); } // prepare for next read buffer += n; count -= n; } } UInt8 ProtocolUtil::read1ByteInt(deskflow::IStream *stream) { const UInt32 BufferSize = 1; std::array<UInt8, 1> buffer = {}; read(stream, buffer.data(), BufferSize); UInt8 Result = buffer[0]; LOG((CLOG_DEBUG2 "readf: read 1 byte integer: %d (0x%x)", Result, Result)); return Result; } UInt16 ProtocolUtil::read2BytesInt(deskflow::IStream *stream) { const UInt32 BufferSize = 2; std::array<UInt8, BufferSize> buffer = {}; read(stream, buffer.data(), BufferSize); UInt16 Result = static_cast<UInt16>((static_cast<UInt16>(buffer[0]) << 8) | static_cast<UInt16>(buffer[1])); LOG((CLOG_DEBUG2 "readf: read 2 byte integer: %d (0x%x)", Result, Result)); return Result; } UInt32 ProtocolUtil::read4BytesInt(deskflow::IStream *stream) { const int BufferSize = 4; std::array<UInt8, BufferSize> buffer = {}; read(stream, buffer.data(), BufferSize); UInt32 Result = (static_cast<UInt32>(buffer[0]) << 24) | (static_cast<UInt32>(buffer[1]) << 16) | (static_cast<UInt32>(buffer[2]) << 8) | (static_cast<UInt32>(buffer[3])); LOG((CLOG_DEBUG2 "readf: read 4 byte integer: %d (0x%x)", Result, Result)); return Result; } void ProtocolUtil::readVector1ByteInt(deskflow::IStream *stream, std::vector<UInt8> &destination) { UInt32 size = read4BytesInt(stream); for (UInt32 i = 0; i < size; ++i) { destination.push_back(read1ByteInt(stream)); } } void ProtocolUtil::readVector2BytesInt(deskflow::IStream *stream, std::vector<UInt16> &destination) { UInt32 size = read4BytesInt(stream); for (UInt32 i = 0; i < size; ++i) { destination.push_back(read2BytesInt(stream)); } } void ProtocolUtil::readVector4BytesInt(deskflow::IStream *stream, std::vector<UInt32> &destination) { UInt32 size = read4BytesInt(stream); for (UInt32 i = 0; i < size; ++i) { destination.push_back(read4BytesInt(stream)); } } void ProtocolUtil::readBytes(deskflow::IStream *stream, UInt32 len, String *destination) { // read the string length UInt8 buffer[128]; // when string length is 0, this implies that the size of the string is // variable and will be embedded in the stream. if (len == 0) { len = read4BytesInt(stream); } // use a fixed size buffer if its big enough const bool useFixed = (len <= sizeof(buffer)); // allocate a buffer to read the data UInt8 *sBuffer = buffer; if (!useFixed) { try { sBuffer = new UInt8[len]; } catch (std::bad_alloc &exception) { // Added try catch due to GHSA-chfm-333q-gfpp LOG((CLOG_ERR "bad alloc, unable to allocate memory %d bytes", len)); LOG((CLOG_DEBUG "bad_alloc detected: is there enough memory?")); throw exception; } } // read the data try { read(stream, sBuffer, len); } catch (...) { if (!useFixed) { delete[] sBuffer; } throw; } LOG((CLOG_DEBUG2 "readf: read %d byte string", len)); // save the data if (destination) { destination->assign((const char *)sBuffer, len); } // release the buffer if (!useFixed) { delete[] sBuffer; } } // // XIOReadMismatch // String XIOReadMismatch::getWhat() const throw() { return format("XIOReadMismatch", "ProtocolUtil::readf() mismatch"); }
13,623
C++
.cpp
487
22.406571
110
0.590874
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,474
XScreen.cpp
deskflow_deskflow/src/lib/deskflow/XScreen.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/XScreen.h" // // XScreenOpenFailure // String XScreenOpenFailure::getWhat() const throw() { return format("XScreenOpenFailure", "unable to open screen"); } // // XScreenXInputFailure // String XScreenXInputFailure::getWhat() const throw() { return ""; } // // XScreenUnavailable // XScreenUnavailable::XScreenUnavailable(double timeUntilRetry) : m_timeUntilRetry(timeUntilRetry) { // do nothing } XScreenUnavailable::~XScreenUnavailable() _NOEXCEPT { // do nothing } double XScreenUnavailable::getRetryTime() const { return m_timeUntilRetry; } String XScreenUnavailable::getWhat() const throw() { return format("XScreenUnavailable", "unable to open screen"); }
1,432
C++
.cpp
51
26.333333
96
0.77097
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,475
DropHelper.cpp
deskflow_deskflow/src/lib/deskflow/DropHelper.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2014-2016 Symless Ltd. * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/DropHelper.h" #include "base/Log.h" #include <fstream> void DropHelper::writeToDir(const String &destination, DragFileList &fileList, String &data) { LOG((CLOG_DEBUG "dropping file, files=%i target=%s", fileList.size(), destination.c_str())); if (!destination.empty() && fileList.size() > 0) { std::fstream file; String dropTarget = destination; #ifdef SYSAPI_WIN32 dropTarget.append("\\"); #else dropTarget.append("/"); #endif dropTarget.append(fileList.at(0).getFilename()); file.open(dropTarget.c_str(), std::ios::out | std::ios::binary); if (!file.is_open()) { LOG((CLOG_ERR "drop file failed: can not open %s", dropTarget.c_str())); } file.write(data.c_str(), data.size()); file.close(); LOG((CLOG_DEBUG "%s is saved to %s", fileList.at(0).getFilename().c_str(), destination.c_str())); fileList.clear(); } else { LOG((CLOG_ERR "drop file failed: drop target is empty")); } }
1,664
C++
.cpp
43
35.627907
101
0.703658
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,476
ArgsBase.cpp
deskflow_deskflow/src/lib/deskflow/ArgsBase.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2020 Symless Ltd. * Copyright (C) 2012 Nick Bolton * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "ArgsBase.h" namespace deskflow { ArgsBase::~ArgsBase() { // } } // namespace deskflow
825
C++
.cpp
24
32.541667
72
0.754693
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,477
ClipboardChunk.cpp
deskflow_deskflow/src/lib/deskflow/ClipboardChunk.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2015-2016 Symless Ltd. * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/ClipboardChunk.h" #include "base/Log.h" #include "deskflow/ProtocolUtil.h" #include "deskflow/protocol_types.h" #include "io/IStream.h" #include <cstring> size_t ClipboardChunk::s_expectedSize = 0; ClipboardChunk::ClipboardChunk(size_t size) : Chunk(size) { m_dataSize = size - CLIPBOARD_CHUNK_META_SIZE; } ClipboardChunk *ClipboardChunk::start(ClipboardID id, UInt32 sequence, const String &size) { size_t sizeLength = size.size(); ClipboardChunk *start = new ClipboardChunk(sizeLength + CLIPBOARD_CHUNK_META_SIZE); char *chunk = start->m_chunk; chunk[0] = id; std::memcpy(&chunk[1], &sequence, 4); chunk[5] = kDataStart; memcpy(&chunk[6], size.c_str(), sizeLength); chunk[sizeLength + CLIPBOARD_CHUNK_META_SIZE - 1] = '\0'; return start; } ClipboardChunk *ClipboardChunk::data(ClipboardID id, UInt32 sequence, const String &data) { size_t dataSize = data.size(); ClipboardChunk *chunk = new ClipboardChunk(dataSize + CLIPBOARD_CHUNK_META_SIZE); char *chunkData = chunk->m_chunk; chunkData[0] = id; std::memcpy(&chunkData[1], &sequence, 4); chunkData[5] = kDataChunk; memcpy(&chunkData[6], data.c_str(), dataSize); chunkData[dataSize + CLIPBOARD_CHUNK_META_SIZE - 1] = '\0'; return chunk; } ClipboardChunk *ClipboardChunk::end(ClipboardID id, UInt32 sequence) { ClipboardChunk *end = new ClipboardChunk(CLIPBOARD_CHUNK_META_SIZE); char *chunk = end->m_chunk; chunk[0] = id; std::memcpy(&chunk[1], &sequence, 4); chunk[5] = kDataEnd; chunk[CLIPBOARD_CHUNK_META_SIZE - 1] = '\0'; return end; } int ClipboardChunk::assemble(deskflow::IStream *stream, String &dataCached, ClipboardID &id, UInt32 &sequence) { UInt8 mark; String data; if (!ProtocolUtil::readf(stream, kMsgDClipboard + 4, &id, &sequence, &mark, &data)) { return kError; } if (mark == kDataStart) { s_expectedSize = deskflow::string::stringToSizeType(data); LOG((CLOG_DEBUG "start receiving clipboard data")); dataCached.clear(); return kStart; } else if (mark == kDataChunk) { dataCached.append(data); return kNotFinish; } else if (mark == kDataEnd) { // validate if (id >= kClipboardEnd) { return kError; } else if (s_expectedSize != dataCached.size()) { LOG((CLOG_ERR "corrupted clipboard data, expected size=%d actual size=%d", s_expectedSize, dataCached.size())); return kError; } return kFinish; } LOG((CLOG_ERR "clipboard transmission failed: unknown error")); return kError; } void ClipboardChunk::send(deskflow::IStream *stream, void *data) { ClipboardChunk *clipboardData = static_cast<ClipboardChunk *>(data); LOG((CLOG_DEBUG1 "sending clipboard chunk")); char *chunk = clipboardData->m_chunk; ClipboardID id = chunk[0]; UInt32 sequence; std::memcpy(&sequence, &chunk[1], 4); UInt8 mark = chunk[5]; String dataChunk(&chunk[6], clipboardData->m_dataSize); switch (mark) { case kDataStart: LOG((CLOG_DEBUG2 "sending clipboard chunk start: size=%s", dataChunk.c_str())); break; case kDataChunk: LOG((CLOG_DEBUG2 "sending clipboard chunk data: size=%i", dataChunk.size())); break; case kDataEnd: LOG((CLOG_DEBUG2 "sending clipboard finished")); break; } ProtocolUtil::writef(stream, kMsgDClipboard, id, sequence, mark, &dataChunk); }
4,026
C++
.cpp
112
32.901786
117
0.71928
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
true
false
false
13,478
ClientApp.cpp
deskflow_deskflow/src/lib/deskflow/ClientApp.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012 Symless Ltd. * Copyright (C) 2002 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/ClientApp.h" #include "arch/Arch.h" #include "arch/IArchTaskBarReceiver.h" #include "base/Event.h" #include "base/IEventQueue.h" #include "base/Log.h" #include "base/String.h" #include "base/TMethodEventJob.h" #include "client/Client.h" #include "common/constants.h" #include "deskflow/ArgParser.h" #include "deskflow/ClientArgs.h" #include "deskflow/Screen.h" #include "deskflow/XScreen.h" #include "deskflow/protocol_types.h" #include "net/InverseSockets/InverseSocketFactory.h" #include "net/NetworkAddress.h" #include "net/SocketMultiplexer.h" #include "net/TCPSocketFactory.h" #include "net/XSocket.h" #include "platform/wayland.h" #if SYSAPI_WIN32 #include "arch/win32/ArchMiscWindows.h" #endif #if WINAPI_MSWINDOWS #include "platform/MSWindowsScreen.h" #endif #if WINAPI_XWINDOWS #include "platform/XWindowsScreen.h" #endif #if WINAPI_LIBEI #include "platform/EiScreen.h" #endif #if WINAPI_CARBON #include "platform/OSXDragSimulator.h" #include "platform/OSXScreen.h" #endif #if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI) #include "platform/wayland.h" #endif #if defined(MAC_OS_X_VERSION_10_7) #include "base/TMethodJob.h" #include "mt/Thread.h" #endif #include <memory> #include <sstream> #include <stdio.h> #define RETRY_TIME 1.0 ClientApp::ClientApp(IEventQueue *events, CreateTaskBarReceiverFunc createTaskBarReceiver) : App(events, createTaskBarReceiver, new deskflow::ClientArgs()), m_client(NULL), m_clientScreen(NULL), m_serverAddress(NULL) { } ClientApp::~ClientApp() { } void ClientApp::parseArgs(int argc, const char *const *argv) { ArgParser argParser(this); bool result = argParser.parseClientArgs(args(), argc, argv); if (!result || args().m_shouldExitOk || args().m_shouldExitFail) { if (args().m_shouldExitOk) { m_bye(kExitSuccess); } else { m_bye(kExitArgs); } } else { // save server address if (!args().m_serverAddress.empty()) { try { *m_serverAddress = NetworkAddress(args().m_serverAddress, kDefaultPort); m_serverAddress->resolve(); } catch (XSocketAddress &e) { // allow an address that we can't look up if we're restartable. // we'll try to resolve the address each time we connect to the // server. a bad port will never get better. patch by Brent // Priddy. if (!args().m_restartable || e.getError() == XSocketAddress::kBadPort) { LOG((CLOG_CRIT "%s: %s" BYE, args().m_pname, e.what(), args().m_pname)); m_bye(kExitFailed); } } } } } void ClientApp::help() { std::stringstream help; help << "Usage: " << args().m_pname << " [--address <address>]" << " [--yscroll <delta>]" << " [--sync-language]" << " [--invert-scroll]" << " [--host]" #ifdef WINAPI_XWINDOWS << " [--display <display>]" << " [--no-xinitthreads]" #endif #ifdef WINAPI_LIBEI << " [--use-x-window]" #endif << HELP_SYS_ARGS << HELP_COMMON_ARGS << " <server-address>" << "\n\n" << "Connect to a " << kAppName << " mouse/keyboard sharing server.\n" << "\n" << " -a, --address <address> local network interface address.\n" << HELP_COMMON_INFO_1 << HELP_SYS_INFO << " --yscroll <delta> defines the vertical scrolling delta,\n" << " which is 120 by default.\n" << " --sync-language enable language synchronization.\n" << " --invert-scroll invert scroll direction on this\n" << " computer.\n" << " --host act as a host; invert server/client mode\n" << " and listen instead of connecting.\n" #if WINAPI_XWINDOWS << " --display <display> when in X mode, connect to the X server\n" << " at <display>.\n" << " --no-xinitthreads do not call XInitThreads()\n" #endif << HELP_COMMON_INFO_2 << "\n" << "* marks defaults.\n" << kHelpNoWayland << "\n" << "The server address is of the form: [<hostname>][:<port>].\n" << "The hostname must be the address or hostname of the server.\n" << "The port overrides the default port, " << kDefaultPort << ".\n"; LOG((CLOG_PRINT "%s", help.str().c_str())); } const char *ClientApp::daemonName() const { #if SYSAPI_WIN32 return "Deskflow Client"; #elif SYSAPI_UNIX return "deskflow-client"; #endif } const char *ClientApp::daemonInfo() const { #if SYSAPI_WIN32 return "Allows another computer to share it's keyboard and mouse with this " "computer."; #elif SYSAPI_UNIX return ""; #endif } deskflow::Screen *ClientApp::createScreen() { #if WINAPI_MSWINDOWS return new deskflow::Screen( new MSWindowsScreen( false, args().m_noHooks, args().m_stopOnDeskSwitch, m_events, args().m_enableLangSync, args().m_clientScrollDirection ), m_events ); #endif #if defined(WINAPI_XWINDOWS) or defined(WINAPI_LIBEI) if (deskflow::platform::isWayland()) { #if WINAPI_LIBEI LOG((CLOG_INFO "using ei screen for wayland")); return new deskflow::Screen(new deskflow::EiScreen(false, m_events, true), m_events); #else throw XNoEiSupport(); #endif } #endif #if WINAPI_XWINDOWS LOG((CLOG_INFO "using legacy x windows screen")); return new deskflow::Screen( new XWindowsScreen( args().m_display, false, args().m_disableXInitThreads, args().m_yscroll, m_events, args().m_clientScrollDirection ), m_events ); #endif #if WINAPI_CARBON return new deskflow::Screen( new OSXScreen(m_events, false, args().m_enableLangSync, args().m_clientScrollDirection), m_events ); #endif } void ClientApp::updateStatus() { updateStatus(""); } void ClientApp::updateStatus(const String &msg) { if (m_taskBarReceiver) { m_taskBarReceiver->updateStatus(m_client, msg); } } void ClientApp::resetRestartTimeout() { // retry time can nolonger be changed // s_retryTime = 0.0; } double ClientApp::nextRestartTimeout() { // retry at a constant rate (Issue 52) return RETRY_TIME; /* // choose next restart timeout. we start with rapid retries // then slow down. if (s_retryTime < 1.0) { s_retryTime = 1.0; } else if (s_retryTime < 3.0) { s_retryTime = 3.0; } else { s_retryTime = 5.0; } return s_retryTime; */ } void ClientApp::handleScreenError(const Event &, void *) { LOG((CLOG_CRIT "error on screen")); m_events->addEvent(Event(Event::kQuit)); } deskflow::Screen *ClientApp::openClientScreen() { deskflow::Screen *screen = createScreen(); screen->setEnableDragDrop(argsBase().m_enableDragDrop); m_events->adoptHandler( m_events->forIScreen().error(), screen->getEventTarget(), new TMethodEventJob<ClientApp>(this, &ClientApp::handleScreenError) ); return screen; } void ClientApp::closeClientScreen(deskflow::Screen *screen) { if (screen != NULL) { m_events->removeHandler(m_events->forIScreen().error(), screen->getEventTarget()); delete screen; } } void ClientApp::handleClientRestart(const Event &, void *vtimer) { // discard old timer EventQueueTimer *timer = static_cast<EventQueueTimer *>(vtimer); m_events->deleteTimer(timer); m_events->removeHandler(Event::kTimer, timer); // reconnect startClient(); } void ClientApp::scheduleClientRestart(double retryTime) { // install a timer and handler to retry later LOG((CLOG_DEBUG "retry in %.0f seconds", retryTime)); EventQueueTimer *timer = m_events->newOneShotTimer(retryTime, NULL); m_events->adoptHandler( Event::kTimer, timer, new TMethodEventJob<ClientApp>(this, &ClientApp::handleClientRestart, timer) ); } void ClientApp::handleClientConnected(const Event &, void *) { LOG((CLOG_NOTE "connected to server")); resetRestartTimeout(); updateStatus(); } void ClientApp::handleClientFailed(const Event &e, void *) { if ((++m_lastServerAddressIndex) < m_client->getLastResolvedAddressesCount()) { std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo *>(e.getData())); updateStatus(String("Failed to connect to server: ") + info->m_what + " Trying next address..."); LOG((CLOG_NOTE "failed to connect to server=%s, trying next address", info->m_what.c_str())); if (!m_suspended) { scheduleClientRestart(nextRestartTimeout()); } } else { m_lastServerAddressIndex = 0; handleClientRefused(e, nullptr); } } void ClientApp::handleClientRefused(const Event &e, void *) { std::unique_ptr<Client::FailInfo> info(static_cast<Client::FailInfo *>(e.getData())); updateStatus(String("Failed to connect to server: ") + info->m_what); if (!args().m_restartable || !info->m_retry) { LOG((CLOG_ERR "failed to connect to server: %s", info->m_what.c_str())); m_events->addEvent(Event(Event::kQuit)); } else { LOG((CLOG_WARN "failed to connect to server: %s", info->m_what.c_str())); if (!m_suspended) { scheduleClientRestart(nextRestartTimeout()); } } } void ClientApp::handleClientDisconnected(const Event &, void *) { LOG((CLOG_NOTE "disconnected from server")); if (!args().m_restartable) { m_events->addEvent(Event(Event::kQuit)); } else if (!m_suspended) { scheduleClientRestart(nextRestartTimeout()); } updateStatus(); } Client *ClientApp::openClient(const String &name, const NetworkAddress &address, deskflow::Screen *screen) { Client *client = new Client(m_events, name, address, getSocketFactory(), screen, args()); try { m_events->adoptHandler( m_events->forClient().connected(), client->getEventTarget(), new TMethodEventJob<ClientApp>(this, &ClientApp::handleClientConnected) ); m_events->adoptHandler( m_events->forClient().connectionFailed(), client->getEventTarget(), new TMethodEventJob<ClientApp>(this, &ClientApp::handleClientFailed) ); m_events->adoptHandler( m_events->forClient().connectionRefused(), client->getEventTarget(), new TMethodEventJob<ClientApp>(this, &ClientApp::handleClientRefused) ); m_events->adoptHandler( m_events->forClient().disconnected(), client->getEventTarget(), new TMethodEventJob<ClientApp>(this, &ClientApp::handleClientDisconnected) ); } catch (std::bad_alloc &ba) { delete client; throw ba; } return client; } void ClientApp::closeClient(Client *client) { if (client == NULL) { return; } m_events->removeHandler(m_events->forClient().connected(), client); m_events->removeHandler(m_events->forClient().connectionFailed(), client); m_events->removeHandler(m_events->forClient().connectionRefused(), client); m_events->removeHandler(m_events->forClient().disconnected(), client); delete client; } int ClientApp::foregroundStartup(int argc, char **argv) { initApp(argc, argv); // never daemonize return mainLoop(); } bool ClientApp::startClient() { double retryTime; deskflow::Screen *clientScreen = NULL; try { if (m_clientScreen == NULL) { clientScreen = openClientScreen(); m_client = openClient(args().m_name, *m_serverAddress, clientScreen); m_clientScreen = clientScreen; LOG((CLOG_NOTE "started client")); } m_client->connect(m_lastServerAddressIndex); updateStatus(); return true; } catch (XScreenUnavailable &e) { LOG((CLOG_WARN "secondary screen unavailable: %s", e.what())); closeClientScreen(clientScreen); updateStatus(String("secondary screen unavailable: ") + e.what()); retryTime = e.getRetryTime(); } catch (XScreenOpenFailure &e) { LOG((CLOG_CRIT "failed to start client: %s", e.what())); closeClientScreen(clientScreen); return false; } catch (XBase &e) { LOG((CLOG_CRIT "failed to start client: %s", e.what())); closeClientScreen(clientScreen); return false; } if (args().m_restartable) { scheduleClientRestart(retryTime); return true; } else { // don't try again return false; } } void ClientApp::stopClient() { closeClient(m_client); closeClientScreen(m_clientScreen); m_client = NULL; m_clientScreen = NULL; } int ClientApp::mainLoop() { // create socket multiplexer. this must happen after daemonization // on unix because threads evaporate across a fork(). SocketMultiplexer multiplexer; setSocketMultiplexer(&multiplexer); // start client, etc appUtil().startNode(); // init ipc client after node start, since create a new screen wipes out // the event queue (the screen ctors call adoptBuffer). if (argsBase().m_enableIpc) { initIpcClient(); } // run event loop. if startClient() failed we're supposed to retry // later. the timer installed by startClient() will take care of // that. DAEMON_RUNNING(true); #if defined(MAC_OS_X_VERSION_10_7) Thread thread(new TMethodJob<ClientApp>(this, &ClientApp::runEventsLoop, NULL)); // wait until carbon loop is ready OSXScreen *screen = dynamic_cast<OSXScreen *>(m_clientScreen->getPlatformScreen()); screen->waitForCarbonLoop(); runCocoaApp(); #else m_events->loop(); #endif DAEMON_RUNNING(false); // close down LOG((CLOG_DEBUG1 "stopping client")); stopClient(); updateStatus(); LOG((CLOG_NOTE "stopped client")); if (argsBase().m_enableIpc) { cleanupIpcClient(); } return kExitSuccess; } static int daemonMainLoopStatic(int argc, const char **argv) { return ClientApp::instance().daemonMainLoop(argc, argv); } int ClientApp::standardStartup(int argc, char **argv) { initApp(argc, argv); // daemonize if requested if (args().m_daemon) { return ARCH->daemonize(daemonName(), &daemonMainLoopStatic); } else { return mainLoop(); } } int ClientApp::runInner(int argc, char **argv, ILogOutputter *outputter, StartupFunc startup) { // general initialization m_serverAddress = new NetworkAddress; args().m_pname = ARCH->getBasename(argv[0]); // install caller's output filter if (outputter != NULL) { CLOG->insert(outputter); } int result; try { // run result = startup(argc, argv); } catch (...) { if (m_taskBarReceiver) { // done with task bar receiver delete m_taskBarReceiver; } delete m_serverAddress; throw; } return result; } void ClientApp::startNode() { // start the client. if this return false then we've failed and // we shouldn't retry. LOG((CLOG_DEBUG1 "starting client")); if (!startClient()) { m_bye(kExitFailed); } } ISocketFactory *ClientApp::getSocketFactory() const { ISocketFactory *socketFactory = nullptr; if (args().m_hostMode) { socketFactory = new InverseSocketFactory(m_events, getSocketMultiplexer()); } else { socketFactory = new TCPSocketFactory(m_events, getSocketMultiplexer()); } return socketFactory; }
15,655
C++
.cpp
496
28.010081
117
0.68743
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
false
false
false
false
false
false
false
13,479
Screen.cpp
deskflow_deskflow/src/lib/deskflow/Screen.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2003 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/Screen.h" #include "base/IEventQueue.h" #include "base/Log.h" #include "base/TMethodEventJob.h" #include "deskflow/IPlatformScreen.h" #include "deskflow/protocol_types.h" #include "server/ClientProxy.h" namespace deskflow { // // Screen // Screen::Screen(IPlatformScreen *platformScreen, IEventQueue *events) : m_screen(platformScreen), m_isPrimary(platformScreen->isPrimary()), m_enabled(false), m_entered(m_isPrimary), m_fakeInput(false), m_events(events), m_mock(false), m_enableDragDrop(false) { assert(m_screen != NULL); // reset options resetOptions(); LOG((CLOG_DEBUG "opened display")); } Screen::~Screen() { if (m_mock) { return; } if (m_enabled) { disable(); } assert(!m_enabled); // Originally there was an assert here added before 2009 (history not in // tact). This condition seems to occur on a Windows client when the process // is shut down to make way for a new elevated process (e.g. at login screen). // The reason why this assert was originally added is unclear, and was causing // pain when using debug builds; you lose control of the client when it's at // the login screen. Therefore it has been converted to a warning so that we // can still see when it happens but it won't cause the process to pause. This // also gives us the added benefit of seeing when it happens in production. // Perhaps it indicates that the cursor is still being controlled on the // client while it's shutting down? i.e. the screen is entered and is not the // server, or the screen is not entered and is the server. if (m_entered == m_isPrimary) { LOG( (CLOG_DEBUG "current screen: entered=%s, primary=%s", // m_entered ? "yes" : "no", m_isPrimary ? "yes" : "no") ); if (m_isPrimary) { LOG((CLOG_WARN "current primary screen is not entered on shutdown")); } else { LOG((CLOG_WARN "current secondary screen is entered on shutdown")); } } delete m_screen; LOG((CLOG_DEBUG "closed display")); } void Screen::enable() { assert(!m_enabled); m_screen->updateKeyMap(); m_screen->updateKeyState(); m_screen->enable(); if (m_isPrimary) { enablePrimary(); } else { enableSecondary(); } // note activation m_enabled = true; } void Screen::disable() { assert(m_enabled); if (!m_isPrimary && m_entered) { leave(); } else if (m_isPrimary && !m_entered) { enter(0); } m_screen->disable(); if (m_isPrimary) { disablePrimary(); } else { disableSecondary(); } // note deactivation m_enabled = false; } void Screen::enter(KeyModifierMask toggleMask) { LOG((CLOG_INFO "entering screen")); if (m_entered) { LOG_WARN("screen already entered"); } // now on screen m_entered = true; m_screen->enter(); if (m_isPrimary) { enterPrimary(); } else { enterSecondary(toggleMask); } } bool Screen::leave() { LOG((CLOG_INFO "leaving screen")); if (!m_entered) { LOG_WARN("screen already left"); } if (!m_screen->canLeave()) { return false; } if (m_isPrimary) { leavePrimary(); } else { leaveSecondary(); } m_screen->leave(); // make sure our idea of clipboard ownership is correct m_screen->checkClipboards(); // now not on screen m_entered = false; return true; } void Screen::reconfigure(UInt32 activeSides) { assert(m_isPrimary); m_screen->reconfigure(activeSides); } void Screen::warpCursor(SInt32 x, SInt32 y) { assert(m_isPrimary); m_screen->warpCursor(x, y); } void Screen::setClipboard(ClipboardID id, const IClipboard *clipboard) { m_screen->setClipboard(id, clipboard); } void Screen::grabClipboard(ClipboardID id) { m_screen->setClipboard(id, NULL); } void Screen::screensaver(bool) const { // do nothing } void Screen::keyDown(KeyID id, KeyModifierMask mask, KeyButton button, const String &lang) { // check for ctrl+alt+del emulation if (id == kKeyDelete && (mask & (KeyModifierControl | KeyModifierAlt)) == (KeyModifierControl | KeyModifierAlt)) { LOG((CLOG_DEBUG "emulating ctrl+alt+del press")); if (m_screen->fakeCtrlAltDel()) { return; } } m_screen->fakeKeyDown(id, mask, button, lang); } void Screen::keyRepeat(KeyID id, KeyModifierMask mask, SInt32 count, KeyButton button, const String &lang) { assert(!m_isPrimary); m_screen->fakeKeyRepeat(id, mask, count, button, lang); } void Screen::keyUp(KeyID, KeyModifierMask, KeyButton button) { m_screen->fakeKeyUp(button); } void Screen::mouseDown(ButtonID button) { m_screen->fakeMouseButton(button, true); } void Screen::mouseUp(ButtonID button) { m_screen->fakeMouseButton(button, false); } void Screen::mouseMove(SInt32 x, SInt32 y) { assert(!m_isPrimary); m_screen->fakeMouseMove(x, y); } void Screen::mouseRelativeMove(SInt32 dx, SInt32 dy) { assert(!m_isPrimary); m_screen->fakeMouseRelativeMove(dx, dy); } void Screen::mouseWheel(SInt32 xDelta, SInt32 yDelta) const { assert(!m_isPrimary); m_screen->fakeMouseWheel(xDelta, yDelta); } void Screen::resetOptions() { // reset options m_halfDuplex = 0; // let screen handle its own options m_screen->resetOptions(); } void Screen::setOptions(const OptionsList &options) { // update options for (UInt32 i = 0, n = (UInt32)options.size(); i < n; i += 2) { if (options[i] == kOptionHalfDuplexCapsLock) { if (options[i + 1] != 0) { m_halfDuplex |= KeyModifierCapsLock; } else { m_halfDuplex &= ~KeyModifierCapsLock; } LOG((CLOG_DEBUG1 "half-duplex caps-lock %s", ((m_halfDuplex & KeyModifierCapsLock) != 0) ? "on" : "off")); } else if (options[i] == kOptionHalfDuplexNumLock) { if (options[i + 1] != 0) { m_halfDuplex |= KeyModifierNumLock; } else { m_halfDuplex &= ~KeyModifierNumLock; } LOG((CLOG_DEBUG1 "half-duplex num-lock %s", ((m_halfDuplex & KeyModifierNumLock) != 0) ? "on" : "off")); } else if (options[i] == kOptionHalfDuplexScrollLock) { if (options[i + 1] != 0) { m_halfDuplex |= KeyModifierScrollLock; } else { m_halfDuplex &= ~KeyModifierScrollLock; } LOG((CLOG_DEBUG1 "half-duplex scroll-lock %s", ((m_halfDuplex & KeyModifierScrollLock) != 0) ? "on" : "off")); } } // update half-duplex options m_screen->setHalfDuplexMask(m_halfDuplex); // let screen handle its own options m_screen->setOptions(options); } void Screen::setSequenceNumber(UInt32 seqNum) { m_screen->setSequenceNumber(seqNum); } UInt32 Screen::registerHotKey(KeyID key, KeyModifierMask mask) { return m_screen->registerHotKey(key, mask); } void Screen::unregisterHotKey(UInt32 id) { m_screen->unregisterHotKey(id); } void Screen::fakeInputBegin() { assert(!m_fakeInput); m_fakeInput = true; m_screen->fakeInputBegin(); } void Screen::fakeInputEnd() { assert(m_fakeInput); m_fakeInput = false; m_screen->fakeInputEnd(); } bool Screen::isOnScreen() const { return m_entered; } bool Screen::isLockedToScreen() const { // check for pressed mouse buttons // HACK: commented out as it breaks new drag drop feature UInt32 buttonID = 0; if (m_screen->isAnyMouseButtonDown(buttonID)) { if (buttonID != kButtonLeft) { LOG((CLOG_DEBUG "locked by mouse buttonID: %d", buttonID)); } if (m_enableDragDrop) { return (buttonID == kButtonLeft) ? false : true; } else { return true; } } // not locked return false; } SInt32 Screen::getJumpZoneSize() const { if (!m_isPrimary) { return 0; } else { return m_screen->getJumpZoneSize(); } } void Screen::getCursorCenter(SInt32 &x, SInt32 &y) const { m_screen->getCursorCenter(x, y); } KeyModifierMask Screen::getActiveModifiers() const { return m_screen->getActiveModifiers(); } KeyModifierMask Screen::pollActiveModifiers() const { return m_screen->pollActiveModifiers(); } bool Screen::isDraggingStarted() const { return m_screen->isDraggingStarted(); } bool Screen::isFakeDraggingStarted() const { return m_screen->isFakeDraggingStarted(); } void Screen::setDraggingStarted(bool started) { m_screen->setDraggingStarted(started); } void Screen::startDraggingFiles(DragFileList &fileList) { m_screen->fakeDraggingFiles(fileList); } void Screen::setEnableDragDrop(bool enabled) { m_enableDragDrop = enabled; } String &Screen::getDraggingFilename() const { return m_screen->getDraggingFilename(); } void Screen::clearDraggingFilename() { m_screen->clearDraggingFilename(); } const String &Screen::getDropTarget() const { return m_screen->getDropTarget(); } void *Screen::getEventTarget() const { return m_screen; } bool Screen::getClipboard(ClipboardID id, IClipboard *clipboard) const { return m_screen->getClipboard(id, clipboard); } void Screen::getShape(SInt32 &x, SInt32 &y, SInt32 &w, SInt32 &h) const { m_screen->getShape(x, y, w, h); } void Screen::getCursorPos(SInt32 &x, SInt32 &y) const { m_screen->getCursorPos(x, y); } void Screen::enablePrimary() { // get notified of screen saver activation/deactivation m_screen->openScreensaver(true); // claim screen changed size m_events->addEvent(Event(m_events->forIScreen().shapeChanged(), getEventTarget())); } void Screen::enableSecondary() { // assume primary has all clipboards for (ClipboardID id = 0; id < kClipboardEnd; ++id) { grabClipboard(id); } } void Screen::disablePrimary() { // done with screen saver m_screen->closeScreensaver(); } void Screen::disableSecondary() { // done with screen saver m_screen->closeScreensaver(); } void Screen::enterPrimary() { // do nothing } void Screen::enterSecondary(KeyModifierMask) { // do nothing } void Screen::leavePrimary() { // we don't track keys while on the primary screen so update our // idea of them now. this is particularly to update the state of // the toggle modifiers. m_screen->updateKeyState(); } void Screen::leaveSecondary() { // release any keys we think are still down m_screen->fakeAllKeysUp(); } String Screen::getSecureInputApp() const { return m_screen->getSecureInputApp(); } } // namespace deskflow
10,928
C++
.cpp
411
23.720195
116
0.709068
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
true
false
false
13,480
ClientTaskBarReceiver.cpp
deskflow_deskflow/src/lib/deskflow/ClientTaskBarReceiver.cpp
/* * Deskflow -- mouse and keyboard sharing utility * Copyright (C) 2012-2016 Symless Ltd. * Copyright (C) 2003 Chris Schoeneman * * This package is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * found in the file LICENSE that should have accompanied this file. * * This package is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "deskflow/ClientTaskBarReceiver.h" #include "arch/Arch.h" #include "base/IEventQueue.h" #include "base/String.h" #include "client/Client.h" #include "common/constants.h" #include "mt/Lock.h" // // ClientTaskBarReceiver // ClientTaskBarReceiver::ClientTaskBarReceiver(IEventQueue *events) : m_state(kNotRunning), m_events(events) { // do nothing } ClientTaskBarReceiver::~ClientTaskBarReceiver() { // do nothing } void ClientTaskBarReceiver::updateStatus(Client *client, const String &errorMsg) { { // update our status m_errorMessage = errorMsg; if (client == NULL) { if (m_errorMessage.empty()) { m_state = kNotRunning; } else { m_state = kNotWorking; } } else { m_server = client->getServerAddress().getHostname(); if (client->isConnected()) { m_state = kConnected; } else if (client->isConnecting()) { m_state = kConnecting; } else { m_state = kNotConnected; } } // let subclasses have a go onStatusChanged(client); } // tell task bar ARCH->updateReceiver(this); } ClientTaskBarReceiver::EState ClientTaskBarReceiver::getStatus() const { return m_state; } const String &ClientTaskBarReceiver::getErrorMessage() const { return m_errorMessage; } void ClientTaskBarReceiver::quit() { m_events->addEvent(Event(Event::kQuit)); } void ClientTaskBarReceiver::onStatusChanged(Client *) { // do nothing } void ClientTaskBarReceiver::lock() const { // do nothing } void ClientTaskBarReceiver::unlock() const { // do nothing } std::string ClientTaskBarReceiver::getToolTip() const { switch (m_state) { case kNotRunning: return deskflow::string::sprintf("%s: Not running", kAppName); case kNotWorking: return deskflow::string::sprintf("%s: %s", kAppName, m_errorMessage.c_str()); case kNotConnected: return deskflow::string::sprintf("%s: Not connected: %s", kAppName, m_errorMessage.c_str()); case kConnecting: return deskflow::string::sprintf("%s: Connecting to %s...", kAppName, m_server.c_str()); case kConnected: return deskflow::string::sprintf("%s: Connected to %s", kAppName, m_server.c_str()); default: return ""; } }
2,962
C++
.cpp
103
25.660194
106
0.715745
deskflow/deskflow
10,364
3,653
93
GPL-2.0
9/20/2024, 9:26:25 PM (Europe/Amsterdam)
false
true
false
false
false
true
false
false