mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-29 22:03:40 -06:00
Merge continued
git-svn-id: svn://ultimatepp.org/upp/trunk@10263 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
adf46bd64e
commit
2e4b276e07
3860 changed files with 1161787 additions and 438 deletions
78
uppdev/ThreadedImageLoader/ThreadedImageLoader.h
Normal file
78
uppdev/ThreadedImageLoader/ThreadedImageLoader.h
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
#ifndef _ThreadedImageLoader_ThreadedImageLoader_h
|
||||
#define _ThreadedImageLoader_ThreadedImageLoader_h
|
||||
|
||||
#include <CtrlLib/CtrlLib.h>
|
||||
#include <plugin/jpg/jpg.h>
|
||||
#include <ImageDisplayCtrl/ImageDisplayCtrl.h>
|
||||
|
||||
#define LAYOUTFILE <ThreadedImageLoader/ThreadedImageLoader.lay>
|
||||
#include <CtrlCore/lay.h>
|
||||
|
||||
struct ThreadedImageLoadInfo : Moveable<ThreadedImageLoadInfo> {
|
||||
String filepath;
|
||||
|
||||
ThreadedImageLoadInfo() {}
|
||||
ThreadedImageLoadInfo(const String& in_filepath) : filepath(in_filepath) {}
|
||||
};
|
||||
struct ThreadedImageLoadResult : public ThreadedImageLoadInfo , Moveable<ThreadedImageLoadResult> {
|
||||
PixelArray image;
|
||||
bool valid;
|
||||
ThreadedImageLoadResult() : valid(false) {}
|
||||
};
|
||||
|
||||
|
||||
class ImageLoader
|
||||
{
|
||||
public:
|
||||
ImageLoader();
|
||||
|
||||
Callback WhenImageReady;
|
||||
|
||||
volatile bool ReadyToLoad() const { return ready_to_load_; }
|
||||
volatile bool NewImageAvailable() const { return new_image_ready_; }
|
||||
inline void Reset() { new_image_ready_ = false; }
|
||||
|
||||
const ThreadedImageLoadResult& Result() const { return loading_info_; }
|
||||
|
||||
void LoadNextImage( const ThreadedImageLoadInfo& info );
|
||||
void Die();
|
||||
|
||||
String Status() const { return status_; }
|
||||
|
||||
void LoadingThreadFunction();
|
||||
|
||||
protected:
|
||||
volatile bool ready_to_load_;
|
||||
volatile bool new_image_ready_;
|
||||
volatile bool time_to_die_;
|
||||
|
||||
ThreadedImageLoadResult loading_info_;
|
||||
|
||||
String status_;
|
||||
|
||||
Event job_ready_;
|
||||
};
|
||||
|
||||
|
||||
class ThreadedImageLoader : public WithThreadedImageLoaderLayout<TopWindow> {
|
||||
public:
|
||||
typedef ThreadedImageLoader CLASSNAME;
|
||||
ThreadedImageLoader();
|
||||
~ThreadedImageLoader();
|
||||
|
||||
void OnImageLoaded();
|
||||
void OnSelectDir();
|
||||
void SyncTime();
|
||||
|
||||
public:
|
||||
// Menu control
|
||||
MenuBar menus;
|
||||
void SetupMainMenu(Bar& bar);
|
||||
|
||||
protected:
|
||||
ImageLoader loader;
|
||||
Thread loader_thread;
|
||||
Vector<String> remaining;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue