Skip to content

Commit

Permalink
Allow exporting animation previews as GIFs
Browse files Browse the repository at this point in the history
Uses this library to export the GIF:

https://github.com/wernsey/bitmap

I haven't found a way to disable the compression yet,
but this is a good starting point.

Closes #129
  • Loading branch information
mitchcurtis committed Jul 20, 2019
1 parent 3240bcc commit ddd398f
Show file tree
Hide file tree
Showing 19 changed files with 8,580 additions and 30 deletions.
33 changes: 33 additions & 0 deletions app/qml/ui/AnimationPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import QtQuick.Controls 2.12
import QtQuick.Layouts 1.1
import QtQuick.Window 2.12

import Qt.labs.platform 1.0 as Platform

import App 1.0

import "." as Ui
Expand All @@ -46,6 +48,15 @@ Panel {
onReadyToSave: root.project.uiState.setValue("animationPanelExpanded", root.expanded)
}

Platform.FileDialog {
id: saveGifDialog
objectName: "saveGifDialog"
fileMode: Platform.FileDialog.SaveFile
nameFilters: ["GIF files (*.gif)"]
defaultSuffix: "gif"
onAccepted: project.exportGif(file)
}

settingsPopup: AnimationSettingsPopup {
x: (parent.width - width) / 2
y: (parent.height - height) / 2
Expand Down Expand Up @@ -88,6 +99,14 @@ Panel {
}
}

Ui.VerticalSeparator {
padding: 6
topPadding: 0
bottomPadding: 0

Layout.fillWidth: true
}

RowLayout {
// We only use one icon from typicons.
FontLoader {
Expand Down Expand Up @@ -119,6 +138,20 @@ Panel {
font.family: fontLoader.name
onClicked: animationPlayback.loop = checked
}

ToolButton {
objectName: "exportGifButton"
text: "\uf019"
font.family: "FontAwesome"
focusPolicy: Qt.NoFocus

ToolTip.text: qsTr("Export the animation preview as a GIF")
ToolTip.visible: hovered
ToolTip.delay: toolTipDelay
ToolTip.timeout: toolTipTimeout

onClicked: saveGifDialog.open()
}
}
}
}
21 changes: 21 additions & 0 deletions lib/3rdparty/bitmap/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Werner Stoop

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit ddd398f

Please sign in to comment.