damn it
This commit is contained in:
parent
2ba0185701
commit
0874d58fb8
23 changed files with 2661 additions and 11 deletions
11
extern/pfd-fixed/examples/.gitignore
vendored
Normal file
11
extern/pfd-fixed/examples/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
example
|
||||
example.exe
|
||||
kill
|
||||
kill.exe
|
||||
|
||||
Debug
|
||||
Release
|
||||
*.vcxproj.user
|
||||
|
||||
.idea
|
||||
cmake-build-*
|
||||
110
extern/pfd-fixed/examples/example.cpp
vendored
Normal file
110
extern/pfd-fixed/examples/example.cpp
vendored
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
//
|
||||
// Portable File Dialogs
|
||||
//
|
||||
// Copyright © 2018—2020 Sam Hocevar <sam@hocevar.net>
|
||||
//
|
||||
// This program is free software. It comes without any warranty, to
|
||||
// the extent permitted by applicable law. You can redistribute it
|
||||
// and/or modify it under the terms of the Do What the Fuck You Want
|
||||
// to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
// See http://www.wtfpl.net/ for more details.
|
||||
//
|
||||
|
||||
#include "portable-file-dialogs.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#if _WIN32
|
||||
#define DEFAULT_PATH "C:\\"
|
||||
#else
|
||||
#define DEFAULT_PATH "/tmp"
|
||||
#endif
|
||||
|
||||
int main()
|
||||
{
|
||||
// Check that a backend is available
|
||||
if (!pfd::settings::available())
|
||||
{
|
||||
std::cout << "Portable File Dialogs are not available on this platform.\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Set verbosity to true
|
||||
pfd::settings::verbose(true);
|
||||
|
||||
// Notification
|
||||
pfd::notify("Important Notification",
|
||||
"This is ' a message, pay \" attention \\ to it!",
|
||||
pfd::icon::info);
|
||||
|
||||
// Message box with nice message
|
||||
auto m = pfd::message("Personal Message",
|
||||
"You are an amazing person, don’t let anyone make you think otherwise.",
|
||||
pfd::choice::yes_no_cancel,
|
||||
pfd::icon::warning);
|
||||
|
||||
// Optional: do something while waiting for user action
|
||||
for (int i = 0; i < 10 && !m.ready(1000); ++i)
|
||||
std::cout << "Waited 1 second for user input...\n";
|
||||
|
||||
// Do something according to the selected button
|
||||
switch (m.result())
|
||||
{
|
||||
case pfd::button::yes: std::cout << "User agreed.\n"; break;
|
||||
case pfd::button::no: std::cout << "User disagreed.\n"; break;
|
||||
case pfd::button::cancel: std::cout << "User freaked out.\n"; break;
|
||||
default: break; // Should not happen
|
||||
}
|
||||
|
||||
// Directory selection
|
||||
auto dir = pfd::select_folder("Select any directory", DEFAULT_PATH).result();
|
||||
std::cout << "Selected dir: " << dir << "\n";
|
||||
|
||||
// File open
|
||||
auto f = pfd::open_file("Choose files to read", DEFAULT_PATH,
|
||||
{ "Text Files (.txt .text)", "*.txt *.text",
|
||||
"All Files", "*" },
|
||||
pfd::opt::multiselect);
|
||||
std::cout << "Selected files:";
|
||||
for (auto const &name : f.result())
|
||||
std::cout << " " + name;
|
||||
std::cout << "\n";
|
||||
}
|
||||
|
||||
// Unused function that just tests the whole API
|
||||
void api()
|
||||
{
|
||||
// pfd::settings
|
||||
pfd::settings::verbose(true);
|
||||
pfd::settings::rescan();
|
||||
|
||||
// pfd::notify
|
||||
pfd::notify("", "");
|
||||
pfd::notify("", "", pfd::icon::info);
|
||||
pfd::notify("", "", pfd::icon::warning);
|
||||
pfd::notify("", "", pfd::icon::error);
|
||||
pfd::notify("", "", pfd::icon::question);
|
||||
|
||||
pfd::notify a("", "");
|
||||
(void)a.ready();
|
||||
(void)a.ready(42);
|
||||
|
||||
// pfd::message
|
||||
pfd::message("", "");
|
||||
pfd::message("", "", pfd::choice::ok);
|
||||
pfd::message("", "", pfd::choice::ok_cancel);
|
||||
pfd::message("", "", pfd::choice::yes_no);
|
||||
pfd::message("", "", pfd::choice::yes_no_cancel);
|
||||
pfd::message("", "", pfd::choice::retry_cancel);
|
||||
pfd::message("", "", pfd::choice::abort_retry_ignore);
|
||||
pfd::message("", "", pfd::choice::ok, pfd::icon::info);
|
||||
pfd::message("", "", pfd::choice::ok, pfd::icon::warning);
|
||||
pfd::message("", "", pfd::choice::ok, pfd::icon::error);
|
||||
pfd::message("", "", pfd::choice::ok, pfd::icon::question);
|
||||
|
||||
pfd::message b("", "");
|
||||
(void)b.ready();
|
||||
(void)b.ready(42);
|
||||
(void)b.result();
|
||||
}
|
||||
|
||||
96
extern/pfd-fixed/examples/example.vcxproj
vendored
Normal file
96
extern/pfd-fixed/examples/example.vcxproj
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="example.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="../portable-file-dialogs.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{10F4364D-27C4-4C74-8079-7C42971E81E7}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>example</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
42
extern/pfd-fixed/examples/kill.cpp
vendored
Normal file
42
extern/pfd-fixed/examples/kill.cpp
vendored
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
//
|
||||
// Portable File Dialogs
|
||||
//
|
||||
// Copyright © 2018—2020 Sam Hocevar <sam@hocevar.net>
|
||||
//
|
||||
// This program is free software. It comes without any warranty, to
|
||||
// the extent permitted by applicable law. You can redistribute it
|
||||
// and/or modify it under the terms of the Do What the Fuck You Want
|
||||
// to Public License, Version 2, as published by the WTFPL Task Force.
|
||||
// See http://www.wtfpl.net/ for more details.
|
||||
//
|
||||
|
||||
#include "portable-file-dialogs.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
int main()
|
||||
{
|
||||
// Set verbosity to true
|
||||
pfd::settings::verbose(true);
|
||||
|
||||
// Message box with nice message
|
||||
auto m = pfd::message("Upgrade software?",
|
||||
"Press OK to upgrade this software.\n"
|
||||
"\n"
|
||||
"By default, the software will update itself\n"
|
||||
"automatically in 10 seconds.",
|
||||
pfd::choice::ok_cancel,
|
||||
pfd::icon::warning);
|
||||
|
||||
// Wait for an answer for up to 10 seconds
|
||||
for (int i = 0; i < 10 && !m.ready(1000); ++i)
|
||||
;
|
||||
|
||||
// Upgrade software if user clicked OK, or if user didn’t interact
|
||||
bool upgrade = m.ready() ? m.result() == pfd::button::ok : m.kill();
|
||||
if (upgrade)
|
||||
std::cout << "Upgrading software!\n";
|
||||
else
|
||||
std::cout << "Not upgrading software.\n";
|
||||
}
|
||||
|
||||
96
extern/pfd-fixed/examples/kill.vcxproj
vendored
Normal file
96
extern/pfd-fixed/examples/kill.vcxproj
vendored
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="kill.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="../portable-file-dialogs.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>15.0</VCProjectVersion>
|
||||
<ProjectGuid>{B94D26B1-7EF7-43A2-A973-9A96A08E2E17}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>kill</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)'=='Release'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
Loading…
Add table
Add a link
Reference in a new issue