Skip to content

Commit

Permalink
Created tigmaker, currently only intended for my use.
Browse files Browse the repository at this point in the history
  • Loading branch information
korslund committed Jan 19, 2012
1 parent 2dd7aee commit f9e0ee3
Show file tree
Hide file tree
Showing 7 changed files with 413 additions and 11 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -4,7 +4,11 @@ CMakeCache.txt
CMakeFiles
cmake_install.cmake
tiggit
tigmaker
tigmaker.json
response.txt
*.dll
*.exe
*~
icon.res
override
6 changes: 5 additions & 1 deletion CMakeLists.txt
Expand Up @@ -11,10 +11,14 @@ set(JSON ${JS}/json_reader.cpp ${JS}/json_writer.cpp ${JS}/json_value.cpp)

set(ZZip_LIBRARIES zzip)

set(LIBS ${CURL_LIBRARIES} ${Boost_LIBRARIES} ${wxWidgets_LIBRARIES} ${ZZip_LIBRARIES})
set(MLIBS ${CURL_LIBRARIES} ${wxWidgets_LIBRARIES})
set(LIBS ${MLIBS} ${Boost_LIBRARIES} ${ZZip_LIBRARIES})

# This automagically sets up everything for us
include( ${wxWidgets_USE_FILE} )

add_executable(tiggit tiggit.cpp ${JSON})
target_link_libraries(tiggit ${LIBS})

add_executable(tigmaker tigmaker.cpp ${JSON})
target_link_libraries(tigmaker ${MLIBS})
5 changes: 2 additions & 3 deletions config.hpp
Expand Up @@ -92,13 +92,12 @@ struct Config

void write()
{
std::ofstream of(filename.c_str());

Json::Value root;
root["repo_version"] = "3";
// TODO: Subject to 2038-bug
root["last_time"] = (int)lastTime;
of << root;

writeJson(filename, root);
}
};

Expand Down
4 changes: 3 additions & 1 deletion data_reader.hpp
Expand Up @@ -155,7 +155,9 @@ struct TigListReader

// Figure out if this game is new
bool isNew = false;
if(add_time > conf.lastTime)
if(add_time > conf.lastTime &&
conf.lastTime != 0) // Don't mark any as 'new' for
// first-time runs
isNew = true;

// Calculate the latest game time
Expand Down
7 changes: 7 additions & 0 deletions readjson.hpp
Expand Up @@ -24,6 +24,13 @@ Json::Value parseJsonString(const std::string &string)
}
*/

void writeJson(const std::string &file, const Json::Value &value)
{
// Fix error handling later
std::ofstream of(file.c_str());
of << value;
}

Json::Value readJson(const std::string &file)
{
using namespace Json;
Expand Down
6 changes: 0 additions & 6 deletions tiggit.cpp
Expand Up @@ -9,7 +9,6 @@

#include <iostream>
#include <assert.h>
#include <set>
#include <time.h>

#include "image_viewer.hpp"
Expand Down Expand Up @@ -1334,11 +1333,6 @@ class MyApp : public wxApp
{
MyTimer *time;

void test(const std::string &inp)
{
cout << inp << " => " << tig_reader.URL(inp) << endl;
}

public:
virtual bool OnInit()
{
Expand Down

0 comments on commit f9e0ee3

Please sign in to comment.