History

Initial progressgit add -A!

Zach Fox committed 10 years ago

Commit 704476c1 parent c81b0fc6 files · +869 −9Browse files

Showing the changes to interface/src/Application.cpp (1 of 6 files). Show all

Unified · Split

interface/src/Application.cpp+34−4
@@ -149,6 +149,7 @@ · 148 unmodified lines
149149 #include "ui/AddressBarDialog.h"
150150 #include "ui/AvatarInputs.h"
151151 #include "ui/DialogsManager.h"
152+#include "ui/Gif.h"
152153 #include "ui/LoginDialog.h"
153154 #include "ui/overlays/Cube3DOverlay.h"
154155 #include "ui/Snapshot.h"
@@ -2511,7 +2512,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 2356 unmodified lines
25112512 } else if (isOption && !isShifted && !isMeta) {
25122513 Menu::getInstance()->triggerOption(MenuOption::ScriptEditor);
25132514 } else if (!isOption && !isShifted && isMeta) {
2514− takeSnapshot(true);
2515+ takeSnapshot(true, "still");
25152516 }
25162517 break;
25172518
@@ -5428,14 +5429,43 @@ void Application::toggleLogDialog() { · 2910 unmodified lines
54285429 }
54295430 }
54305431
5431−void Application::takeSnapshot(bool notify, float aspectRatio) {
5432− postLambdaEvent([notify, aspectRatio, this] {
5432+void Application::takeSnapshot(bool notify, const QString& format, float aspectRatio) {
5433+ postLambdaEvent([notify, format, aspectRatio, this] {
54335434 QMediaPlayer* player = new QMediaPlayer();
54345435 QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
54355436 player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
54365437 player->play();
54375438
5438− QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
5439+ //QString path = Snapshot::saveSnapshot(getActiveDisplayPlugin()->getScreenshot(aspectRatio));
5440+
5441+ //if (!format.compare("animated"))
5442+ //{
5443+ QImage frame;
5444+ GifWriter myGifWriter;
5445+ char* cstr;
5446+
5447+ QString path = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
5448+ path.append(QDir::separator());
5449+ path.append("test.gif");
5450+
5451+ string fname = path.toStdString();
5452+ cstr = new char[fname.size() + 1];
5453+ strcpy(cstr, fname.c_str());
5454+
5455+ GifBegin(&myGifWriter, cstr, 1, 1, 0);
5456+
5457+ uint8_t test[4] = { 0xFF, 0x00, 0x00, 0x00 };
5458+
5459+ for (uint8_t itr = 0; itr < 30; itr++)
5460+ {
5461+ test[0] = 0xFF / (itr + 1);
5462+ //frame = (getActiveDisplayPlugin()->getScreenshot(aspectRatio)).scaledToWidth(500);
5463+
5464+ GifWriteFrame(&myGifWriter, test, 1, 1, 0);
5465+ }
5466+
5467+ GifEnd(&myGifWriter);
5468+ //}
54395469
54405470 emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
54415471 });