void DockingConView::createItems(ControllerForm *conForm)
{
/* bezel */
- bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
+ bezelItem = new SkinBezelItem(conForm->skinImg[LayoutForm::normal]);
scene()->addItem(bezelItem);
/* HW keys */
- keyList = conForm->keyList;
+ QList<HardwareKey *> &keyList = conForm->getKeyList();
if (conForm->isGeneralPurpose() == false) {
HardwareKey *hwKey = NULL;
hwKey = keyList.at(i);
if (hwKey != NULL) {
new SkinKeyItem(bezelItem, hwKey,
- conForm->conImg[ControllerForm::pressed].copy(hwKey->getRegion()),
+ conForm->skinImg[LayoutForm::pressed].copy(hwKey->getRegion()),
conForm->getHoverType());
}
}
return conViewStat;
}
-QList<HardwareKey *> DockingConView::getKeyList()
-{
- return keyList;
-}
-
DockingConView::~DockingConView()
{
qDebug("destroy docking controller view");
public:
DockingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
~DockingConView();
- QList<HardwareKey *> getKeyList();
enum conViewStatus {
CONVIEW_PRESSED,
DockingController *parent;
SkinBezelItem *bezelItem;
QRubberBand *rubberBand;
- QList<HardwareKey *> keyList;
conViewStatus conViewStat;
};
menu->setChecked(true);
}
- QImage *baseImage = &(conForm->conImg[ControllerForm::normal]);
+ QImage *baseImage = &(conForm->skinImg[LayoutForm::normal]);
if (baseImage->isNull() == true) {
qWarning("invalid image for region");
} else {
void FloatingConView::createItems(ControllerForm *conForm)
{
/* bezel */
- bezelItem = new SkinBezelItem(conForm->conImg[ControllerForm::normal]);
+ bezelItem = new SkinBezelItem(conForm->skinImg[LayoutForm::normal]);
scene()->addItem(bezelItem);
/* HW keys */
- keyList = conForm->keyList;
+ QList<HardwareKey *> &keyList = conForm->getKeyList();
if (conForm->isGeneralPurpose() == false) {
HardwareKey *hwKey = NULL;
hwKey = keyList.at(i);
if (hwKey != NULL) {
new SkinKeyItem(bezelItem, hwKey,
- conForm->conImg[ControllerForm::pressed].copy(hwKey->getRegion()),
+ conForm->skinImg[LayoutForm::pressed].copy(hwKey->getRegion()),
conForm->getHoverType());
}
}
win->activateWindow();
}
-QList<HardwareKey *> FloatingConView::getKeyList()
-{
- return keyList;
-}
-
FloatingConView::~FloatingConView()
{
qDebug("destroy floating controller view");
public:
FloatingConView(ControllerForm *conForm, QGraphicsScene *scene, QWidget *parent = 0);
~FloatingConView();
- QList<HardwareKey *> getKeyList();
protected:
void resizeEvent(QResizeEvent *event);
FloatingController *parent;
SkinBezelItem *bezelItem;
QRubberBand *rubberBand;
- QList<HardwareKey *> keyList;
};
#endif // FLOATINGCONVIEW_H
hide();
- registerHwKeyShortcuts(win->uiInfo->getMainForm()->keyList);
+ registerHwKeyShortcuts(win->uiInfo->getMainForm()->getKeyList());
}
-QMap<HardwareKey *, QShortcut *> KeyboardShortcut::getHwKeyShortcutMap()
+QMap<HardwareKey *, QShortcut *> &KeyboardShortcut::getHwKeyShortcutMap()
{
return hwKeyShortcutMap;
}
-void KeyboardShortcut::registerHwKeyShortcuts(QList<HardwareKey *> list)
+void KeyboardShortcut::registerHwKeyShortcuts(QList<HardwareKey *> &list)
{
for (int index = 0; index < list.count(); index++) {
HardwareKey *hwKey = list.at(index);
qDebug() << hwKeyShortcutMap.count() << "shortcuts have been registered";
}
-void KeyboardShortcut::cancelHwKeyShortcuts(QList<HardwareKey *> list)
+void KeyboardShortcut::cancelHwKeyShortcuts(QList<HardwareKey *> &list)
{
for (int index = 0; index < list.count(); index++) {
delete hwKeyShortcutMap.value(list.at(index));
KeyboardShortcut(QWidget *parent = 0);
~KeyboardShortcut();
- void registerHwKeyShortcuts(QList<HardwareKey *> list);
- void cancelHwKeyShortcuts(QList<HardwareKey *> list);
- QMap<HardwareKey *, QShortcut *> getHwKeyShortcutMap();
+ void registerHwKeyShortcuts(QList<HardwareKey *> &list);
+ void cancelHwKeyShortcuts(QList<HardwareKey *> &list);
+ QMap<HardwareKey *, QShortcut *> &getHwKeyShortcutMap();
public slots:
void slotHwKeyShortcut(int keycode);
#include <QWidget>
#include "layoutform.h"
-#include "hardwarekey.h"
class ControllerForm : public LayoutForm
{
ControllerForm(const QString &name);
~ControllerForm();
- QImage conImg[2];
- QList<HardwareKey *> keyList;
QRect centerRect;
-
- enum ConImgType {
- normal = 0,
- pressed = 1
- };
};
#endif // CONTROLLERFORM_H
return generalPurpose;
}
+QList<HardwareKey *> &LayoutForm::getKeyList()
+{
+ return keyList;
+}
+
void LayoutForm::setHoverType(HoverType *hover)
{
hoverType = hover;
LayoutForm::~LayoutForm()
{
+ for (int i = 0; i < keyList.count(); i++) {
+ delete keyList.at(i);
+ }
+ keyList.clear();
+
if (hoverType != NULL) {
delete hoverType;
}
#include <QWidget>
+#include "hardwarekey.h"
#include "hovertype.h"
class LayoutForm
{
+ Q_ENUMS(SkinImgType)
+
public:
LayoutForm(const QString &name);
~LayoutForm();
QString getName();
void setGeneralPurpose(bool general);
bool isGeneralPurpose();
+
+ QList<HardwareKey *> &getKeyList();
void setHoverType(HoverType *hover);
HoverType *getHoverType();
+ QImage skinImg[2];
+ enum SkinImgType {
+ normal = 0,
+ pressed = 1
+ };
+
private:
QString name;
bool generalPurpose;
+
+ QList<HardwareKey *> keyList;
HoverType *hoverType;
};
if (rotaryImg != NULL) {
delete rotaryImg;
}
-
- for (int i = 0; i < keyList.count(); i++) {
- delete keyList.at(i);
- }
- keyList.clear();
}
#include "layoutform.h"
#include "displaytype.h"
-#include "hardwarekey.h"
class MainForm : public LayoutForm
{
- Q_ENUMS(SkinImgType)
-
public:
MainForm(const QString &name);
~MainForm();
QPixmap *getRotaryImage();
DisplayType *displayType;
- QImage skinImg[2];
- QList<HardwareKey *> keyList;
-
- enum SkinImgType {
- normal = 0,
- pressed = 1
- };
private:
QPixmap *rotaryImg;
}
/* register controller's HW key shortcuts */
- keyboardShortcut->registerHwKeyShortcuts(conForm->keyList);
+ keyboardShortcut->registerHwKeyShortcuts(conForm->getKeyList());
/* update layout */
resize(uiInfo->getUiSize());
/* cancel controller's HW key shortcuts */
keyboardShortcut->cancelHwKeyShortcuts(
- getDockingCon()->getConForm()->keyList);
+ getDockingCon()->getConForm()->getKeyList());
getDockingCon()->close();
getUIState()->conState.dockingCon = NULL;
/* cancel controller's HW key shortcuts */
keyboardShortcut->cancelHwKeyShortcuts(
- getFloatingCon()->getConForm()->keyList);
+ getFloatingCon()->getConForm()->getKeyList());
getFloatingCon()->close();
getUIState()->conState.floatingCon = NULL;
qDebug("window switch: %d", index);
/* cancel HW key shortcuts */
- keyboardShortcut->cancelHwKeyShortcuts(uiInfo->getMainForm()->keyList);
+ keyboardShortcut->cancelHwKeyShortcuts(uiInfo->getMainForm()->getKeyList());
/* layout switching */
getUIState()->mainFormIndex = index;
/* register new HW key shortcuts */
- keyboardShortcut->registerHwKeyShortcuts(uiInfo->getMainForm()->keyList);
+ keyboardShortcut->registerHwKeyShortcuts(uiInfo->getMainForm()->getKeyList());
updateDisplayMatrix();
// TODO: consider getHwKeyShortcutMap()
/* insert HW key shortcut info */
- insertHwKeyShortcutInfo(win->uiInfo->getMainForm()->keyList);
+ insertHwKeyShortcutInfo(win->uiInfo->getMainForm()->getKeyList());
/* insert Controller's HW key shortcut info */
ControllerForm *conForm = win->uiInfo->getConForm();
if (conForm != NULL) {
- insertHwKeyShortcutInfo(win->uiInfo->getConForm()->keyList,
+ insertHwKeyShortcutInfo(win->uiInfo->getConForm()->getKeyList(),
QString(" (controller)"));
}
qDebug() << shortcutInfoTable->rowCount() << "shortcut items have been inserted";
}
-void DetailedInfoDialog::insertMenuShortcutInfo(QList<MenuItem *> list)
+void DetailedInfoDialog::insertMenuShortcutInfo(QList<MenuItem *> &list)
{
MenuItem *item = NULL;
}
void DetailedInfoDialog::insertHwKeyShortcutInfo(
- QList<HardwareKey *> list, QString source)
+ QList<HardwareKey *> &list, QString source)
{
HardwareKey *hwKey = NULL;
const QString& value);
void removeTableRows(QTableWidget *table, int startIndex, int lastIndex);
- void insertMenuShortcutInfo(QList<MenuItem *> list);
- void insertHwKeyShortcutInfo(QList<HardwareKey *> list, QString source = "");
+ void insertMenuShortcutInfo(QList<MenuItem *> &list);
+ void insertHwKeyShortcutInfo(QList<HardwareKey *> &list, QString source = "");
MainWindow *win;
QVBoxLayout *baseLayout;
void SkinView::createItems(MainForm *form)
{
/* bezel */
- SkinBezelItem *bezelItem = new SkinBezelItem(form->skinImg[MainForm::normal]);
+ SkinBezelItem *bezelItem = new SkinBezelItem(form->skinImg[LayoutForm::normal]);
scene()->addItem(bezelItem);
/* HW keys */
- QList<HardwareKey *> keyList = form->keyList;
+ QList<HardwareKey *> &keyList = form->getKeyList();
HardwareKey *hwKey = NULL;
for (int i = 0; i < keyList.count(); i++) {
hwKey = keyList.at(i);
if (hwKey != NULL) {
new SkinKeyItem(bezelItem, hwKey,
- form->skinImg[MainForm::pressed].copy(hwKey->getRegion()),
+ form->skinImg[LayoutForm::pressed].copy(hwKey->getRegion()),
form->getHoverType());
}
}
qFatal(MSG_INVALID_MAIN_FORM);
}
- return mainForm->skinImg[MainForm::normal].size() * uiState.getScaleFactor();
+ return mainForm->skinImg[LayoutForm::normal].size() * uiState.getScaleFactor();
}
QSize UIInformation::getConSize()
return QSize(0, 0);
}
- return conForm->conImg[ControllerForm::normal].size();
+ return conForm->skinImg[LayoutForm::normal].size();
}
QSize UIInformation::getUiSize()
return QRegion(0, 0, 0, 0);
}
- QImage *mainImage = &(mainForm->skinImg[MainForm::normal]);
+ QImage *mainImage = &(mainForm->skinImg[LayoutForm::normal]);
QImage regionImage = mainImage->scaled(
mainImage->width() * uiState.getScaleFactor(),
mainImage->height() * uiState.getScaleFactor()).createAlphaMask();
return QRegion(0, 0, 0, 0);
}
- QImage *conImage = &(conForm->conImg[ControllerForm::normal]);
+ QImage *conImage = &(conForm->skinImg[LayoutForm::normal]);
return QRegion(QBitmap::fromImage(conImage->createAlphaMask()));
}
if (attributes.hasAttribute(COLOR_RED_ATTR_KEYWORD)) {
red = attributes.value(COLOR_RED_ATTR_KEYWORD).toString().toInt();
- qDebug() << red;
}
if (attributes.hasAttribute(COLOR_GREEN_ATTR_KEYWORD)) {
green = attributes.value(COLOR_GREEN_ATTR_KEYWORD).toString().toInt();
- qDebug() << green;
}
if (attributes.hasAttribute(COLOR_BLUE_ATTR_KEYWORD)) {
blue = attributes.value(COLOR_BLUE_ATTR_KEYWORD).toString().toUInt();
- qDebug() << blue;
}
}
QString normalImageFileName = xml.readElementText();
qDebug() << "-" << NORMAL_IMG_KEYWORD << ":" << normalImageFileName;
- if (form->skinImg[MainForm::normal].load(
+ if (form->skinImg[LayoutForm::normal].load(
xmlPath + QDir::separator() + normalImageFileName) == false) {
qWarning() << "failed to load normal image";
}
QString pressedImageFileName = xml.readElementText();
qDebug() << "-" << PRESSED_IMG_KEYWORD << ":" << pressedImageFileName;
- if (form->skinImg[MainForm::pressed].load(
+ if (form->skinImg[LayoutForm::pressed].load(
xmlPath + QDir::separator() + pressedImageFileName) == false) {
qWarning() << "failed to load pressed image";
}
}
} else if (xml.name() == KEYLIST_KEYWORD) {
/* HW keys */
- int cnt = parseKeyList(xml, form->keyList);
+ int cnt = parseKeyList(xml, form->getKeyList());
qDebug() << "-" << KEYLIST_KEYWORD << ":" << cnt;
} else {
qWarning() << "undefined element :" << xml.name();
form = parseMainForm(xml);
if (form != NULL) {
/* image validation */
- if (form->skinImg[MainForm::normal].size() == QSize(0, 0)) {
+ if (form->skinImg[LayoutForm::normal].size() == QSize(0, 0)) {
qDebug("- general purpose skin form");
SkinPainter painter("main-skin",
QPoint(30, 16), uiInfo->getVMColor());
form->setGeneralPurpose(true);
- form->skinImg[MainForm::normal] = painter.getSkinImage();
+ form->skinImg[LayoutForm::normal] = painter.getSkinImage();
form->displayType->setRect(painter.getCenterRect());
}
QString normalImageFileName = xml.readElementText();
qDebug() << "-" << NORMAL_IMG_KEYWORD << ":" << normalImageFileName;
- if (form->conImg[ControllerForm::normal].load(
+ if (form->skinImg[LayoutForm::normal].load(
xmlPath + QDir::separator() + normalImageFileName) == false) {
qWarning() << "failed to load normal image";
}
QString pressedImageFileName = xml.readElementText();
qDebug() << "-" << PRESSED_IMG_KEYWORD << ":" << pressedImageFileName;
- if (form->conImg[ControllerForm::pressed].load(
+ if (form->skinImg[LayoutForm::pressed].load(
xmlPath + QDir::separator() + pressedImageFileName) == false) {
qWarning() << "failed to load pressed image";
}
} else if (xml.name() == KEYLIST_KEYWORD) {
/* HW keys */
- int cnt = parseKeyList(xml, form->keyList);
+ int cnt = parseKeyList(xml, form->getKeyList());
qDebug() << "-" << KEYLIST_KEYWORD << ":" << cnt;
} else if (xml.name() == HOVER_KEYWORD) {
/* hover */
form = parseControllerForm(xml);
if (form != NULL) {
/* image validation */
- if (form->conImg[ControllerForm::normal].size() == QSize(0, 0)) {
+ if (form->skinImg[LayoutForm::normal].size() == QSize(0, 0)) {
qDebug("- general purpose con form");
- int keyCount = form->keyList.count();
+ int keyCount = form->getKeyList().count();
int width = GPC_KEYBUTTON_WIDTH;
int height = GPC_HEAD_SPACING;
uiInfo->getVMColor());
form->setGeneralPurpose(true);
- form->conImg[ControllerForm::normal] = painter.getSkinImage();
+ form->skinImg[LayoutForm::normal] = painter.getSkinImage();
form->centerRect = painter.getCenterRect();
}