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
149#include "ui/AddressBarDialog.h"149#include "ui/AddressBarDialog.h"
150#include "ui/AvatarInputs.h"150#include "ui/AvatarInputs.h"
151#include "ui/DialogsManager.h"151#include "ui/DialogsManager.h"
152#include "ui/Gif.h"
152#include "ui/LoginDialog.h"153#include "ui/LoginDialog.h"
153#include "ui/overlays/Cube3DOverlay.h"154#include "ui/overlays/Cube3DOverlay.h"
154#include "ui/Snapshot.h"155#include "ui/Snapshot.h"
@@ -2511,7 +2512,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 2356 unmodified lines
2511 } else if (isOption && !isShifted && !isMeta) {2512 } else if (isOption && !isShifted && !isMeta) {
2512 Menu::getInstance()->triggerOption(MenuOption::ScriptEditor);2513 Menu::getInstance()->triggerOption(MenuOption::ScriptEditor);
2513 } else if (!isOption && !isShifted && isMeta) {2514 } else if (!isOption && !isShifted && isMeta) {
2514 takeSnapshot(true);2515 takeSnapshot(true, "still");
2515 }2516 }
2516 break;2517 break;
2517 2518
@@ -5428,14 +5429,43 @@ void Application::toggleLogDialog() { · 2910 unmodified lines
5428 }5429 }
5429}5430}
5430 5431
5431void Application::takeSnapshot(bool notify, float aspectRatio) {5432void Application::takeSnapshot(bool notify, const QString& format, float aspectRatio) {
5432 postLambdaEvent([notify, aspectRatio, this] {5433 postLambdaEvent([notify, format, aspectRatio, this] {
5433 QMediaPlayer* player = new QMediaPlayer();5434 QMediaPlayer* player = new QMediaPlayer();
5434 QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");5435 QFileInfo inf = QFileInfo(PathUtils::resourcesPath() + "sounds/snap.wav");
5435 player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));5436 player->setMedia(QUrl::fromLocalFile(inf.absoluteFilePath()));
5436 player->play();5437 player->play();
5437 5438
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 //}
5439 5469
5440 emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);5470 emit DependencyManager::get<WindowScriptingInterface>()->snapshotTaken(path, notify);
5441 });5471 });