mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-04 23:25:32 -04:00
New class "StatusDefs" for status information like strings, images, fonts and colors.
Removed the status string function from the lib. Removed static strings like " - " and " : " from translation. Removed not needed images. Fixed german translation in MessengerWindow, PeersDialog and PopupChatDialog. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3472 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d05d723af1
commit
60746b5702
17 changed files with 517 additions and 2494 deletions
140
retroshare-gui/src/gui/common/StatusDefs.cpp
Normal file
140
retroshare-gui/src/gui/common/StatusDefs.cpp
Normal file
|
@ -0,0 +1,140 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2010, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
||||
#include "StatusDefs.h"
|
||||
|
||||
const QString StatusDefs::name(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return QObject::tr("Offline");
|
||||
case RS_STATUS_AWAY:
|
||||
return QObject::tr("Away");
|
||||
case RS_STATUS_BUSY:
|
||||
return QObject::tr("Busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
return QObject::tr("Online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
return QObject::tr("Idle");
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::name: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageIM(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return ":/images/im-user-offline.png";
|
||||
case RS_STATUS_AWAY:
|
||||
return ":/images/im-user-away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
return ":/images/im-user-busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
return ":/images/im-user.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
return ":/images/im-user-inactive.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageIM: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const char *StatusDefs::imageUser(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return ":/images/user/identityoffline24.png";
|
||||
case RS_STATUS_AWAY:
|
||||
return ":/images/user/identity24away.png";
|
||||
case RS_STATUS_BUSY:
|
||||
return ":/images/user/identity24busy.png";
|
||||
case RS_STATUS_ONLINE:
|
||||
return ":/images/user/identity24.png";
|
||||
case RS_STATUS_INACTIVE:
|
||||
return ":/images/user/identity24idle.png";
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::imageUser: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const QString StatusDefs::tooltip(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return QObject::tr("Peer is offline");
|
||||
case RS_STATUS_AWAY:
|
||||
return QObject::tr("Peer is away");
|
||||
case RS_STATUS_BUSY:
|
||||
return QObject::tr("Peer is busy");
|
||||
case RS_STATUS_ONLINE:
|
||||
return QObject::tr("Peer is online");
|
||||
case RS_STATUS_INACTIVE:
|
||||
return QObject::tr("Peer is idle");
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::tooltip: Unknown status requested " << status;
|
||||
return "";
|
||||
}
|
||||
|
||||
const QColor StatusDefs::textColor(unsigned int status)
|
||||
{
|
||||
switch (status) {
|
||||
case RS_STATUS_OFFLINE:
|
||||
return Qt::black;
|
||||
case RS_STATUS_AWAY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_BUSY:
|
||||
return Qt::gray;
|
||||
case RS_STATUS_ONLINE:
|
||||
return Qt::darkBlue;
|
||||
case RS_STATUS_INACTIVE:
|
||||
return Qt::gray;
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::textColor: Unknown status requested " << status;
|
||||
return Qt::black;
|
||||
}
|
||||
|
||||
const QFont StatusDefs::font(unsigned int status)
|
||||
{
|
||||
QFont font;
|
||||
|
||||
switch (status) {
|
||||
case RS_STATUS_AWAY:
|
||||
case RS_STATUS_BUSY:
|
||||
case RS_STATUS_ONLINE:
|
||||
case RS_STATUS_INACTIVE:
|
||||
font.setBold(true);
|
||||
return font;
|
||||
case RS_STATUS_OFFLINE:
|
||||
font.setBold(false);
|
||||
return font;
|
||||
}
|
||||
|
||||
std::cerr << "StatusDefs::font: Unknown status requested " << status;
|
||||
return font;
|
||||
}
|
42
retroshare-gui/src/gui/common/StatusDefs.h
Normal file
42
retroshare-gui/src/gui/common/StatusDefs.h
Normal file
|
@ -0,0 +1,42 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2010, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
|
||||
#ifndef _STATUSDEFS_H
|
||||
#define _STATUSDEFS_H
|
||||
|
||||
#include <QColor>
|
||||
#include <QFont>
|
||||
|
||||
class StatusDefs
|
||||
{
|
||||
public:
|
||||
static const QString name(unsigned int status);
|
||||
static const char* imageIM(unsigned int status);
|
||||
static const char* imageUser(unsigned int status);
|
||||
static const QString tooltip(unsigned int status);
|
||||
|
||||
static const QColor textColor(unsigned int status);
|
||||
static const QFont font(unsigned int status);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue