Applied patch from AsamK and fixed german translation.

Reduced code duplication with avatar picture loading, by creating two new functions that handle image choosing and thumbnail creation.

two new functions:
bool misc::getOpenAvatarPicture(QWidget *parent, QByteArray &image_data)
QPixmap misc::getOpenThumbnailedPicture(QWidget *parent, const QString &caption, int width, int height)

getOpenThumbnailedPicture opens a QFileDialog to let the user choose a picture file. This picture is converted to a thumbnail and returned as a QPixmap.

getOpenAvatarPicture calls getOpenThumbnailedPicture and converts the result to a PNG byte array.

All three avatar loading functions now call getOpenAvatarPicture
Furthermore Channel Logo and Channel Msg thumbnail functions now use getOpenThumbnailedPicture

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4561 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2011-08-12 20:27:05 +00:00
parent 43c0594d18
commit 0fbada0eba
12 changed files with 666 additions and 212 deletions

View file

@ -156,6 +156,8 @@ class misc : public QObject
static QString removeNewLine(const std::string &text);
static QString removeNewLine(const std::wstring &text);
static bool getOpenAvatarPicture(QWidget *parent, QByteArray &image_data);
static QPixmap getOpenThumbnailedPicture(QWidget *parent, const QString &caption, int width, int height);
static bool getOpenFileName(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QString &file);
static bool getOpenFileNames(QWidget *parent, RshareSettings::enumLastDir type, const QString &caption, const QString &filter, QStringList &files);