some cleaning (code and warning)

preferencesAboutTextFull
Claudio Valerio 13 years ago
parent 5e1e41a17c
commit 383fd02a70
  1. 5
      src/adaptors/publishing/UBDocumentPublisher.h
  2. 5
      src/board/UBDrawingController.cpp
  3. 2
      src/board/UBDrawingController.h
  4. 3
      src/core/UBApplicationController.cpp
  5. 3
      src/core/UBApplicationController.h
  6. 2
      src/core/UBSceneCache.h
  7. 5
      src/frameworks/UBPlatformUtils_linux.cpp
  8. 4
      src/gui/UBFloatingPalette.cpp
  9. 6
      src/gui/UBFloatingPalette.h
  10. 494
      src/gui/UBKeyboardPalette.cpp
  11. 2
      src/gui/UBKeyboardPalette_linux.cpp
  12. 12
      src/gui/UBLibNavigatorWidget.cpp

@ -42,6 +42,8 @@ private slots:
private: private:
UBDocumentProxy *mSourceDocument;
UBDocumentProxy *mPublishingDocument;
void init(); void init();
void sendUbw(); void sendUbw();
QString getBase64Of(QString stringToEncode); QString getBase64Of(QString stringToEncode);
@ -58,8 +60,5 @@ private:
void buildUbwFile(); void buildUbwFile();
QString mTmpZipFile; QString mTmpZipFile;
UBDocumentProxy *mSourceDocument;
UBDocumentProxy *mPublishingDocument;
}; };
#endif // UBDOCUMENTPUBLISHER_H #endif // UBDOCUMENTPUBLISHER_H

@ -27,9 +27,10 @@ UBDrawingController* UBDrawingController::drawingController()
UBDrawingController::UBDrawingController(QObject * parent) UBDrawingController::UBDrawingController(QObject * parent)
: QObject(parent) : QObject(parent)
, mActiveRuler(NULL)
, mStylusTool((UBStylusTool::Enum)-1) , mStylusTool((UBStylusTool::Enum)-1)
, mLatestDrawingTool((UBStylusTool::Enum)-1) , mLatestDrawingTool((UBStylusTool::Enum)-1)
, mActiveRuler(NULL)
{ {
connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged())); connect(UBSettings::settings(), SIGNAL(colorContextChanged()), this, SIGNAL(colorPaletteChanged()));
@ -171,7 +172,7 @@ void UBDrawingController::setLineWidthIndex(int index)
{ {
UBSettings::settings()->setPenWidthIndex(index); UBSettings::settings()->setPenWidthIndex(index);
if(stylusTool() != UBStylusTool::Line if(stylusTool() != UBStylusTool::Line
&& stylusTool() != UBStylusTool::Selector) && stylusTool() != UBStylusTool::Selector)
{ {
setStylusTool(UBStylusTool::Pen); setStylusTool(UBStylusTool::Pen);

@ -41,7 +41,7 @@ class UBDrawingController : public QObject
void setMarkerColor(bool onDarkBackground, const QColor& color, int pIndex); void setMarkerColor(bool onDarkBackground, const QColor& color, int pIndex);
void setMarkerAlpha(qreal alpha); void setMarkerAlpha(qreal alpha);
UBAbstractDrawRuler* mActiveRuler; UBAbstractDrawRuler* mActiveRuler;
public slots: public slots:

@ -50,12 +50,13 @@ UBApplicationController::UBApplicationController(UBBoardView *pControlView, UBBo
, mControlView(pControlView) , mControlView(pControlView)
, mDisplayView(pDisplayView) , mDisplayView(pDisplayView)
, mMirror(0) , mMirror(0)
, mFtp(0)
, mMainMode(Board) , mMainMode(Board)
, mDisplayManager(0) , mDisplayManager(0)
, mAutomaticCheckForUpdates(false) , mAutomaticCheckForUpdates(false)
, mCheckingForUpdates(false) , mCheckingForUpdates(false)
, mIsShowingDesktop(false) , mIsShowingDesktop(false)
, mFtp(0)
{ {
mDisplayManager = new UBDisplayManager(this); mDisplayManager = new UBDisplayManager(this);

@ -24,8 +24,7 @@ class UBApplicationController : public QObject
public: public:
UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBApplicationController(UBBoardView *pControlView, UBBoardView *pDisplayView, UBMainWindow *pMainWindow, QObject* parent = 0);
UBMainWindow *pMainWindow, QObject* parent = 0);
virtual ~UBApplicationController(); virtual ~UBApplicationController();
int initialHScroll() { return mInitialHScroll; } int initialHScroll() { return mInitialHScroll; }

@ -7,7 +7,7 @@
class UBDocumentProxy; class UBDocumentProxy;
class UBGraphicsScene; class UBGraphicsScene;
class UBGraphicsScene::SceneViewState; class UBGraphicsScene;
class UBSceneCacheID class UBSceneCacheID
{ {

@ -56,6 +56,8 @@ QString UBPlatformUtils::preferredLanguage()
void UBPlatformUtils::runInstaller(const QString &installerFilePath) void UBPlatformUtils::runInstaller(const QString &installerFilePath)
{ {
// TODO UB 4.x - auto update & installer are deactivated on Linux // TODO UB 4.x - auto update & installer are deactivated on Linux
Q_UNUSED(installerFilePath);
} }
void UBPlatformUtils::bringPreviousProcessToFront() void UBPlatformUtils::bringPreviousProcessToFront()
@ -77,6 +79,8 @@ QString UBPlatformUtils::computerName()
void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable) void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivable)
{ {
Q_UNUSED(widget);
Q_UNUSED(nonAcivable);
} }
@ -84,6 +88,7 @@ void UBPlatformUtils::setWindowNonActivableFlag(QWidget* widget, bool nonAcivabl
void UBPlatformUtils::setDesktopMode(bool desktop) void UBPlatformUtils::setDesktopMode(bool desktop)
{ {
// NOOP // NOOP
Q_UNUSED(desktop);
} }
const KEYBT ENGLISH_LOCALE[] = { const KEYBT ENGLISH_LOCALE[] = {

@ -12,8 +12,8 @@
UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent) UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
: QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint)) : QWidget(parent, parent ? Qt::Widget : Qt::Tool | (Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint))
, mIsMoving(false)
, mCustomPosition(false) , mCustomPosition(false)
, mIsMoving(false)
, mCanBeMinimized(false) , mCanBeMinimized(false)
, mMinimizedLocation(eMinimizedLocation_None) , mMinimizedLocation(eMinimizedLocation_None)
, mDefaultPosition(position) , mDefaultPosition(position)
@ -27,7 +27,7 @@ UBFloatingPalette::UBFloatingPalette(Qt::Corner position, QWidget *parent)
else else
{ {
// standalone window // standalone window
// !!!! Should be included into Windows after QT recompilation // !!!! Should be included into Windows after QT recompilation
#ifndef Q_WS_WIN #ifndef Q_WS_WIN
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
setAttribute(Qt::WA_MacAlwaysShowToolWindow); setAttribute(Qt::WA_MacAlwaysShowToolWindow);

@ -68,13 +68,13 @@ class UBFloatingPalette : public QWidget
QList<UBFloatingPalette*> mAssociatedPalette; QList<UBFloatingPalette*> mAssociatedPalette;
QPoint mDragPosition; QPoint mDragPosition;
bool mCanBeMinimized; bool mCanBeMinimized;
eMinimizedLocation mMinimizedLocation; eMinimizedLocation mMinimizedLocation;
Qt::Corner mDefaultPosition; Qt::Corner mDefaultPosition;
signals: signals:
void mouseEntered(); void mouseEntered();
void minimizeStart(eMinimizedLocation location); void minimizeStart(eMinimizedLocation location);
void maximizeStart(); void maximizeStart();
void maximized(); void maximized();
}; };

@ -17,303 +17,303 @@
/* /*
UBKeyboardPalette UBKeyboardPalette
*/ */
UBKeyboardPalette::UBKeyboardPalette(QWidget *parent) UBKeyboardPalette::UBKeyboardPalette(QWidget *parent)
: UBFloatingPalette(Qt::TopRightCorner, parent) : UBFloatingPalette(Qt::TopRightCorner, parent)
{ {
setCustomPosition(true); setCustomPosition(true);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum); setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
setFocusPolicy(Qt::NoFocus); setFocusPolicy(Qt::NoFocus);
capsLock = false; capsLock = false;
languagePopupActive = false; languagePopupActive = false;
keyboardActive = false; keyboardActive = false;
btnWidth = btnHeight = 16; btnWidth = btnHeight = 16;
buttons = new UBKeyButton*[47]; buttons = new UBKeyButton*[47];
for(int i=0; i<47; i++) for (int i=0; i<47; i++)
{ {
buttons[i] = new UBKeyButton(this); buttons[i] = new UBKeyButton(this);
} }
locales = UBPlatformUtils::getKeyboardLayouts(this->nLocalesCount); locales = UBPlatformUtils::getKeyboardLayouts(this->nLocalesCount);
createCtrlButtons(); createCtrlButtons();
nCurrentLocale = 0; nCurrentLocale = 0;
setInput(locales[nCurrentLocale]); setInput(locales[nCurrentLocale]);
setContentsMargins(radius() + 15, 4, radius() + 15, 4); setContentsMargins(radius() + 15, 4, radius() + 15, 4);
connect(this, SIGNAL(keyboardActivated(bool)), this, SLOT(onActivated(bool))); connect(this, SIGNAL(keyboardActivated(bool)), this, SLOT(onActivated(bool)));
} }
QList<UBKeyboardPalette*> UBKeyboardPalette::instances; QList<UBKeyboardPalette*> UBKeyboardPalette::instances;
UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent) UBKeyboardPalette* UBKeyboardPalette::create(QWidget *parent)
{ {
if (!UBPlatformUtils::hasVirtualKeyboard()) if (!UBPlatformUtils::hasVirtualKeyboard())
return NULL; return NULL;
UBKeyboardPalette* instance = new UBKeyboardPalette(parent); UBKeyboardPalette* instance = new UBKeyboardPalette(parent);
instances.append(instance); instances.append(instance);
instance->setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString()); instance->setKeyButtonSize(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize->get().toString());
instance->setAutoMinimize(UBSettings::settings()->boardKeyboardPaletteAutoMinimize->get().toBool()); instance->setAutoMinimize(UBSettings::settings()->boardKeyboardPaletteAutoMinimize->get().toBool());
instance->setVisible(false); instance->setVisible(false);
connect(UBSettings::settings()->boardKeyboardPaletteAutoMinimize , SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteAutoMinimizeChanged(QVariant))); connect(UBSettings::settings()->boardKeyboardPaletteAutoMinimize , SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteAutoMinimizeChanged(QVariant)));
connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteButtonSizeChanged(QVariant))); connect(UBSettings::settings()->boardKeyboardPaletteKeyBtnSize, SIGNAL(changed(QVariant)), instance, SLOT(keyboardPaletteButtonSizeChanged(QVariant)));
foreach(UBKeyboardPalette* inst, instances) foreach(UBKeyboardPalette* inst, instances)
{ {
connect(inst, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&))); connect(inst, SIGNAL(moved(const QPoint&)), instance, SLOT(syncPosition(const QPoint&)));
connect(instance, SIGNAL(moved(const QPoint&)), inst, SLOT(syncPosition(const QPoint&))); connect(instance, SIGNAL(moved(const QPoint&)), inst, SLOT(syncPosition(const QPoint&)));
connect(inst, SIGNAL(localeChanged(int)), instance, SLOT(syncLocale(int))); connect(inst, SIGNAL(localeChanged(int)), instance, SLOT(syncLocale(int)));
connect(instance, SIGNAL(localeChanged(int)), inst, SLOT(syncLocale(int))); connect(instance, SIGNAL(localeChanged(int)), inst, SLOT(syncLocale(int)));
} }
return instance; return instance;
} }
void UBKeyboardPalette::syncPosition(const QPoint & pos) void UBKeyboardPalette::syncPosition(const QPoint & pos)
{ {
move(pos); move(pos);
} }
void UBKeyboardPalette::syncLocale(int nLocale) void UBKeyboardPalette::syncLocale(int nLocale)
{ {
nCurrentLocale = nLocale; nCurrentLocale = nLocale;
setInput(locales[nCurrentLocale]); setInput(locales[nCurrentLocale]);
} }
void UBKeyboardPalette::keyboardPaletteAutoMinimizeChanged(QVariant b) void UBKeyboardPalette::keyboardPaletteAutoMinimizeChanged(QVariant b)
{ {
setAutoMinimize(b.toBool()); setAutoMinimize(b.toBool());
} }
void UBKeyboardPalette::keyboardPaletteButtonSizeChanged(QVariant size) void UBKeyboardPalette::keyboardPaletteButtonSizeChanged(QVariant size)
{ {
setKeyButtonSize(size.toString()); setKeyButtonSize(size.toString());
} }
void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale) void UBKeyboardPalette::setInput(const UBKeyboardLocale* locale)
{ {
if (locale!=NULL) if (locale!=NULL)
{ {
for(int i=0; i<47; i++) for (int i=0; i<47; i++)
buttons[i]->setKeyBt((*locale)[i]); buttons[i]->setKeyBt((*locale)[i]);
} }
else else
{ {
this->hide(); this->hide();
} }
} }
UBKeyboardPalette::~UBKeyboardPalette() UBKeyboardPalette::~UBKeyboardPalette()
{ {
for(int i=0; i<47; i++) for (int i=0; i<47; i++)
delete buttons[i]; delete buttons[i];
delete [] buttons; delete [] buttons;
for(int i=0; i<8; i++) for (int i=0; i<8; i++)
delete ctrlButtons[i]; delete ctrlButtons[i];
delete [] ctrlButtons; delete [] ctrlButtons;
if (locales!=NULL) if (locales!=NULL)
{ {
for(int i=0; i<nLocalesCount; i++) for (int i=0; i<nLocalesCount; i++)
delete locales[i]; delete locales[i];
delete [] locales; delete [] locales;
} }
} }
QSize UBKeyboardPalette::sizeHint () const QSize UBKeyboardPalette::sizeHint () const
{ {
if ((autoMinimize && keyboardActive) || !autoMinimize) if ((autoMinimize && keyboardActive) || !autoMinimize)
{ {
int w = contentsMargins().left() + contentsMargins().right() + 13 + 14.5 * btnWidth; int w = contentsMargins().left() + contentsMargins().right() + 13 + 14.5 * btnWidth;
int h = contentsMargins().top() + contentsMargins().bottom() + 5 * btnHeight + 4; int h = contentsMargins().top() + contentsMargins().bottom() + 5 * btnHeight + 4;
return QSize(w, h); return QSize(w, h);
} }
else else
{ {
int MIN_WITH = 4, int MIN_WITH = 4,
MIN_HEIGTH = 4; MIN_HEIGTH = 4;
int w = contentsMargins().left() + contentsMargins().right() + 13 + 14.5 * MIN_WITH; int w = contentsMargins().left() + contentsMargins().right() + 13 + 14.5 * MIN_WITH;
int h = contentsMargins().top() + contentsMargins().bottom() + 5 * MIN_HEIGTH + 4; int h = contentsMargins().top() + contentsMargins().bottom() + 5 * MIN_HEIGTH + 4;
return QSize(w, h); return QSize(w, h);
} }
} }
const QString* UBKeyboardPalette::getLocaleName() const QString* UBKeyboardPalette::getLocaleName()
{ {
if (locales==NULL) if (locales==NULL)
return NULL; return NULL;
return &(locales[nCurrentLocale]->name); return &(locales[nCurrentLocale]->name);
} }
void UBKeyboardPalette::setLocale(int nLocale) void UBKeyboardPalette::setLocale(int nLocale)
{ {
if (locales!=NULL) if (locales!=NULL)
{ {
nCurrentLocale = nLocale; nCurrentLocale = nLocale;
setInput(locales[nCurrentLocale]); setInput(locales[nCurrentLocale]);
onLocaleChanged(locales[nCurrentLocale]); onLocaleChanged(locales[nCurrentLocale]);
update(); update();
} }
emit localeChanged(nLocale); emit localeChanged(nLocale);
} }
void UBKeyboardPalette::setKeyButtonSize(const QString& strSize) void UBKeyboardPalette::setKeyButtonSize(const QString& strSize)
{ {
QStringList strs = strSize.split('x'); QStringList strs = strSize.split('x');
if (strs.size()==2)
{
btnWidth = strs[0].toInt();
btnHeight = strs[1].toInt();
adjustSizeAndPosition();
}
if (strs.size()==2)
{
btnWidth = strs[0].toInt();
btnHeight = strs[1].toInt();
adjustSizeAndPosition();
}
} }
void UBKeyboardPalette::setAutoMinimize(bool autoMinimize) void UBKeyboardPalette::setAutoMinimize(bool autoMinimize)
{ {
this->autoMinimize = autoMinimize; this->autoMinimize = autoMinimize;
adjustSizeAndPosition(); adjustSizeAndPosition();
} }
void UBKeyboardPalette::enterEvent ( QEvent * ) void UBKeyboardPalette::enterEvent ( QEvent * )
{ {
if (keyboardActive) if (keyboardActive)
return; return;
keyboardActive = true; keyboardActive = true;
adjustSizeAndPosition(); adjustSizeAndPosition();
emit keyboardActivated(true); emit keyboardActivated(true);
} }
void UBKeyboardPalette::leaveEvent ( QEvent * ) void UBKeyboardPalette::leaveEvent ( QEvent * )
{ {
if (languagePopupActive || !keyboardActive || mIsMoving) if (languagePopupActive || !keyboardActive || mIsMoving)
return; return;
keyboardActive = false; keyboardActive = false;
adjustSizeAndPosition(); adjustSizeAndPosition();
emit keyboardActivated(false); emit keyboardActivated(false);
} }
void UBKeyboardPalette::moveEvent ( QMoveEvent * event ) void UBKeyboardPalette::moveEvent ( QMoveEvent * event )
{ {
UBFloatingPalette::moveEvent(event); UBFloatingPalette::moveEvent(event);
emit moved(event->pos()); emit moved(event->pos());
} }
void UBKeyboardPalette::adjustSizeAndPosition(bool pUp) void UBKeyboardPalette::adjustSizeAndPosition(bool pUp)
{ {
QSize rSize = sizeHint(); QSize rSize = sizeHint();
if (rSize != size()) if (rSize != size())
{ {
int dx = (rSize.width() - size().width()) /2; int dx = (rSize.width() - size().width()) /2;
int dy = rSize.height() - size().height(); int dy = rSize.height() - size().height();
this->move(x()-dx, y() - dy); this->move(x()-dx, y() - dy);
this->resize(rSize.width(), rSize.height()); this->resize(rSize.width(), rSize.height());
} }
UBFloatingPalette::adjustSizeAndPosition(pUp); UBFloatingPalette::adjustSizeAndPosition(pUp);
} }
void UBKeyboardPalette::paintEvent( QPaintEvent* event) void UBKeyboardPalette::paintEvent( QPaintEvent* event)
{ {
UBFloatingPalette::paintEvent(event); UBFloatingPalette::paintEvent(event);
QRect r = this->geometry(); QRect r = this->geometry();
int lleft, ltop, lright, lbottom; int lleft, ltop, lright, lbottom;
getContentsMargins ( &lleft, &ltop, &lright, &lbottom ) ; getContentsMargins ( &lleft, &ltop, &lright, &lbottom ) ;
int btw = (r.width() - lleft - lright - 13) / 14.5; int btw = (r.width() - lleft - lright - 13) / 14.5;
int bth = (r.height() - ltop - lbottom -4) / 5; int bth = (r.height() - ltop - lbottom -4) / 5;
lleft = (r.width() - (btw * 14.5 + 13))/2; lleft = (r.width() - (btw * 14.5 + 13))/2;
ltop = (r.height() - (bth * 5 + 4)) / 2; ltop = (r.height() - (bth * 5 + 4)) / 2;
int off = lleft;; int off = lleft;;
for(int i = 0; i<13; i++) for (int i = 0; i<13; i++)
{ {
QRect cr(off, ltop, btw, bth); QRect cr(off, ltop, btw, bth);
buttons[i]->setGeometry(cr); buttons[i]->setGeometry(cr);
off += btw + 1; off += btw + 1;
} }
ctrlButtons[0]->setGeometry(off, ltop, btw * 1.5, bth); ctrlButtons[0]->setGeometry(off, ltop, btw * 1.5, bth);
off += btw * 1.5; off += btw * 1.5;
lright = off; lright = off;
ltop += bth + 1; ltop += bth + 1;
int lwidth = 12 * btw + 12 + btw * 1.3; int lwidth = 12 * btw + 12 + btw * 1.3;
off = (r.width() - lwidth) / 2; off = (r.width() - lwidth) / 2;
ctrlButtons[1]->setGeometry(off, ltop, btw * 1.3, bth); ctrlButtons[1]->setGeometry(off, ltop, btw * 1.3, bth);
off += btw * 1.3 + 1; off += btw * 1.3 + 1;
for(int i=0; i<12; i++) for (int i=0; i<12; i++)
{ {
QRect cr(off, ltop, btw, bth); QRect cr(off, ltop, btw, bth);
buttons[13 + i]->setGeometry(cr); buttons[13 + i]->setGeometry(cr);
off += btw + 1; off += btw + 1;
} }
ltop += bth + 1; ltop += bth + 1;
lwidth = 12 * btw + 12 + btw * 2; lwidth = 12 * btw + 12 + btw * 2;
off = (r.width() - lwidth) / 2; off = (r.width() - lwidth) / 2;
for(int i=0; i<12; i++) for (int i=0; i<12; i++)
{ {
QRect cr(off, ltop, btw, bth); QRect cr(off, ltop, btw, bth);
buttons[13 + 12 + i]->setGeometry(cr); buttons[13 + 12 + i]->setGeometry(cr);
off += btw + 1; off += btw + 1;
} }
ctrlButtons[2]->setGeometry(off, ltop, btw * 2, bth); ctrlButtons[2]->setGeometry(off, ltop, btw * 2, bth);
ltop += bth + 1; ltop += bth + 1;
lwidth = 12 * btw + 11; lwidth = 12 * btw + 11;
off = (r.width() - lwidth) / 2; off = (r.width() - lwidth) / 2;
ctrlButtons[3]->setGeometry(off, ltop, btw, bth); ctrlButtons[3]->setGeometry(off, ltop, btw, bth);
off+=btw+1; off+=btw+1;
for(int i=0; i<10; i++) for (int i=0; i<10; i++)
{ {
QRect cr(off, ltop, btw, bth); QRect cr(off, ltop, btw, bth);
buttons[13 + 12 + 12 + i]->setGeometry(cr); buttons[13 + 12 + 12 + i]->setGeometry(cr);
off += btw + 1; off += btw + 1;
} }
ctrlButtons[4]->setGeometry(r.x() + off, ltop, btw, bth); ctrlButtons[4]->setGeometry(r.x() + off, ltop, btw, bth);
ltop += bth + 1; ltop += bth + 1;
lwidth = 11 * btw + 2; lwidth = 11 * btw + 2;
off = (r.width() - lwidth) / 2; off = (r.width() - lwidth) / 2;
ctrlButtons[5]->setGeometry(off, ltop, btw, bth); ctrlButtons[5]->setGeometry(off, ltop, btw, bth);
ctrlButtons[6]->setGeometry(off + btw + 1, ltop, btw*9, bth); ctrlButtons[6]->setGeometry(off + btw + 1, ltop, btw*9, bth);
ctrlButtons[7]->setGeometry(off + btw*10 + 2, ltop, btw, bth); ctrlButtons[7]->setGeometry(off + btw*10 + 2, ltop, btw, bth);
} }
/* /*
UBKeyboardButton UBKeyboardButton
*/ */
UBKeyboardButton::UBKeyboardButton(UBKeyboardPalette* parent) UBKeyboardButton::UBKeyboardButton(UBKeyboardPalette* parent)
:QWidget(parent), :QWidget(parent),
bFocused(false), keyboard(parent),
bPressed(false), bFocused(false),
keyboard(parent) bPressed(false)
{ {
setCursor(Qt::PointingHandCursor); setCursor(Qt::PointingHandCursor);
} }
UBKeyboardButton::~UBKeyboardButton() UBKeyboardButton::~UBKeyboardButton()
@ -321,48 +321,48 @@ UBKeyboardButton::~UBKeyboardButton()
void UBKeyboardButton::paintEvent(QPaintEvent*) void UBKeyboardButton::paintEvent(QPaintEvent*)
{ {
QPainter painter(this); QPainter painter(this);
if (bPressed)
painter.setBrush(QBrush(QColor(0, 0xcc, 0)));
else if (bFocused)
painter.setBrush(QBrush(QColor(0xcc, 0, 0)));
if (bPressed)
painter.setBrush(QBrush(QColor(0, 0xcc, 0)));
else if (bFocused)
painter.setBrush(QBrush(QColor(0xcc, 0, 0)));
painter.drawRoundedRect(0, 0, width()-1, height()-1, 3, 3); painter.drawRoundedRect(0, 0, width()-1, height()-1, 3, 3);
this->paintContent(painter); this->paintContent(painter);
} }
void UBKeyboardButton::enterEvent ( QEvent*) void UBKeyboardButton::enterEvent ( QEvent*)
{ {
bFocused = true; bFocused = true;
update(); update();
} }
void UBKeyboardButton::leaveEvent ( QEvent*) void UBKeyboardButton::leaveEvent ( QEvent*)
{ {
bFocused = false; bFocused = false;
update(); update();
} }
void UBKeyboardButton::mousePressEvent ( QMouseEvent * event) void UBKeyboardButton::mousePressEvent ( QMouseEvent * event)
{ {
event->accept(); event->accept();
bPressed = true; bPressed = true;
update(); update();
this->onPress(); this->onPress();
} }
void UBKeyboardButton::mouseReleaseEvent ( QMouseEvent * ) void UBKeyboardButton::mouseReleaseEvent ( QMouseEvent * )
{ {
bPressed = false; bPressed = false;
update(); update();
this->onRelease(); this->onRelease();
} }
UBKeyButton::UBKeyButton(UBKeyboardPalette* parent) UBKeyButton::UBKeyButton(UBKeyboardPalette* parent)
:UBKeyboardButton(parent), :UBKeyboardButton(parent),
keybt(0) keybt(0)
{} {}
UBKeyButton::~UBKeyButton() UBKeyButton::~UBKeyButton()
@ -370,8 +370,8 @@ UBKeyButton::~UBKeyButton()
void UBKeyButton::onPress() void UBKeyButton::onPress()
{ {
if (keybt!=NULL) if (keybt!=NULL)
sendUnicodeSymbol(keybt->code1, keybt->code2, capsLock()); sendUnicodeSymbol(keybt->code1, keybt->code2, capsLock());
} }
void UBKeyButton::onRelease() void UBKeyButton::onRelease()
@ -380,19 +380,19 @@ void UBKeyButton::onRelease()
void UBKeyButton::paintContent(QPainter& painter) void UBKeyButton::paintContent(QPainter& painter)
{ {
if (keybt) if (keybt)
{ {
QString text(QChar(capsLock() ? keybt->symbol2 : keybt->symbol1)); QString text(QChar(capsLock() ? keybt->symbol2 : keybt->symbol1));
QRect textRect(rect().x()+2, rect().y()+2, rect().width()-4, rect().height()-4); QRect textRect(rect().x()+2, rect().y()+2, rect().width()-4, rect().height()-4);
painter.drawText(textRect, Qt::AlignCenter, text); painter.drawText(textRect, Qt::AlignCenter, text);
} }
} }
UBCntrlButton::UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code ) UBCntrlButton::UBCntrlButton(UBKeyboardPalette* parent, const QString& _label, int _code )
:UBKeyboardButton(parent), :UBKeyboardButton(parent),
label(_label), label(_label),
code(_code) code(_code)
{} {}
UBCntrlButton::~UBCntrlButton() UBCntrlButton::~UBCntrlButton()
@ -400,7 +400,7 @@ UBCntrlButton::~UBCntrlButton()
void UBCntrlButton::onPress() void UBCntrlButton::onPress()
{ {
sendControlSymbol(code); sendControlSymbol(code);
} }
void UBCntrlButton::onRelease() void UBCntrlButton::onRelease()
@ -408,11 +408,11 @@ void UBCntrlButton::onRelease()
void UBCntrlButton::paintContent(QPainter& painter) void UBCntrlButton::paintContent(QPainter& painter)
{ {
painter.drawText(rect(), Qt::AlignCenter, label); painter.drawText(rect(), Qt::AlignCenter, label);
} }
UBCapsLockButton::UBCapsLockButton(UBKeyboardPalette* parent) UBCapsLockButton::UBCapsLockButton(UBKeyboardPalette* parent)
:UBKeyboardButton(parent) :UBKeyboardButton(parent)
{} {}
UBCapsLockButton::~UBCapsLockButton() UBCapsLockButton::~UBCapsLockButton()
@ -420,8 +420,8 @@ UBCapsLockButton::~UBCapsLockButton()
void UBCapsLockButton::onPress() void UBCapsLockButton::onPress()
{ {
keyboard->capsLock = !keyboard->capsLock; keyboard->capsLock = !keyboard->capsLock;
keyboard->update(); keyboard->update();
} }
void UBCapsLockButton::onRelease() void UBCapsLockButton::onRelease()
@ -429,27 +429,27 @@ void UBCapsLockButton::onRelease()
void UBCapsLockButton::paintContent(QPainter& painter) void UBCapsLockButton::paintContent(QPainter& painter)
{ {
painter.drawText(rect(), Qt::AlignCenter, "^"); painter.drawText(rect(), Qt::AlignCenter, "^");
} }
UBLocaleButton::UBLocaleButton(UBKeyboardPalette* parent) UBLocaleButton::UBLocaleButton(UBKeyboardPalette* parent)
:UBKeyboardButton(parent) :UBKeyboardButton(parent)
{ {
localeMenu = new QMenu(this); localeMenu = new QMenu(this);
for(int i=0; i<parent->nLocalesCount; i++) for (int i=0; i<parent->nLocalesCount; i++)
{ {
QAction* action = (parent->locales[i]->icon!=NULL) ? QAction* action = (parent->locales[i]->icon!=NULL) ?
localeMenu->addAction(*parent->locales[i]->icon, parent->locales[i]->fullName) localeMenu->addAction(*parent->locales[i]->icon, parent->locales[i]->fullName)
: localeMenu->addAction(parent->locales[i]->fullName); : localeMenu->addAction(parent->locales[i]->fullName);
action->setData(QVariant(i)); action->setData(QVariant(i));
} }
} }
UBLocaleButton::~UBLocaleButton() UBLocaleButton::~UBLocaleButton()
{ {
delete localeMenu; delete localeMenu;
} }
void UBLocaleButton::onPress() void UBLocaleButton::onPress()
@ -458,19 +458,19 @@ void UBLocaleButton::onPress()
void UBLocaleButton::onRelease() void UBLocaleButton::onRelease()
{ {
keyboard->languagePopupActive = true; keyboard->languagePopupActive = true;
QAction* action = localeMenu->exec(mapToGlobal(QPoint(0,0))); QAction* action = localeMenu->exec(mapToGlobal(QPoint(0,0)));
keyboard->languagePopupActive = false; keyboard->languagePopupActive = false;
if (action!=NULL) if (action!=NULL)
{ {
int nLocale = action->data().toInt(); int nLocale = action->data().toInt();
keyboard->setLocale(nLocale); keyboard->setLocale(nLocale);
} }
} }
void UBLocaleButton::paintContent(QPainter& painter) void UBLocaleButton::paintContent(QPainter& painter)
{ {
const QString* localeName = keyboard->getLocaleName(); const QString* localeName = keyboard->getLocaleName();
if (localeName!=NULL) if (localeName!=NULL)
painter.drawText(rect(), Qt::AlignCenter, *localeName); painter.drawText(rect(), Qt::AlignCenter, *localeName);
} }

