-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Split TimeLineWidget into core and GUI parts
#7004
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /* | ||
| * Timeline.h | ||
| * | ||
| * Copyright (c) 2023 Dominic Clark | ||
| * | ||
| * This file is part of LMMS - https://lmms.io | ||
| * | ||
| * 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 2 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 (see COPYING); if not, write to the | ||
| * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
| * Boston, MA 02110-1301 USA. | ||
| */ | ||
|
|
||
| #ifndef LMMS_TIMELINE_H | ||
| #define LMMS_TIMELINE_H | ||
|
|
||
| #include <QObject> | ||
|
|
||
| #include "JournallingObject.h" | ||
| #include "TimePos.h" | ||
|
|
||
| namespace lmms { | ||
|
|
||
| class Timeline : public QObject, public JournallingObject | ||
| { | ||
| Q_OBJECT | ||
|
|
||
| public: | ||
| enum class StopBehaviour | ||
| { | ||
| BackToZero, | ||
| BackToStart, | ||
| KeepPosition | ||
| }; | ||
|
|
||
| auto loopBegin() const -> TimePos { return m_loopBegin; } | ||
| auto loopEnd() const -> TimePos { return m_loopEnd; } | ||
| auto loopEnabled() const -> bool { return m_loopEnabled; } | ||
|
|
||
| void setLoopBegin(TimePos begin); | ||
| void setLoopEnd(TimePos end); | ||
| void setLoopPoints(TimePos begin, TimePos end); | ||
| void setLoopEnabled(bool enabled); | ||
|
|
||
| auto playStartPosition() const -> TimePos { return m_playStartPosition; } | ||
| auto stopBehaviour() const -> StopBehaviour { return m_stopBehaviour; } | ||
|
|
||
| void setPlayStartPosition(TimePos position) { m_playStartPosition = position; } | ||
| void setStopBehaviour(StopBehaviour behaviour); | ||
|
|
||
| auto nodeName() const -> QString override { return "timeline"; } | ||
|
|
||
| signals: | ||
| void loopEnabledChanged(bool enabled); | ||
| void stopBehaviourChanged(lmms::Timeline::StopBehaviour behaviour); | ||
|
|
||
| protected: | ||
| void saveSettings(QDomDocument& doc, QDomElement& element) override; | ||
| void loadSettings(const QDomElement& element) override; | ||
|
|
||
| private: | ||
| TimePos m_loopBegin = TimePos{0}; | ||
| TimePos m_loopEnd = TimePos{DefaultTicksPerBar}; | ||
| bool m_loopEnabled = false; | ||
|
|
||
| StopBehaviour m_stopBehaviour = StopBehaviour::BackToStart; | ||
| TimePos m_playStartPosition = TimePos{-1}; | ||
| }; | ||
|
|
||
| } // namespace lmms | ||
|
|
||
| #endif // LMMS_TIMELINE_H |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we would just say
timelineinstead ofgetTimeline?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True - I was going for consistency with
getPlayPos, but we do prefer to omit theget.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you may have forgotten about this, but it's fine 👍 the suggestion isn't really blocking anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah, I think it got mistakenly marked as resolved a while back and I never looked back up since. At least it's only a style thing.