|
|
@@ -4,9 +4,8 @@
|
|
|
#include "WallpaperEngine/Logging/CLog.h"
|
|
|
|
|
|
#include <cstring>
|
|
|
-#include <getopt.h>
|
|
|
-#include <glm/common.hpp>
|
|
|
#include <string>
|
|
|
+#include <getopt.h>
|
|
|
|
|
|
#define WORKSHOP_APP_ID 431960
|
|
|
#define APP_DIRECTORY "wallpaper_engine"
|
|
|
@@ -14,23 +13,23 @@
|
|
|
using namespace WallpaperEngine::Application;
|
|
|
|
|
|
struct option long_options [] = {
|
|
|
- {"screen-root", required_argument, nullptr, 'r'},
|
|
|
- {"pkg", required_argument, nullptr, 'p'},
|
|
|
- {"dir", required_argument, nullptr, 'd'},
|
|
|
- {"silent", no_argument, nullptr, 's'},
|
|
|
- {"volume", required_argument, nullptr, 'v'},
|
|
|
- {"help", no_argument, nullptr, 'h'},
|
|
|
- {"fps", required_argument, nullptr, 'f'},
|
|
|
- {"assets-dir", required_argument, nullptr, 'a'},
|
|
|
- {"screenshot", required_argument, nullptr, 'c'},
|
|
|
- {"list-properties", no_argument, nullptr, 'l'},
|
|
|
- {"set-property", required_argument, nullptr, 'o'},
|
|
|
- {nullptr, 0, nullptr, 0}
|
|
|
+ {"screen-root", required_argument, 0, 'r'},
|
|
|
+ {"pkg", required_argument, 0, 'p'},
|
|
|
+ {"dir", required_argument, 0, 'd'},
|
|
|
+ {"silent", no_argument, 0, 's'},
|
|
|
+ {"volume", required_argument, 0, 'v'},
|
|
|
+ {"help", no_argument, 0, 'h'},
|
|
|
+ {"fps", required_argument, 0, 'f'},
|
|
|
+ {"assets-dir", required_argument, 0, 'a'},
|
|
|
+ {"screenshot", required_argument, 0, 'c'},
|
|
|
+ {"list-properties", no_argument, 0, 'l'},
|
|
|
+ {"set-property", required_argument, 0, 'o'},
|
|
|
+ {nullptr, 0, 0, 0}
|
|
|
};
|
|
|
|
|
|
std::string stringPathFixes(const std::string& s)
|
|
|
{
|
|
|
- if (s.empty ())
|
|
|
+ if (s.empty () == true)
|
|
|
return s;
|
|
|
|
|
|
std::string str (s);
|
|
|
@@ -49,8 +48,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
|
|
|
maximumFPS (30),
|
|
|
audioVolume (128),
|
|
|
audioEnabled (true),
|
|
|
- onlyListProperties (false),
|
|
|
- screenshotFormat (FIF_UNKNOWN)
|
|
|
+ onlyListProperties (false)
|
|
|
{
|
|
|
int c;
|
|
|
|
|
|
@@ -97,7 +95,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
|
|
|
break;
|
|
|
|
|
|
case 'f':
|
|
|
- maximumFPS = strtol (optarg, nullptr, 0);
|
|
|
+ maximumFPS = atoi (optarg);
|
|
|
break;
|
|
|
|
|
|
case 'a':
|
|
|
@@ -105,20 +103,17 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
|
|
|
break;
|
|
|
|
|
|
case 'v':
|
|
|
- this->audioVolume = glm::clamp ((int) strtol (optarg, nullptr, 0), 0, 128);
|
|
|
+ this->audioVolume = std::max (atoi (optarg), 128);
|
|
|
break;
|
|
|
|
|
|
case 'c':
|
|
|
this->takeScreenshot = true;
|
|
|
this->screenshot = stringPathFixes (optarg);
|
|
|
break;
|
|
|
-
|
|
|
- default:
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (this->background.empty ())
|
|
|
+ if (this->background.empty () == true)
|
|
|
{
|
|
|
if (optind < argc && strlen (argv [optind]) > 0)
|
|
|
{
|
|
|
@@ -126,7 +121,7 @@ CApplicationContext::CApplicationContext (int argc, char* argv[]) :
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- CApplicationContext::printHelp (argv [0]);
|
|
|
+ this->printHelp (argv [0]);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -146,7 +141,7 @@ void CApplicationContext::validatePath ()
|
|
|
|
|
|
void CApplicationContext::validateAssets ()
|
|
|
{
|
|
|
- if (!this->assets.empty ())
|
|
|
+ if (this->assets.empty () == false)
|
|
|
{
|
|
|
sLog.out ("Using wallpaper engine's assets at ", this->assets, " based on --assets-dir parameter");
|
|
|
return;
|
|
|
@@ -166,10 +161,10 @@ void CApplicationContext::validateAssets ()
|
|
|
|
|
|
void CApplicationContext::validateScreenshot ()
|
|
|
{
|
|
|
- if (!this->takeScreenshot)
|
|
|
+ if (this->takeScreenshot == false)
|
|
|
return;
|
|
|
|
|
|
- if (!this->screenshot.has_extension ())
|
|
|
+ if (this->screenshot.has_extension () == false)
|
|
|
sLog.exception ("Cannot determine screenshot format");
|
|
|
|
|
|
std::string extension = this->screenshot.extension ();
|
|
|
@@ -194,7 +189,7 @@ void CApplicationContext::printHelp (const char* route)
|
|
|
sLog.out ("");
|
|
|
sLog.out ("options:");
|
|
|
sLog.out ("\t--silent\t\t\t\t\tMutes all the sound the wallpaper might produce");
|
|
|
- sLog.out ("\t--volume <amount>\t\t\tSets the volume for all the sounds in the background (0 - 128)");
|
|
|
+ sLog.out ("\t--volume <amount>\t\t\tSets the volume for all the sounds in the background");
|
|
|
sLog.out ("\t--screen-root <screen name>\tDisplay as screen's background");
|
|
|
sLog.out ("\t--fps <maximum-fps>\t\t\tLimits the FPS to the given number, useful to keep battery consumption low");
|
|
|
sLog.out ("\t--assets-dir <path>\t\t\tFolder where the assets are stored");
|