@ -41,7 +41,7 @@ void x11SendKey(Display *display, int keyCode, int modifiers)
// Get the root window for the current display. // Get the root window for the current display.
Window winRoot = XDefaultRootWindow(display); Window winRoot = XDefaultRootWindow(display);
if (winRoot==NULL) if (winRoot==0)
return; return;
// Find the window which has the current keyboard focus. // Find the window which has the current keyboard focus.

@ -69,16 +69,6 @@ UBLibNavigatorWidget::UBLibNavigatorWidget(QWidget *parent, const char *name):QW
*/ */
UBLibNavigatorWidget::~UBLibNavigatorWidget() UBLibNavigatorWidget::~UBLibNavigatorWidget()
{ {
//if(NULL != mLayout)
//{
// delete mLayout;
// mLayout = NULL;
//}
//if(NULL != mLibWidget)
//{
// delete mLibWidget;
// mLibWidget = NULL;
//}
if(NULL != mPathViewer) if(NULL != mPathViewer)
{ {
delete mPathViewer; delete mPathViewer;
@ -99,7 +89,7 @@ UBLibNavigatorWidget::~UBLibNavigatorWidget()
void UBLibNavigatorWidget::dropMe(const QMimeData *_data) void UBLibNavigatorWidget::dropMe(const QMimeData *_data)
{ {
// Forward the mime data to the library widget // Forward the mime data to the library widget
Q_UNUSED(_data);
} }
/** /**

Loading…
Cancel
Save