fixed: UGContainer<Type> used a std::vector<Type> and when a new item was inserted
then current iterators (and pointers) were invalidated now we are using std::vector<Type*> this caused some crashes when a new user was added by 'adduser' winix function added: plugin 'export' is able to upload files on a remote server now (not finished yet) changed: Thumb class is now called: Image and we are able to resize images too (some new options in the config and in mount points) added: some new plugin messages git-svn-id: svn://ttmath.org/publicrep/winix/trunk@764 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
114
core/image.h
Executable file
114
core/image.h
Executable file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010-2011, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_core_image
|
||||
#define headerfile_winix_core_image
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include "basethread.h"
|
||||
#include "textstream.h"
|
||||
#include "db/db.h"
|
||||
#include "core/item.h"
|
||||
#include "core/config.h"
|
||||
|
||||
|
||||
class System;
|
||||
|
||||
|
||||
|
||||
// Width given, height automagically selected to preserve aspect ratio.
|
||||
#define WINIX_IMAGE_MODE_1 1
|
||||
|
||||
// Height given, width automagically selected to preserve aspect ratio.
|
||||
#define WINIX_IMAGE_MODE_2 2
|
||||
|
||||
// Maximum values of height and width given, aspect ratio preserved.
|
||||
#define WINIX_IMAGE_MODE_3 3
|
||||
|
||||
// Minimum values of width and height given, aspect ratio preserved.
|
||||
#define WINIX_IMAGE_MODE_4 4
|
||||
|
||||
// Width and height emphatically given, original aspect ratio ignored.
|
||||
#define WINIX_IMAGE_MODE_5 5
|
||||
|
||||
// Change as per widthxheight but only if an image dimension exceeds a specified dimension.
|
||||
#define WINIX_IMAGE_MODE_6 6
|
||||
|
||||
// Change dimensions only if both image dimensions are less than specified dimensions.
|
||||
#define WINIX_IMAGE_MODE_7 7
|
||||
|
||||
|
||||
// resizing
|
||||
#define WINIX_IMAGE_TYPE_RESIZE 1
|
||||
|
||||
// generating a thumbnail
|
||||
#define WINIX_IMAGE_TYPE_CREATE_THUMB 2
|
||||
|
||||
|
||||
|
||||
|
||||
class Image : public BaseThread
|
||||
{
|
||||
public:
|
||||
|
||||
void SetDb(Db * pdb);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetSystem(System * psystem);
|
||||
|
||||
void Resize(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality);
|
||||
void CreateThumb(const Item & item, size_t cx, size_t cy, int aspect_mode, int quality);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
Db * db;
|
||||
Config * config;
|
||||
System * system;
|
||||
|
||||
struct ImageItem
|
||||
{
|
||||
int type; // WINIX_IMAGE_TYPE_*
|
||||
Item file;
|
||||
size_t cx;
|
||||
size_t cy;
|
||||
int aspect_mode;
|
||||
int quality;
|
||||
};
|
||||
|
||||
// queue of thumbnails to create
|
||||
typedef std::list<ImageItem> ImageTab;
|
||||
ImageTab image_tab;
|
||||
ImageItem item_temp;
|
||||
|
||||
// only for second thread
|
||||
ImageItem item_work;
|
||||
std::wstring src_path, dst_path;
|
||||
TextStream<std::string> command;
|
||||
TextStream<std::wstring> stream_tmp_path;
|
||||
DbItemQuery iq;
|
||||
std::string add_tempa;
|
||||
std::string input_file_name;
|
||||
std::string tmp_file_name;
|
||||
|
||||
virtual bool SignalReceived();
|
||||
virtual void Do();
|
||||
bool CreateCommand();
|
||||
bool CreateInputFileName();
|
||||
void CreateTmpFileName();
|
||||
void SaveImage();
|
||||
void CreateImage();
|
||||
void SelectAspect();
|
||||
void EscapePath(const std::string & path, TextStream<std::string> & out, bool clear_stream = true);
|
||||
void CheckParam(ImageItem & item);
|
||||
void Add(const std::wstring & in, TextStream<std::string> & out);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user