diff options
-rw-r--r-- | zlibrary/core/CMakeLists.txt | 1 | ||||
-rw-r--r-- | zlibrary/core/src/ui/application-desktop/ZLTQtApplicationWindow.cpp (renamed from zlibrary/ui/src/qt/application-desktop/ZLQtApplicationWindow.cpp) | 170 | ||||
-rw-r--r-- | zlibrary/core/src/ui/application-desktop/ZLTQtApplicationWindow.h (renamed from zlibrary/ui/src/qt/application-desktop/ZLQtApplicationWindow.h) | 54 | ||||
-rw-r--r-- | zlibrary/core/src/ui/application-desktop/ZLTQtPopupMenu.cpp (renamed from zlibrary/ui/src/qt/application-desktop/ZLQtPopupMenu.cpp) | 14 | ||||
-rw-r--r-- | zlibrary/core/src/ui/application-desktop/ZLTQtPopupMenu.h (renamed from zlibrary/ui/src/qt/application-desktop/ZLQtPopupMenu.h) | 14 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtDialog.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtDialog.cpp) | 44 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtDialog.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtDialog.h) | 24 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtDialogContent.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtDialogContent.cpp) | 34 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtDialogContent.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtDialogContent.h) | 28 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.cpp | 103 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.h) | 16 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtOpenFileDialog.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtOpenFileDialog.cpp) | 36 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtOpenFileDialog.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtOpenFileDialog.h) | 16 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtOptionView.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtOptionView.cpp) | 184 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtOptionView.h | 269 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtOptionsDialog.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtOptionsDialog.cpp) | 43 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtOptionsDialog.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtOptionsDialog.h) | 26 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtProgressDialog.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtProgressDialog.cpp) | 52 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtProgressDialog.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtProgressDialog.h) | 32 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtUtil.cpp (renamed from zlibrary/ui/src/qt/dialogs/ZLQtUtil.cpp) | 10 | ||||
-rw-r--r-- | zlibrary/core/src/ui/dialogs/ZLTQtUtil.h (renamed from zlibrary/ui/src/qt/dialogs/ZLQtUtil.h) | 12 | ||||
-rw-r--r-- | zlibrary/core/src/ui/filesystem/ZLTQtFSManager.cpp (renamed from zlibrary/ui/src/qt/filesystem/ZLQtFSManager.cpp) | 13 | ||||
-rw-r--r-- | zlibrary/core/src/ui/filesystem/ZLTQtFSManager.h (renamed from zlibrary/ui/src/qt/filesystem/ZLQtFSManager.h) | 14 | ||||
-rw-r--r-- | zlibrary/core/src/ui/image/ZLTQtImageManager.cpp | 59 | ||||
-rw-r--r-- | zlibrary/core/src/ui/image/ZLTQtImageManager.h (renamed from zlibrary/ui/src/qt/image/ZLQtImageManager.h) | 30 | ||||
-rw-r--r-- | zlibrary/core/src/ui/library/ZLibrary.cpp | 32 | ||||
-rw-r--r-- | zlibrary/core/src/ui/time/ZLTQtTime.cpp (renamed from zlibrary/ui/src/qt/time/ZLQtTime.cpp) | 8 | ||||
-rw-r--r-- | zlibrary/core/src/ui/time/ZLTQtTime.h (renamed from zlibrary/ui/src/qt/time/ZLQtTime.h) | 14 | ||||
-rw-r--r-- | zlibrary/core/src/ui/util/ZLTQtKeyUtil.cpp (renamed from zlibrary/ui/src/qt/util/ZLQtKeyUtil.cpp) | 6 | ||||
-rw-r--r-- | zlibrary/core/src/ui/util/ZLTQtKeyUtil.h (renamed from zlibrary/ui/src/qt/util/ZLQtKeyUtil.h) | 12 | ||||
-rw-r--r-- | zlibrary/core/src/ui/view/ZLTQtPaintContext.cpp (renamed from zlibrary/ui/src/qt/view/ZLQtPaintContext.cpp) | 105 | ||||
-rw-r--r-- | zlibrary/core/src/ui/view/ZLTQtPaintContext.h (renamed from zlibrary/ui/src/qt/view/ZLQtPaintContext.h) | 22 | ||||
-rw-r--r-- | zlibrary/core/src/ui/view/ZLTQtViewWidget.cpp (renamed from zlibrary/ui/src/qt/view/ZLQtViewWidget.cpp) | 140 | ||||
-rw-r--r-- | zlibrary/core/src/ui/view/ZLTQtViewWidget.h (renamed from zlibrary/ui/src/qt/view/ZLQtViewWidget.h) | 72 | ||||
-rw-r--r-- | zlibrary/core/src/unix/message/ZLUnixMessage.cpp | 92 | ||||
-rw-r--r-- | zlibrary/core/src/unix/message/ZLUnixMessage.h | 59 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/application-desktop/moc.mk | 1 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.cpp | 173 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.h | 67 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/application-pdaxrom/moc.mk | 1 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.cpp | 98 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/dialogs/ZLQtOptionView.h | 269 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/dialogs/moc.mk | 1 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/image/ZLQtImageManager.cpp | 55 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/library/ZLibrary.cpp | 78 | ||||
-rw-r--r-- | zlibrary/ui/src/qt/view/moc.mk | 1 |
46 files changed, 1241 insertions, 1363 deletions
diff --git a/zlibrary/core/CMakeLists.txt b/zlibrary/core/CMakeLists.txt index 4c5da9a..ffe191d 100644 --- a/zlibrary/core/CMakeLists.txt +++ b/zlibrary/core/CMakeLists.txt @@ -1,5 +1,6 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_BINARY_DIR} ) diff --git a/zlibrary/ui/src/qt/application-desktop/ZLQtApplicationWindow.cpp b/zlibrary/core/src/ui/application-desktop/ZLTQtApplicationWindow.cpp index 8dc8632..28edab6 100644 --- a/zlibrary/ui/src/qt/application-desktop/ZLQtApplicationWindow.cpp +++ b/zlibrary/core/src/ui/application-desktop/ZLTQtApplicationWindow.cpp @@ -17,47 +17,47 @@ * 02110-1301, USA. */ -#include <qapplication.h> -#include <qpixmap.h> -#include <qimage.h> -#include <qmenubar.h> -#include <qaction.h> -#include <qlayout.h> -#include <qobjectlist.h> -#include <qtooltip.h> +#include <tqapplication.h> +#include <tqpixmap.h> +#include <tqimage.h> +#include <tqmenubar.h> +#include <tqaction.h> +#include <tqlayout.h> +#include <tqobjectlist.h> +#include <tqtooltip.h> #include <ZLibrary.h> #include <ZLPopupData.h> -#include "ZLQtApplicationWindow.h" -#include "ZLQtPopupMenu.h" -#include "../dialogs/ZLQtDialogManager.h" -#include "../view/ZLQtViewWidget.h" -#include "../util/ZLQtKeyUtil.h" +#include "ZLTQtApplicationWindow.h" +#include "ZLTQtPopupMenu.h" +#include "../dialogs/ZLTQtDialogManager.h" +#include "../view/ZLTQtViewWidget.h" +#include "../util/ZLTQtKeyUtil.h" -void ZLQtDialogManager::createApplicationWindow(ZLApplication *application) const { - new ZLQtApplicationWindow(application); +void ZLTQtDialogManager::createApplicationWindow(ZLApplication *application) const { + new ZLTQtApplicationWindow(application); } static const std::string OPTIONS = "Options"; -class MyIconFactory : public QIconFactory { +class MyIconFactory : public TQIconFactory { public: - QPixmap *createPixmap(const QIconSet &set, QIconSet::Size size, QIconSet::Mode mode, QIconSet::State state); + TQPixmap *createPixmap(const TQIconSet &set, TQIconSet::Size size, TQIconSet::Mode mode, TQIconSet::State state); }; -inline QRgb grayRgb(QRgb rgb) { - int gray = (qRed(rgb) + qGreen(rgb) + qBlue(rgb)) / 3; - return qRgba(gray, gray, gray, qAlpha(rgb) / 2); +inline TQRgb grayRgb(TQRgb rgb) { + int gray = (tqRed(rgb) + tqGreen(rgb) + tqBlue(rgb)) / 3; + return tqRgba(gray, gray, gray, tqAlpha(rgb) / 2); } -QPixmap *MyIconFactory::createPixmap(const QIconSet &set, QIconSet::Size size, QIconSet::Mode mode, QIconSet::State state) { - if (mode != QIconSet::Disabled) { +TQPixmap *MyIconFactory::createPixmap(const TQIconSet &set, TQIconSet::Size size, TQIconSet::Mode mode, TQIconSet::State state) { + if (mode != TQIconSet::Disabled) { return 0; } - QImage image; - image = set.pixmap(size, QIconSet::Normal, state); + TQImage image; + image = set.pixmap(size, TQIconSet::Normal, state); const int numColors = image.numColors(); if (numColors > 0) { for (int i = 0; i < numColors; ++i) { @@ -73,16 +73,16 @@ QPixmap *MyIconFactory::createPixmap(const QIconSet &set, QIconSet::Size size, Q } } - return new QPixmap(image); + return new TQPixmap(image); } -ZLQtToolButton::ZLQtToolButton(ZLQtApplicationWindow &window, ZLToolbar::AbstractButtonItem &item) : QToolButton(window.myToolBar), myWindow(window), myItem(item) { +ZLTQtToolButton::ZLTQtToolButton(ZLTQtApplicationWindow &window, ZLToolbar::AbstractButtonItem &item) : TQToolButton(window.myToolBar), myWindow(window), myItem(item) { static std::string imagePrefix = ZLibrary::ApplicationImageDirectory() + ZLibrary::FileNameDelimiter; - QPixmap icon((imagePrefix + myItem.iconName() + ".png").c_str()); - setIconSet(QIconSet(icon)); - QSize size = icon.size(); - QIconSet::setIconSize(QIconSet::Large, size); - QIconSet::setIconSize(QIconSet::Small, size); + TQPixmap icon((imagePrefix + myItem.iconName() + ".png").c_str()); + setIconSet(TQIconSet(icon)); + TQSize size = icon.size(); + TQIconSet::setIconSize(TQIconSet::Large, size); + TQIconSet::setIconSize(TQIconSet::Small, size); if (item.type() == ZLToolbar::Item::TOGGLE_BUTTON) { setToggleButton(true); } else if (item.type() == ZLToolbar::Item::MENU_BUTTON) { @@ -90,38 +90,38 @@ ZLQtToolButton::ZLQtToolButton(ZLQtApplicationWindow &window, ZLToolbar::Abstrac shared_ptr<ZLPopupData> popupData = menuButtonItem.popupData(); myWindow.myPopupIdMap[&menuButtonItem] = popupData.isNull() ? (size_t)-1 : (popupData->id() - 1); - setPopup(new ZLQtPopupMenu(this)); + setPopup(new ZLTQtPopupMenu(this)); } - QString text = QString::fromUtf8(myItem.tooltip().c_str()); + TQString text = TQString::fromUtf8(myItem.tooltip().c_str()); setTextLabel(text); setUsesTextLabel(false); - QToolTip::add(this, text); - connect(this, SIGNAL(clicked()), this, SLOT(onActivated())); + TQToolTip::add(this, text); + connect(this, TQ_SIGNAL(clicked()), this, TQ_SLOT(onActivated())); } -void ZLQtToolButton::onActivated() { +void ZLTQtToolButton::onActivated() { myWindow.onButtonPress(myItem); } -void ZLQtApplicationWindow::setToggleButtonState(const ZLToolbar::ToggleButtonItem &button) { - ((QToolButton*)myItemToWidgetMap[&button])->setOn(button.isPressed()); +void ZLTQtApplicationWindow::setToggleButtonState(const ZLToolbar::ToggleButtonItem &button) { + ((TQToolButton*)myItemToWidgetMap[&button])->setOn(button.isPressed()); } -ZLQtApplicationWindow::ZLQtApplicationWindow(ZLApplication *application) : +ZLTQtApplicationWindow::ZLTQtApplicationWindow(ZLApplication *application) : ZLDesktopApplicationWindow(application), myFullScreen(false), myWasMaximized(false), myCursorIsHyperlink(false) { - QIconFactory::installDefaultFactory(new MyIconFactory()); + TQIconFactory::installDefaultFactory(new MyIconFactory()); const std::string iconFileName = ZLibrary::ImageDirectory() + ZLibrary::FileNameDelimiter + ZLibrary::ApplicationName() + ".png"; - QPixmap icon(iconFileName.c_str()); + TQPixmap icon(iconFileName.c_str()); setIcon(icon); setWFlags(getWFlags() | WStyle_Customize); - myToolBar = new QToolBar(this); + myToolBar = new TQToolBar(this); myToolBar->setFocusPolicy(NoFocus); myToolBar->boxLayout()->setMargin(5); myToolBar->boxLayout()->setSpacing(3); @@ -130,12 +130,12 @@ ZLQtApplicationWindow::ZLQtApplicationWindow(ZLApplication *application) : resize(myWidthOption.value(), myHeightOption.value()); move(myXOption.value(), myYOption.value()); - qApp->setMainWidget(this); + tqApp->setMainWidget(this); menuBar()->hide(); show(); } -void ZLQtApplicationWindow::init() { +void ZLTQtApplicationWindow::init() { ZLDesktopApplicationWindow::init(); switch (myWindowStateOption.value()) { case NORMAL: @@ -149,11 +149,11 @@ void ZLQtApplicationWindow::init() { } } -void ZLQtApplicationWindow::processAllEvents() { - qApp->processEvents(); +void ZLTQtApplicationWindow::processAllEvents() { + tqApp->processEvents(); } -ZLQtApplicationWindow::~ZLQtApplicationWindow() { +ZLTQtApplicationWindow::~ZLTQtApplicationWindow() { if (isFullscreen()) { myWindowStateOption.setValue(FULLSCREEN); } else if (isMaximized()) { @@ -171,7 +171,7 @@ ZLQtApplicationWindow::~ZLQtApplicationWindow() { } } -void ZLQtApplicationWindow::setFullscreen(bool fullscreen) { +void ZLTQtApplicationWindow::setFullscreen(bool fullscreen) { if (fullscreen == myFullScreen) { return; } @@ -202,15 +202,15 @@ void ZLQtApplicationWindow::setFullscreen(bool fullscreen) { } } -bool ZLQtApplicationWindow::isFullscreen() const { +bool ZLTQtApplicationWindow::isFullscreen() const { return myFullScreen; } -void ZLQtApplicationWindow::keyPressEvent(QKeyEvent *event) { - application().doActionByKey(ZLQtKeyUtil::keyName(event)); +void ZLTQtApplicationWindow::keyPressEvent(TQKeyEvent *event) { + application().doActionByKey(ZLTQtKeyUtil::keyName(event)); } -void ZLQtApplicationWindow::wheelEvent(QWheelEvent *event) { +void ZLTQtApplicationWindow::wheelEvent(TQWheelEvent *event) { if (event->orientation() == Vertical) { if (event->delta() > 0) { application().doActionByKey(ZLApplication::MouseScrollUpKey); @@ -220,7 +220,7 @@ void ZLQtApplicationWindow::wheelEvent(QWheelEvent *event) { } } -void ZLQtApplicationWindow::closeEvent(QCloseEvent *event) { +void ZLTQtApplicationWindow::closeEvent(TQCloseEvent *event) { if (application().closeView()) { event->accept(); } else { @@ -228,18 +228,18 @@ void ZLQtApplicationWindow::closeEvent(QCloseEvent *event) { } } -ZLQtApplicationWindow::LineEditParameter::LineEditParameter(QToolBar *toolbar, ZLQtApplicationWindow &window, const ZLToolbar::ParameterItem &textFieldItem) : QLineEdit(toolbar), myWindow(window), myActionId(textFieldItem.actionId()) { - setAlignment(Qt::AlignHCenter); +ZLTQtApplicationWindow::LineEditParameter::LineEditParameter(TQToolBar *toolbar, ZLTQtApplicationWindow &window, const ZLToolbar::ParameterItem &textFieldItem) : TQLineEdit(toolbar), myWindow(window), myActionId(textFieldItem.actionId()) { + setAlignment(TQt::AlignHCenter); setFocusPolicy(ClickFocus); setMaxLength(textFieldItem.maxWidth()); setMaximumWidth(textFieldItem.maxWidth() * 12 + 12); - QToolTip::add(this, QString::fromUtf8(textFieldItem.tooltip().c_str())); + TQToolTip::add(this, TQString::fromUtf8(textFieldItem.tooltip().c_str())); myWindow.addVisualParameter(textFieldItem.parameterId(), this); } -void ZLQtApplicationWindow::LineEditParameter::keyReleaseEvent(QKeyEvent *event) { +void ZLTQtApplicationWindow::LineEditParameter::keyReleaseEvent(TQKeyEvent *event) { event->accept(); - const std::string key = ZLQtKeyUtil::keyName(event); + const std::string key = ZLTQtKeyUtil::keyName(event); if (key == "<Return>") { myWindow.application().doAction(myActionId); myWindow.setFocusToMainWidget(); @@ -249,15 +249,15 @@ void ZLQtApplicationWindow::LineEditParameter::keyReleaseEvent(QKeyEvent *event) } } -std::string ZLQtApplicationWindow::LineEditParameter::internalValue() const { +std::string ZLTQtApplicationWindow::LineEditParameter::internalValue() const { return (const char*)text().utf8(); } -void ZLQtApplicationWindow::LineEditParameter::internalSetValue(const std::string &value) { - setText(QString::fromUtf8(value.c_str())); +void ZLTQtApplicationWindow::LineEditParameter::internalSetValue(const std::string &value) { + setText(TQString::fromUtf8(value.c_str())); } -void ZLQtApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) { +void ZLTQtApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) { switch (item->type()) { case ZLToolbar::Item::TEXT_FIELD: myItemToWidgetMap[&*item] = new LineEditParameter(myToolBar, *this, (ZLToolbar::ParameterItem&)*item); @@ -265,17 +265,17 @@ void ZLQtApplicationWindow::addToolbarItem(ZLToolbar::ItemPtr item) { case ZLToolbar::Item::PLAIN_BUTTON: case ZLToolbar::Item::MENU_BUTTON: case ZLToolbar::Item::TOGGLE_BUTTON: - myItemToWidgetMap[&*item] = new ZLQtToolButton(*this, (ZLToolbar::AbstractButtonItem&)*item); + myItemToWidgetMap[&*item] = new ZLTQtToolButton(*this, (ZLToolbar::AbstractButtonItem&)*item); break; case ZLToolbar::Item::SEPARATOR: myToolBar->addSeparator(); - myItemToWidgetMap[&*item] = (QWidget*)myToolBar->children()->getLast(); + myItemToWidgetMap[&*item] = (TQWidget*)myToolBar->children()->getLast(); break; } } -void ZLQtApplicationWindow::setToolbarItemState(ZLToolbar::ItemPtr item, bool visible, bool enabled) { - QWidget *widget = myItemToWidgetMap[&*item]; +void ZLTQtApplicationWindow::setToolbarItemState(ZLToolbar::ItemPtr item, bool visible, bool enabled) { + TQWidget *widget = myItemToWidgetMap[&*item]; if (widget == 0) { return; } @@ -291,65 +291,67 @@ void ZLQtApplicationWindow::setToolbarItemState(ZLToolbar::ItemPtr item, bool vi shared_ptr<ZLPopupData> data = menuButtonItem.popupData(); if (!data.isNull() && (data->id() != myPopupIdMap[&menuButtonItem])) { myPopupIdMap[&menuButtonItem] = data->id(); - ((ZLQtPopupMenu*)((QToolButton*)widget)->popup())->reset(data); + ((ZLTQtPopupMenu*)((TQToolButton*)widget)->popup())->reset(data); } break; } } } -ZLQtViewWidgetPositionInfo::ZLQtViewWidgetPositionInfo(const ZLQtApplicationWindow &window) : myWindow(window) { +ZLTQtViewWidgetPositionInfo::ZLTQtViewWidgetPositionInfo(const ZLTQtApplicationWindow &window) : myWindow(window) { } -int ZLQtViewWidgetPositionInfo::x() const { +int ZLTQtViewWidgetPositionInfo::x() const { return 0; } -int ZLQtViewWidgetPositionInfo::y() const { +int ZLTQtViewWidgetPositionInfo::y() const { return ((myWindow.myToolBar != 0) && myWindow.myToolBar->isVisible()) ? myWindow.myToolBar->height() : 0; } -int ZLQtViewWidgetPositionInfo::width() const { +int ZLTQtViewWidgetPositionInfo::width() const { return myWindow.width(); } -int ZLQtViewWidgetPositionInfo::height() const { +int ZLTQtViewWidgetPositionInfo::height() const { return myWindow.height() - y(); } -ZLViewWidget *ZLQtApplicationWindow::createViewWidget() { - ZLQtViewWidgetPositionInfo positionInfo(*this); - ZLQtViewWidget *viewWidget = new ZLQtViewWidget(this, &application(), positionInfo); +ZLViewWidget *ZLTQtApplicationWindow::createViewWidget() { + ZLTQtViewWidgetPositionInfo positionInfo(*this); + ZLTQtViewWidget *viewWidget = new ZLTQtViewWidget(this, &application(), positionInfo); setCentralWidget(viewWidget->widget()); viewWidget->widget()->show(); return viewWidget; } -void ZLQtApplicationWindow::close() { - QMainWindow::close(); +void ZLTQtApplicationWindow::close() { + TQMainWindow::close(); } -void ZLQtApplicationWindow::grabAllKeys(bool) { +void ZLTQtApplicationWindow::grabAllKeys(bool) { } -void ZLQtApplicationWindow::setCaption(const std::string &caption) { - QMainWindow::setCaption(QString::fromUtf8(caption.c_str())); +void ZLTQtApplicationWindow::setCaption(const std::string &caption) { + TQMainWindow::setCaption(TQString::fromUtf8(caption.c_str())); } -void ZLQtApplicationWindow::setHyperlinkCursor(bool hyperlink) { +void ZLTQtApplicationWindow::setHyperlinkCursor(bool hyperlink) { if (hyperlink == myCursorIsHyperlink) { return; } myCursorIsHyperlink = hyperlink; if (hyperlink) { myStoredCursor = cursor(); - setCursor(Qt::pointingHandCursor); - } else if (&myStoredCursor != &Qt::waitCursor) { + setCursor(TQt::pointingHandCursor); + } else if (&myStoredCursor != &TQt::waitCursor) { setCursor(myStoredCursor); } } -void ZLQtApplicationWindow::setFocusToMainWidget() { +void ZLTQtApplicationWindow::setFocusToMainWidget() { centralWidget()->setFocus(); } + +#include "ZLTQtApplicationWindow.moc" diff --git a/zlibrary/ui/src/qt/application-desktop/ZLQtApplicationWindow.h b/zlibrary/core/src/ui/application-desktop/ZLTQtApplicationWindow.h index 8f4b72f..4c9cae3 100644 --- a/zlibrary/ui/src/qt/application-desktop/ZLQtApplicationWindow.h +++ b/zlibrary/core/src/ui/application-desktop/ZLTQtApplicationWindow.h @@ -17,24 +17,24 @@ * 02110-1301, USA. */ -#ifndef __ZLQTAPPLICATIONWINDOW_H__ -#define __ZLQTAPPLICATIONWINDOW_H__ +#ifndef __ZLTQTAPPLICATIONWINDOW_H__ +#define __ZLTQTAPPLICATIONWINDOW_H__ #include <map> -#include <qmainwindow.h> -#include <qtoolbutton.h> -#include <qcursor.h> -#include <qlineedit.h> +#include <tqmainwindow.h> +#include <tqtoolbutton.h> +#include <tqcursor.h> +#include <tqlineedit.h> #include "../../../../core/src/desktop/application/ZLDesktopApplicationWindow.h" -class ZLQtApplicationWindow : public QMainWindow, public ZLDesktopApplicationWindow { - Q_OBJECT +class ZLTQtApplicationWindow : public TQMainWindow, public ZLDesktopApplicationWindow { + TQ_OBJECT public: - ZLQtApplicationWindow(ZLApplication *application); - ~ZLQtApplicationWindow(); + ZLTQtApplicationWindow(ZLApplication *application); + ~ZLTQtApplicationWindow(); void setFocusToMainWidget(); @@ -54,59 +54,59 @@ private: bool isFullscreen() const; void setFullscreen(bool fullscreen); - void closeEvent(QCloseEvent *event); - void keyPressEvent(QKeyEvent *event); - void wheelEvent(QWheelEvent *event); + void closeEvent(TQCloseEvent *event); + void keyPressEvent(TQKeyEvent *event); + void wheelEvent(TQWheelEvent *event); void setToggleButtonState(const ZLToolbar::ToggleButtonItem &button); void setToolbarItemState(ZLToolbar::ItemPtr item, bool visible, bool enabled); private: - class QToolBar *myToolBar; + class TQToolBar *myToolBar; -friend class ZLQtToolButton; - std::map<const ZLToolbar::Item*,QWidget*> myItemToWidgetMap; +friend class ZLTQtToolButton; + std::map<const ZLToolbar::Item*,TQWidget*> myItemToWidgetMap; std::map<const ZLToolbar::MenuButtonItem*,size_t> myPopupIdMap; bool myFullScreen; bool myWasMaximized; bool myCursorIsHyperlink; - QCursor myStoredCursor; + TQCursor myStoredCursor; -friend class ZLQtViewWidgetPositionInfo; +friend class ZLTQtViewWidgetPositionInfo; private: - class LineEditParameter : public QLineEdit, public VisualParameter { + class LineEditParameter : public TQLineEdit, public VisualParameter { public: - LineEditParameter(QToolBar *toolbar, ZLQtApplicationWindow &window, const ZLToolbar::ParameterItem &textFieldItem); + LineEditParameter(TQToolBar *toolbar, ZLTQtApplicationWindow &window, const ZLToolbar::ParameterItem &textFieldItem); private: - void keyReleaseEvent(QKeyEvent *event); + void keyReleaseEvent(TQKeyEvent *event); std::string internalValue() const; void internalSetValue(const std::string &value); void setValueList(const std::vector<std::string> &values) {} private: - ZLQtApplicationWindow &myWindow; + ZLTQtApplicationWindow &myWindow; const std::string &myActionId; }; }; -class ZLQtToolButton : public QToolButton { - Q_OBJECT +class ZLTQtToolButton : public TQToolButton { + TQ_OBJECT public: - ZLQtToolButton(ZLQtApplicationWindow &window, ZLToolbar::AbstractButtonItem &item); + ZLTQtToolButton(ZLTQtApplicationWindow &window, ZLToolbar::AbstractButtonItem &item); private slots: void onActivated(); private: - ZLQtApplicationWindow &myWindow; + ZLTQtApplicationWindow &myWindow; ZLToolbar::AbstractButtonItem &myItem; }; -#endif /* __ZLQTAPPLICATIONWINDOW_H__ */ +#endif /* __ZLTQTAPPLICATIONWINDOW_H__ */ diff --git a/zlibrary/ui/src/qt/application-desktop/ZLQtPopupMenu.cpp b/zlibrary/core/src/ui/application-desktop/ZLTQtPopupMenu.cpp index 378ed9e..e723204 100644 --- a/zlibrary/ui/src/qt/application-desktop/ZLQtPopupMenu.cpp +++ b/zlibrary/core/src/ui/application-desktop/ZLTQtPopupMenu.cpp @@ -17,26 +17,28 @@ * 02110-1301, USA. */ -#include "ZLQtPopupMenu.h" +#include "ZLTQtPopupMenu.h" -ZLQtPopupMenu::ZLQtPopupMenu(QWidget *parent) : QPopupMenu(parent) { - connect(this, SIGNAL(activated(int)), this, SLOT(onActivated(int))); +ZLTQtPopupMenu::ZLTQtPopupMenu(TQWidget *parent) : TQPopupMenu(parent) { + connect(this, TQ_SIGNAL(activated(int)), this, TQ_SLOT(onActivated(int))); } -void ZLQtPopupMenu::onActivated(int itemId) { +void ZLTQtPopupMenu::onActivated(int itemId) { if (!myPopupData.isNull()) { myPopupData->run(myItemIdToIndex[itemId]); } } -void ZLQtPopupMenu::reset(shared_ptr<ZLPopupData> popupData) { +void ZLTQtPopupMenu::reset(shared_ptr<ZLPopupData> popupData) { clear(); myItemIdToIndex.clear(); myPopupData = popupData; if (!popupData.isNull()) { const size_t count = popupData->count(); for (size_t i = 0; i < count; ++i) { - myItemIdToIndex[insertItem(QString::fromUtf8(popupData->text(i).c_str()))] = i; + myItemIdToIndex[insertItem(TQString::fromUtf8(popupData->text(i).c_str()))] = i; } } } + +#include "ZLTQtPopupMenu.moc" diff --git a/zlibrary/ui/src/qt/application-desktop/ZLQtPopupMenu.h b/zlibrary/core/src/ui/application-desktop/ZLTQtPopupMenu.h index b1fd5ca..974ed0f 100644 --- a/zlibrary/ui/src/qt/application-desktop/ZLQtPopupMenu.h +++ b/zlibrary/core/src/ui/application-desktop/ZLTQtPopupMenu.h @@ -17,21 +17,21 @@ * 02110-1301, USA. */ -#ifndef __ZLQTPOPUPMENU_H__ -#define __ZLQTPOPUPMENU_H__ +#ifndef __ZLTQTPOPUPMENU_H__ +#define __ZLTQTPOPUPMENU_H__ #include <map> -#include <qpopupmenu.h> +#include <tqpopupmenu.h> #include <shared_ptr.h> #include <ZLPopupData.h> -class ZLQtPopupMenu : public QPopupMenu { - Q_OBJECT +class ZLTQtPopupMenu : public TQPopupMenu { + TQ_OBJECT public: - ZLQtPopupMenu(QWidget *parent); + ZLTQtPopupMenu(TQWidget *parent); void reset(shared_ptr<ZLPopupData> popupData); private slots: @@ -42,4 +42,4 @@ private: std::map<int,int> myItemIdToIndex; }; -#endif /* __ZLQTPOPUPMENU_H__ */ +#endif /* __ZLTQTPOPUPMENU_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtDialog.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtDialog.cpp index 4d2f0a2..03ef0b5 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtDialog.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtDialog.cpp @@ -17,51 +17,51 @@ * 02110-1301, USA. */ -#include <qvbox.h> -#include <qpushbutton.h> +#include <tqvbox.h> +#include <tqpushbutton.h> #include <ZLDialogManager.h> -#include "ZLQtDialog.h" -#include "ZLQtDialogContent.h" -#include "ZLQtUtil.h" +#include "ZLTQtDialog.h" +#include "ZLTQtDialogContent.h" +#include "ZLTQtUtil.h" -ZLQtDialog::ZLQtDialog(const ZLResource &resource) : QDialog(0, 0, true) { +ZLTQtDialog::ZLTQtDialog(const ZLResource &resource) : TQDialog(0, 0, true) { setCaption(::qtString(resource[ZLDialogManager::DIALOG_TITLE].value())); - QVBoxLayout *layout = new QVBoxLayout(this); - QWidget *widget = new QVBox(this); + TQVBoxLayout *layout = new TQVBoxLayout(this); + TQWidget *widget = new TQVBox(this); layout->add(widget); - myTab = new ZLQtDialogContent(widget, resource); + myTab = new ZLTQtDialogContent(widget, resource); - myButtonGroup = new QButtonGroup(this); + myButtonGroup = new TQButtonGroup(this); layout->add(myButtonGroup); - myButtonLayout = new QGridLayout(myButtonGroup, 1, 0, 8, 6); + myButtonLayout = new TQGridLayout(myButtonGroup, 1, 0, 8, 6); } -ZLQtDialog::~ZLQtDialog() { +ZLTQtDialog::~ZLTQtDialog() { } -void ZLQtDialog::addButton(const ZLResourceKey &key, bool accept) { - QPushButton *button = new QPushButton(myButtonGroup); +void ZLTQtDialog::addButton(const ZLResourceKey &key, bool accept) { + TQPushButton *button = new TQPushButton(myButtonGroup); button->setText(::qtButtonName(key)); myButtons.push_back(button); myButtonLayout->addWidget(button, 0, myButtons.size()); - connect(button, SIGNAL(clicked()), this, accept ? SLOT(accept()) : SLOT(reject())); + connect(button, TQ_SIGNAL(clicked()), this, accept ? TQ_SLOT(accept()) : TQ_SLOT(reject())); } -bool ZLQtDialog::run() { - QSize maxSize(0, 0); - for (std::vector<QButton*>::const_iterator it = myButtons.begin(); it != myButtons.end(); ++it) { - QSize buttonSize = (*it)->sizeHint(); - maxSize = QSize( +bool ZLTQtDialog::run() { + TQSize maxSize(0, 0); + for (std::vector<TQButton*>::const_iterator it = myButtons.begin(); it != myButtons.end(); ++it) { + TQSize buttonSize = (*it)->sizeHint(); + maxSize = TQSize( std::max(maxSize.width(), buttonSize.width()), std::max(maxSize.height(), buttonSize.height()) ); } - for (std::vector<QButton*>::iterator it = myButtons.begin(); it != myButtons.end(); ++it) { + for (std::vector<TQButton*>::iterator it = myButtons.begin(); it != myButtons.end(); ++it) { (*it)->setFixedSize(maxSize); } - ((ZLQtDialogContent*)myTab)->close(); + ((ZLTQtDialogContent*)myTab)->close(); return exec(); } diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtDialog.h b/zlibrary/core/src/ui/dialogs/ZLTQtDialog.h index d729815..c0bddf9 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtDialog.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtDialog.h @@ -17,28 +17,28 @@ * 02110-1301, USA. */ -#ifndef __ZLQTDIALOG_H__ -#define __ZLQTDIALOG_H__ +#ifndef __ZLTQTDIALOG_H__ +#define __ZLTQTDIALOG_H__ -#include <qdialog.h> -#include <qlayout.h> -#include <qbuttongroup.h> +#include <tqdialog.h> +#include <tqlayout.h> +#include <tqbuttongroup.h> #include <ZLDialog.h> -class ZLQtDialog : public QDialog, public ZLDialog { +class ZLTQtDialog : public TQDialog, public ZLDialog { public: - ZLQtDialog(const ZLResource &resource); - ~ZLQtDialog(); + ZLTQtDialog(const ZLResource &resource); + ~ZLTQtDialog(); void addButton(const ZLResourceKey &key, bool accept); bool run(); private: - std::vector<QButton*> myButtons; - QGridLayout *myButtonLayout; - QButtonGroup *myButtonGroup; + std::vector<TQButton*> myButtons; + TQGridLayout *myButtonLayout; + TQButtonGroup *myButtonGroup; }; -#endif /* __ZLQTDIALOG_H__ */ +#endif /* __ZLTQTDIALOG_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtDialogContent.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtDialogContent.cpp index 82be18b..be5d43f 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtDialogContent.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtDialogContent.cpp @@ -17,47 +17,47 @@ * 02110-1301, USA. */ -#include <qapplication.h> -#include <qlayout.h> +#include <tqapplication.h> +#include <tqlayout.h> -#include "ZLQtDialogContent.h" -#include "ZLQtOptionView.h" +#include "ZLTQtDialogContent.h" +#include "ZLTQtOptionView.h" -void ZLQtDialogContent::close() { +void ZLTQtDialogContent::close() { myLayout->setRowStretch(myRowCounter, 10); } -ZLQtDialogContent::ZLQtDialogContent(QWidget *parent, const ZLResource &resource) : ZLDialogContent(resource), myParentWidget(parent) { - myWidget = new QWidget(myParentWidget); - const long displaySize = qApp->desktop()->height() * (long)qApp->desktop()->width(); +ZLTQtDialogContent::ZLTQtDialogContent(TQWidget *parent, const ZLResource &resource) : ZLDialogContent(resource), myParentWidget(parent) { + myWidget = new TQWidget(myParentWidget); + const long displaySize = tqApp->desktop()->height() * (long)tqApp->desktop()->width(); const int space = (displaySize < 640 * 480) ? 3 : 10; - myLayout = new QGridLayout(myWidget, -1, 13, space, space); + myLayout = new TQGridLayout(myWidget, -1, 13, space, space); myRowCounter = 0; } -ZLQtDialogContent::~ZLQtDialogContent() { +ZLTQtDialogContent::~ZLTQtDialogContent() { } -void ZLQtDialogContent::addOption(const std::string &name, const std::string &tooltip, ZLOptionEntry *option) { +void ZLTQtDialogContent::addOption(const std::string &name, const std::string &tooltip, ZLOptionEntry *option) { createViewByEntry(name, tooltip, option, 0, 12); ++myRowCounter; } -void ZLQtDialogContent::addOptions(const std::string &name0, const std::string &tooltip0, ZLOptionEntry *option0, const std::string &name1, const std::string &tooltip1, ZLOptionEntry *option1) { +void ZLTQtDialogContent::addOptions(const std::string &name0, const std::string &tooltip0, ZLOptionEntry *option0, const std::string &name1, const std::string &tooltip1, ZLOptionEntry *option1) { createViewByEntry(name0, tooltip0, option0, 0, 5); createViewByEntry(name1, tooltip1, option1, 7, 12); ++myRowCounter; } -void ZLQtDialogContent::addItem(QWidget *widget, int row, int fromColumn, int toColumn) { +void ZLTQtDialogContent::addItem(TQWidget *widget, int row, int fromColumn, int toColumn) { myLayout->addMultiCellWidget(widget, row, row, fromColumn, toColumn); } -void ZLQtDialogContent::createViewByEntry(const std::string &name, const std::string &tooltip, ZLOptionEntry *option, int fromColumn, int toColumn) { +void ZLTQtDialogContent::createViewByEntry(const std::string &name, const std::string &tooltip, ZLOptionEntry *option, int fromColumn, int toColumn) { if (option == 0) { return; } - ZLQtOptionView *view = 0; + ZLTQtOptionView *view = 0; switch (option->kind()) { case ZLOptionEntry::BOOLEAN: view = new BooleanOptionView(name, tooltip, (ZLBooleanOptionEntry*)option, this, myRowCounter, fromColumn, toColumn); @@ -100,10 +100,10 @@ void ZLQtDialogContent::createViewByEntry(const std::string &name, const std::st } } -QWidget *ZLQtDialogContent::widget() { +TQWidget *ZLTQtDialogContent::widget() { return myWidget; } -QWidget *ZLQtDialogContent::parentWidget() { +TQWidget *ZLTQtDialogContent::parentWidget() { return myParentWidget; } diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtDialogContent.h b/zlibrary/core/src/ui/dialogs/ZLTQtDialogContent.h index c665a73..265c99a 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtDialogContent.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtDialogContent.h @@ -17,39 +17,39 @@ * 02110-1301, USA. */ -#ifndef __ZLQTDIALOGCONTENT_H__ -#define __ZLQTDIALOGCONTENT_H__ +#ifndef __ZLTQTDIALOGCONTENT_H__ +#define __ZLTQTDIALOGCONTENT_H__ #include "../../../../core/src/desktop/dialogs/ZLDesktopOptionsDialog.h" -class QWidget; -class QGridLayout; +class TQWidget; +class TQGridLayout; -class ZLQtDialogContent : public ZLDialogContent { +class ZLTQtDialogContent : public ZLDialogContent { public: - ZLQtDialogContent(QWidget *parent, const ZLResource &resource); - ~ZLQtDialogContent(); + ZLTQtDialogContent(TQWidget *parent, const ZLResource &resource); + ~ZLTQtDialogContent(); void addOption(const std::string &name, const std::string &tooltip, ZLOptionEntry *option); void addOptions(const std::string &name0, const std::string &tooltip0, ZLOptionEntry *option0, const std::string &name1, const std::string &tooltip1, ZLOptionEntry *option1); - void addItem(QWidget *widget, int row, int fromColumn, int toColumn); + void addItem(TQWidget *widget, int row, int fromColumn, int toColumn); void close(); - QWidget *widget(); - QWidget *parentWidget(); + TQWidget *widget(); + TQWidget *parentWidget(); private: void createViewByEntry(const std::string &name, const std::string &tooltip, ZLOptionEntry *option, int fromColumn, int toColumn); private: - QWidget *myWidget; - QGridLayout *myLayout; + TQWidget *myWidget; + TQGridLayout *myLayout; int myRowCounter; - QWidget *myParentWidget; + TQWidget *myParentWidget; }; -#endif /* __ZLQTDIALOGCONTENT_H__ */ +#endif /* __ZLTQTDIALOGCONTENT_H__ */ diff --git a/zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.cpp new file mode 100644 index 0000000..9a2f7ef --- /dev/null +++ b/zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2004-2012 Geometer Plus <[email protected]> + * + * 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 <tqapplication.h> +#include <tqmessagebox.h> +#include <tqfiledialog.h> +#include <tqclipboard.h> + +#include "ZLTQtDialogManager.h" +#include "ZLTQtDialog.h" +#include "ZLTQtOptionsDialog.h" +#include "ZLTQtOpenFileDialog.h" +#include "ZLTQtDialogContent.h" +#include "ZLTQtProgressDialog.h" +#include "ZLTQtUtil.h" + +#include "../image/ZLTQtImageManager.h" + +shared_ptr<ZLDialog> ZLTQtDialogManager::createDialog(const ZLResourceKey &key) const { + return new ZLTQtDialog(resource()[key]); +} + +shared_ptr<ZLOptionsDialog> ZLTQtDialogManager::createOptionsDialog(const ZLResourceKey &key, shared_ptr<ZLRunnable> applyAction, bool showApplyButton) const { + return new ZLTQtOptionsDialog(resource()[key], applyAction, showApplyButton); +} + +shared_ptr<ZLOpenFileDialog> ZLTQtDialogManager::createOpenFileDialog(const ZLResourceKey &key, const std::string &directoryPath, const std::string &filePath, const ZLOpenFileDialog::Filter &filter) const { + return new ZLTQtOpenFileDialog(dialogTitle(key), directoryPath, filePath, filter); +} + +shared_ptr<ZLTreeDialog> ZLTQtDialogManager::createTreeDialog(const ZLResource &resource) const { + //return new ZLTQtTreeDialog(resource, myApplicationWindow); + return nullptr; +} + +void ZLTQtDialogManager::informationBox(const std::string &title, const std::string &message) const { + TQMessageBox::information( + tqApp->mainWidget(), + ::qtString(title), + ::qtString(message), + ::qtButtonName(OK_BUTTON) + ); +} + +void ZLTQtDialogManager::errorBox(const ZLResourceKey &key, const std::string &message) const { + TQMessageBox::critical( + tqApp->mainWidget(), + ::qtString(dialogTitle(key)), + ::qtString(message), + ::qtButtonName(OK_BUTTON) + ); +} + +int ZLTQtDialogManager::questionBox(const ZLResourceKey &key, const std::string &message, const ZLResourceKey &button0, const ZLResourceKey &button1, const ZLResourceKey &button2) const { + return TQMessageBox::question( + tqApp->mainWidget(), + ::qtString(dialogTitle(key)), + ::qtString(message), + ::qtButtonName(button0), + ::qtButtonName(button1), + ::qtButtonName(button2) + ); +} + +shared_ptr<ZLProgressDialog> ZLTQtDialogManager::createProgressDialog(const ZLResourceKey &key, bool _) const { + return new ZLTQtProgressDialog(key); +} + +bool ZLTQtDialogManager::isClipboardSupported(ClipboardType type) const { + return true; +} + +void ZLTQtDialogManager::setClipboardText(const std::string &text, ClipboardType type) const { + if (!text.empty()) { + tqApp->clipboard()->setText( + ::qtString(text), + (type == CLIPBOARD_MAIN) ? TQClipboard::Clipboard : TQClipboard::Selection + ); + } +} + +void ZLTQtDialogManager::setClipboardImage(const ZLImageData &imageData, ClipboardType type) const { + tqApp->clipboard()->setImage( + (ZLTQtImageData&)imageData, + (type == CLIPBOARD_MAIN) ? TQClipboard::Clipboard : TQClipboard::Selection + ); +} diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.h b/zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.h index d13f302..8e69c93 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtDialogManager.h @@ -17,18 +17,18 @@ * 02110-1301, USA. */ -#ifndef __ZLQTDIALOGMANAGER_H__ -#define __ZLQTDIALOGMANAGER_H__ +#ifndef __ZLTQTDIALOGMANAGER_H__ +#define __ZLTQTDIALOGMANAGER_H__ #include <ZLDialogManager.h> -class ZLQtDialogManager : public ZLDialogManager { +class ZLTQtDialogManager : public ZLDialogManager { public: - static void createInstance() { ourInstance = new ZLQtDialogManager(); } + static void createInstance() { ourInstance = new ZLTQtDialogManager(); } private: - ZLQtDialogManager() {} + ZLTQtDialogManager() {} public: void createApplicationWindow(ZLApplication *application) const; @@ -36,14 +36,16 @@ public: shared_ptr<ZLDialog> createDialog(const ZLResourceKey &key) const; shared_ptr<ZLOptionsDialog> createOptionsDialog(const ZLResourceKey &key, shared_ptr<ZLRunnable> applyAction, bool showApplyButton) const; shared_ptr<ZLOpenFileDialog> createOpenFileDialog(const ZLResourceKey &key, const std::string &directoryPath, const std::string &filePath, const ZLOpenFileDialog::Filter &filter) const; + shared_ptr<ZLTreeDialog> createTreeDialog(const ZLResource &resource) const; + void informationBox(const std::string &title, const std::string &message) const; void errorBox(const ZLResourceKey &key, const std::string &message) const; int questionBox(const ZLResourceKey &key, const std::string &message, const ZLResourceKey &button0, const ZLResourceKey &button1, const ZLResourceKey &button2) const; - shared_ptr<ZLProgressDialog> createProgressDialog(const ZLResourceKey &key) const; + shared_ptr<ZLProgressDialog> createProgressDialog(const ZLResourceKey &key, bool _) const; bool isClipboardSupported(ClipboardType type) const; void setClipboardText(const std::string &text, ClipboardType type) const; void setClipboardImage(const ZLImageData &imageData, ClipboardType type) const; }; -#endif /* __ZLQTDIALOGMANAGER_H__ */ +#endif /* __ZLTQTDIALOGMANAGER_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtOpenFileDialog.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtOpenFileDialog.cpp index 3bc313d..9591996 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtOpenFileDialog.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtOpenFileDialog.cpp @@ -17,54 +17,54 @@ * 02110-1301, USA. */ -#include <qfiledialog.h> +#include <tqfiledialog.h> -#include "ZLQtOpenFileDialog.h" +#include "ZLTQtOpenFileDialog.h" -ZLQtOpenFileDialog::ZLQtOpenFileDialog(const std::string &title, const std::string &directoryPath, const std::string &filePath, const Filter &filter) { - myDialog = new QFileDialog(); - myDialog->setCaption(QString::fromUtf8(title.c_str())); - myDialog->setDir(QString::fromUtf8(directoryPath.c_str())); - myDialog->setSelection(QString::fromUtf8(filePath.c_str())); +ZLTQtOpenFileDialog::ZLTQtOpenFileDialog(const std::string &title, const std::string &directoryPath, const std::string &filePath, const Filter &filter) { + myDialog = new TQFileDialog(); + myDialog->setCaption(TQString::fromUtf8(title.c_str())); + myDialog->setDir(TQString::fromUtf8(directoryPath.c_str())); + myDialog->setSelection(TQString::fromUtf8(filePath.c_str())); } -ZLQtOpenFileDialog::~ZLQtOpenFileDialog() { +ZLTQtOpenFileDialog::~ZLTQtOpenFileDialog() { delete myDialog; } -bool ZLQtOpenFileDialog::runInternal() { +bool ZLTQtOpenFileDialog::runInternal() { return myDialog->exec(); } -std::string ZLQtOpenFileDialog::filePath() const { - QString path = myDialog->selectedFile(); +std::string ZLTQtOpenFileDialog::filePath() const { + TQString path = myDialog->selectedFile(); return path.isNull() ? std::string() : (const char*)path.utf8(); } -std::string ZLQtOpenFileDialog::directoryPath() const { +std::string ZLTQtOpenFileDialog::directoryPath() const { return (const char*)myDialog->dir()->absPath().utf8(); } -void ZLQtOpenFileDialog::setPosition(int x, int y) { +void ZLTQtOpenFileDialog::setPosition(int x, int y) { myDialog->move(x, y); } -void ZLQtOpenFileDialog::setSize(int width, int height) { +void ZLTQtOpenFileDialog::setSize(int width, int height) { myDialog->resize(width, height); } -int ZLQtOpenFileDialog::x() const { +int ZLTQtOpenFileDialog::x() const { return myDialog->x(); } -int ZLQtOpenFileDialog::y() const { +int ZLTQtOpenFileDialog::y() const { return myDialog->y(); } -int ZLQtOpenFileDialog::width() const { +int ZLTQtOpenFileDialog::width() const { return myDialog->width(); } -int ZLQtOpenFileDialog::height() const { +int ZLTQtOpenFileDialog::height() const { return myDialog->height(); } diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtOpenFileDialog.h b/zlibrary/core/src/ui/dialogs/ZLTQtOpenFileDialog.h index be40dcb..144e4bd 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtOpenFileDialog.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtOpenFileDialog.h @@ -17,18 +17,18 @@ * 02110-1301, USA. */ -#ifndef __ZLQTOPENFILEDIALOG_H__ -#define __ZLQTOPENFILEDIALOG_H__ +#ifndef __ZLTQTOPENFILEDIALOG_H__ +#define __ZLTQTOPENFILEDIALOG_H__ #include "../../../../core/src/desktop/dialogs/ZLDesktopOpenFileDialog.h" -class QFileDialog; +class TQFileDialog; -class ZLQtOpenFileDialog : public ZLDesktopOpenFileDialog { +class ZLTQtOpenFileDialog : public ZLDesktopOpenFileDialog { public: - ZLQtOpenFileDialog(const std::string &title, const std::string &directoryPath, const std::string &filePath, const Filter &filter); - ~ZLQtOpenFileDialog(); + ZLTQtOpenFileDialog(const std::string &title, const std::string &directoryPath, const std::string &filePath, const Filter &filter); + ~ZLTQtOpenFileDialog(); bool runInternal(); std::string filePath() const; @@ -42,7 +42,7 @@ public: int height() const; private: - QFileDialog *myDialog; + TQFileDialog *myDialog; }; -#endif /* __ZLQTOPENFILEDIALOG_H__ */ +#endif /* __ZLTQTOPENFILEDIALOG_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtOptionView.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtOptionView.cpp index 21e9ae0..facdf78 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtOptionView.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtOptionView.cpp @@ -19,31 +19,31 @@ #include <cctype> -#include <qcheckbox.h> -#include <qcombobox.h> -#include <qlabel.h> -#include <qbuttongroup.h> -#include <qradiobutton.h> -#include <qpushbutton.h> -#include <qspinbox.h> -#include <qlineedit.h> -#include <qslider.h> -#include <qlayout.h> -#include <qlistbox.h> +#include <tqcheckbox.h> +#include <tqcombobox.h> +#include <tqlabel.h> +#include <tqbuttongroup.h> +#include <tqradiobutton.h> +#include <tqpushbutton.h> +#include <tqspinbox.h> +#include <tqlineedit.h> +#include <tqslider.h> +#include <tqlayout.h> +#include <tqlistbox.h> #include <ZLStringUtil.h> #include <ZLDialogManager.h> -#include "../util/ZLQtKeyUtil.h" +#include "../util/ZLTQtKeyUtil.h" -#include "ZLQtOptionView.h" -#include "ZLQtDialogContent.h" -#include "ZLQtUtil.h" +#include "ZLTQtOptionView.h" +#include "ZLTQtDialogContent.h" +#include "ZLTQtUtil.h" void BooleanOptionView::_createItem() { - myCheckBox = new QCheckBox(::qtString(ZLOptionView::name()), myTab->widget()); + myCheckBox = new TQCheckBox(::qtString(ZLOptionView::name()), myTab->widget()); myCheckBox->setChecked(((ZLBooleanOptionEntry&)*myOption).initialState()); myTab->addItem(myCheckBox, myRow, myFromColumn, myToColumn); - connect(myCheckBox, SIGNAL(toggled(bool)), this, SLOT(onStateChanged(bool))); + connect(myCheckBox, TQ_SIGNAL(toggled(bool)), this, TQ_SLOT(onStateChanged(bool))); } void BooleanOptionView::_show() { @@ -67,7 +67,7 @@ void BooleanOptionView::onStateChanged(bool state) const { } void Boolean3OptionView::_createItem() { - myCheckBox = new QCheckBox(::qtString(ZLOptionView::name()), myTab->widget()); + myCheckBox = new TQCheckBox(::qtString(ZLOptionView::name()), myTab->widget()); myCheckBox->setTristate(true); switch (((ZLBoolean3OptionEntry&)*myOption).initialState()) { case B3_FALSE: @@ -81,7 +81,7 @@ void Boolean3OptionView::_createItem() { break; } myTab->addItem(myCheckBox, myRow, myFromColumn, myToColumn); - connect(myCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); + connect(myCheckBox, TQ_SIGNAL(stateChanged(int)), this, TQ_SLOT(onStateChanged(int))); } void Boolean3OptionView::_show() { @@ -99,13 +99,13 @@ void Boolean3OptionView::_setActive(bool active) { void Boolean3OptionView::_onAccept() const { ZLBoolean3 value = B3_UNDEFINED; switch (myCheckBox->state()) { - case QCheckBox::On: + case TQCheckBox::On: value = B3_TRUE; break; - case QCheckBox::Off: + case TQCheckBox::Off: value = B3_FALSE; break; - case QCheckBox::NoChange: + case TQCheckBox::NoChange: value = B3_UNDEFINED; break; } @@ -115,13 +115,13 @@ void Boolean3OptionView::_onAccept() const { void Boolean3OptionView::onStateChanged(int state) const { ZLBoolean3 value = B3_UNDEFINED; switch (state) { - case QCheckBox::On: + case TQCheckBox::On: value = B3_TRUE; break; - case QCheckBox::Off: + case TQCheckBox::Off: value = B3_FALSE; break; - case QCheckBox::NoChange: + case TQCheckBox::NoChange: value = B3_UNDEFINED; break; } @@ -129,12 +129,12 @@ void Boolean3OptionView::onStateChanged(int state) const { } void ChoiceOptionView::_createItem() { - myGroup = new QButtonGroup(::qtString(ZLOptionView::name()), myTab->widget()); - QVBoxLayout *layout = new QVBoxLayout(myGroup, 12); + myGroup = new TQButtonGroup(::qtString(ZLOptionView::name()), myTab->widget()); + TQVBoxLayout *layout = new TQVBoxLayout(myGroup, 12); layout->addSpacing(myGroup->fontMetrics().height()); - myButtons = new QRadioButton*[((ZLChoiceOptionEntry&)*myOption).choiceNumber()]; + myButtons = new TQRadioButton*[((ZLChoiceOptionEntry&)*myOption).choiceNumber()]; for (int i = 0; i < ((ZLChoiceOptionEntry&)*myOption).choiceNumber(); ++i) { - myButtons[i] = new QRadioButton((QButtonGroup*)layout->parent()); + myButtons[i] = new TQRadioButton((TQButtonGroup*)layout->parent()); myButtons[i]->setText(::qtString(((ZLChoiceOptionEntry&)*myOption).text(i))); layout->addWidget(myButtons[i]); } @@ -167,14 +167,14 @@ void ComboOptionView::_createItem() { const ZLComboOptionEntry &comboOption = (ZLComboOptionEntry&)*myOption; const std::string &name = ZLOptionView::name(); if (!name.empty()) { - myLabel = new QLabel(::qtString(name), myTab->widget()); + myLabel = new TQLabel(::qtString(name), myTab->widget()); } - myComboBox = new QComboBox(myTab->widget()); + myComboBox = new TQComboBox(myTab->widget()); myComboBox->setEditable(comboOption.isEditable()); - connect(myTab->parentWidget(), SIGNAL(resized(const QSize&)), this, SLOT(onTabResized(const QSize&))); - connect(myComboBox, SIGNAL(activated(int)), this, SLOT(onValueSelected(int))); - connect(myComboBox, SIGNAL(textChanged(const QString&)), this, SLOT(onValueEdited(const QString&))); + connect(myTab->parentWidget(), TQ_SIGNAL(resized(const TQSize&)), this, TQ_SLOT(onTabResized(const TQSize&))); + connect(myComboBox, TQ_SIGNAL(activated(int)), this, TQ_SLOT(onValueSelected(int))); + connect(myComboBox, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(onValueEdited(const TQString&))); if (myLabel != 0) { int width = myToColumn - myFromColumn + 1; @@ -213,7 +213,7 @@ void ComboOptionView::reset() { } } -void ComboOptionView::onTabResized(const QSize &size) { +void ComboOptionView::onTabResized(const TQSize &size) { myComboBox->setMaximumWidth(size.width() / 2 - 30); } @@ -246,7 +246,7 @@ void ComboOptionView::onValueSelected(int index) { } } -void ComboOptionView::onValueEdited(const QString &value) { +void ComboOptionView::onValueEdited(const TQString &value) { ZLComboOptionEntry &o = (ZLComboOptionEntry&)*myOption; if (o.useOnValueEdited()) { o.onValueEdited((const char*)value.utf8()); @@ -254,8 +254,8 @@ void ComboOptionView::onValueEdited(const QString &value) { } void SpinOptionView::_createItem() { - myLabel = new QLabel(::qtString(ZLOptionView::name()), myTab->widget()); - mySpinBox = new QSpinBox( + myLabel = new TQLabel(::qtString(ZLOptionView::name()), myTab->widget()); + mySpinBox = new TQSpinBox( ((ZLSpinOptionEntry&)*myOption).minValue(), ((ZLSpinOptionEntry&)*myOption).maxValue(), ((ZLSpinOptionEntry&)*myOption).step(), myTab->widget() @@ -281,11 +281,11 @@ void SpinOptionView::_onAccept() const { } void StringOptionView::_createItem() { - myLineEdit = new QLineEdit(myTab->widget()); - myLineEdit->setEchoMode(myPasswordMode ? QLineEdit::Password : QLineEdit::Normal); - connect(myLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onValueEdited(const QString&))); + myLineEdit = new TQLineEdit(myTab->widget()); + myLineEdit->setEchoMode(myPasswordMode ? TQLineEdit::Password : TQLineEdit::Normal); + connect(myLineEdit, TQ_SIGNAL(textChanged(const TQString&)), this, TQ_SLOT(onValueEdited(const TQString&))); if (!ZLOptionView::name().empty()) { - myLabel = new QLabel(::qtString(ZLOptionView::name()), myTab->widget()); + myLabel = new TQLabel(::qtString(ZLOptionView::name()), myTab->widget()); int width = myToColumn - myFromColumn + 1; myTab->addItem(myLabel, myRow, myFromColumn, myFromColumn + width / 2 - 1); myTab->addItem(myLineEdit, myRow, myFromColumn + width / 2, myToColumn); @@ -323,44 +323,44 @@ void StringOptionView::reset() { return; } myLineEdit->setText(::qtString(((ZLStringOptionEntry&)*myOption).initialValue())); - myLineEdit->cursorLeft(false, myLineEdit->text().length()); + myLineEdit->cursorBackward(false, myLineEdit->text().length()); } -void StringOptionView::onValueEdited(const QString &value) { +void StringOptionView::onValueEdited(const TQString &value) { ZLStringOptionEntry &o = (ZLStringOptionEntry&)*myOption; if (o.useOnValueEdited()) { o.onValueEdited((const char*)value.utf8()); } } -class KeyLineEdit : public QLineEdit { +class KeyLineEdit : public TQLineEdit { public: KeyLineEdit(KeyOptionView &keyView); protected: - void focusInEvent(QFocusEvent*); - void focusOutEvent(QFocusEvent*); - void keyPressEvent(QKeyEvent *keyEvent); + void focusInEvent(TQFocusEvent*); + void focusOutEvent(TQFocusEvent*); + void keyPressEvent(TQKeyEvent *keyEvent); private: KeyOptionView &myKeyView; }; -KeyLineEdit::KeyLineEdit(KeyOptionView &keyView) : QLineEdit(keyView.myWidget), myKeyView(keyView) { +KeyLineEdit::KeyLineEdit(KeyOptionView &keyView) : TQLineEdit(keyView.myWidget), myKeyView(keyView) { focusOutEvent(0); } -void KeyLineEdit::focusInEvent(QFocusEvent*) { +void KeyLineEdit::focusInEvent(TQFocusEvent*) { grabKeyboard(); } -void KeyLineEdit::focusOutEvent(QFocusEvent*) { +void KeyLineEdit::focusOutEvent(TQFocusEvent*) { releaseKeyboard(); } -void KeyLineEdit::keyPressEvent(QKeyEvent *keyEvent) { - std::string keyText = ZLQtKeyUtil::keyName(keyEvent); +void KeyLineEdit::keyPressEvent(TQKeyEvent *keyEvent) { + std::string keyText = ZLTQtKeyUtil::keyName(keyEvent); setText(keyText.c_str()); if (!keyText.empty()) { myKeyView.myCurrentKey = keyText; @@ -371,22 +371,22 @@ void KeyLineEdit::keyPressEvent(QKeyEvent *keyEvent) { } void KeyOptionView::_createItem() { - myWidget = new QWidget(myTab->widget()); - QGridLayout *layout = new QGridLayout(myWidget, 2, 2, 0, 10); + myWidget = new TQWidget(myTab->widget()); + TQGridLayout *layout = new TQGridLayout(myWidget, 2, 2, 0, 10); - myLabel = new QLabel(myWidget); + myLabel = new TQLabel(myWidget); myLabel->setText(::qtString(ZLResource::resource("keyOptionView")["actionFor"].value())); layout->addWidget(myLabel, 0, 0); myKeyEditor = new KeyLineEdit(*this); layout->addWidget(myKeyEditor, 0, 1); - myComboBox = new QComboBox(myWidget); + myComboBox = new TQComboBox(myWidget); const std::vector<std::string> &actions = ((ZLKeyOptionEntry&)*myOption).actionNames(); for (std::vector<std::string>::const_iterator it = actions.begin(); it != actions.end(); ++it) { myComboBox->insertItem(::qtString(*it)); } - connect(myComboBox, SIGNAL(activated(int)), this, SLOT(onValueChanged(int))); + connect(myComboBox, TQ_SIGNAL(activated(int)), this, TQ_SLOT(onValueChanged(int))); layout->addMultiCellWidget(myComboBox, 1, 1, 0, 1); myTab->addItem(myWidget, myRow, myFromColumn, myToColumn); } @@ -433,25 +433,25 @@ void KeyOptionView::onValueChanged(int index) { } void ColorOptionView::_createItem() { - myWidget = new QWidget(myTab->widget()); - QGridLayout *layout = new QGridLayout(myWidget, 3, 3, 0, 10); + myWidget = new TQWidget(myTab->widget()); + TQGridLayout *layout = new TQGridLayout(myWidget, 3, 3, 0, 10); const ZLResource &resource = ZLResource::resource(ZLDialogManager::COLOR_KEY); - layout->addWidget(new QLabel(::qtString(resource["red"].value()), myWidget), 0, 0); - layout->addWidget(new QLabel(::qtString(resource["green"].value()), myWidget), 1, 0); - layout->addWidget(new QLabel(::qtString(resource["blue"].value()), myWidget), 2, 0); + layout->addWidget(new TQLabel(::qtString(resource["red"].value()), myWidget), 0, 0); + layout->addWidget(new TQLabel(::qtString(resource["green"].value()), myWidget), 1, 0); + layout->addWidget(new TQLabel(::qtString(resource["blue"].value()), myWidget), 2, 0); const ZLColor &color = ((ZLColorOptionEntry&)*myOption).color(); - myRSlider = new QSlider(0, 255, 1, color.Red, QSlider::Horizontal, myWidget); - myGSlider = new QSlider(0, 255, 1, color.Green, QSlider::Horizontal, myWidget); - myBSlider = new QSlider(0, 255, 1, color.Blue, QSlider::Horizontal, myWidget); - connect(myRSlider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderMove(int))); - connect(myGSlider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderMove(int))); - connect(myBSlider, SIGNAL(sliderMoved(int)), this, SLOT(onSliderMove(int))); + myRSlider = new TQSlider(0, 255, 1, color.Red, TQSlider::Horizontal, myWidget); + myGSlider = new TQSlider(0, 255, 1, color.Green, TQSlider::Horizontal, myWidget); + myBSlider = new TQSlider(0, 255, 1, color.Blue, TQSlider::Horizontal, myWidget); + connect(myRSlider, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(onSliderMove(int))); + connect(myGSlider, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(onSliderMove(int))); + connect(myBSlider, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(onSliderMove(int))); layout->addWidget(myRSlider, 0, 1); layout->addWidget(myGSlider, 1, 1); layout->addWidget(myBSlider, 2, 1); - myColorBar = new QLabel(" ", myWidget); - myColorBar->setBackgroundColor(QColor(color.Red, color.Green, color.Blue)); - myColorBar->setFrameStyle(QFrame::Panel | QFrame::Plain); + myColorBar = new TQLabel(" ", myWidget); + myColorBar->setBackgroundColor(TQColor(color.Red, color.Green, color.Blue)); + myColorBar->setFrameStyle(TQFrame::Panel | TQFrame::Plain); layout->addMultiCellWidget(myColorBar, 0, 2, 2, 2); myTab->addItem(myWidget, myRow, myFromColumn, myToColumn); } @@ -466,7 +466,7 @@ void ColorOptionView::reset() { myRSlider->setValue(color.Red); myGSlider->setValue(color.Green); myBSlider->setValue(color.Blue); - myColorBar->setBackgroundColor(QColor(color.Red, color.Green, color.Blue)); + myColorBar->setBackgroundColor(TQColor(color.Red, color.Green, color.Blue)); } void ColorOptionView::_show() { @@ -478,7 +478,7 @@ void ColorOptionView::_hide() { } void ColorOptionView::onSliderMove(int) { - myColorBar->setBackgroundColor(QColor(myRSlider->value(), myGSlider->value(), myBSlider->value())); + myColorBar->setBackgroundColor(TQColor(myRSlider->value(), myGSlider->value(), myBSlider->value())); } void ColorOptionView::_onAccept() const { @@ -486,55 +486,55 @@ void ColorOptionView::_onAccept() const { } void OrderOptionView::onChangeSelection() { - QListBoxItem *selected = myListBox->selectedItem(); + TQListBoxItem *selected = myListBox->selectedItem(); myUpButton->setEnabled((selected != 0) && (selected->prev() != 0)); myDownButton->setEnabled((selected != 0) && (selected->next() != 0)); } void OrderOptionView::onUpButtonPressed() { - QListBoxItem *selected = myListBox->selectedItem(); + TQListBoxItem *selected = myListBox->selectedItem(); if ((selected == 0) || (selected->prev() == 0)) { return; } int index = myListBox->index(selected); - const QString s0 = myListBox->text(index - 1); - const QString s1 = myListBox->text(index); + const TQString s0 = myListBox->text(index - 1); + const TQString s1 = myListBox->text(index); myListBox->changeItem(s0, index); myListBox->changeItem(s1, index - 1); myListBox->setSelected(index - 1, true); } void OrderOptionView::onDownButtonPressed() { - QListBoxItem *selected = myListBox->selectedItem(); + TQListBoxItem *selected = myListBox->selectedItem(); if ((selected == 0) || (selected->next() == 0)) { return; } int index = myListBox->index(selected); - const QString s0 = myListBox->text(index); - const QString s1 = myListBox->text(index + 1); + const TQString s0 = myListBox->text(index); + const TQString s1 = myListBox->text(index + 1); myListBox->changeItem(s0, index + 1); myListBox->changeItem(s1, index); myListBox->setSelected(index + 1, true); } void OrderOptionView::_createItem() { - myWidget = new QWidget(myTab->widget()); - QGridLayout *layout = new QGridLayout(myWidget, 2, 2, 0, 10); + myWidget = new TQWidget(myTab->widget()); + TQGridLayout *layout = new TQGridLayout(myWidget, 2, 2, 0, 10); - myListBox = new QListBox(myWidget); - myListBox->setSelectionMode(QListBox::Single); - connect(myListBox, SIGNAL(selectionChanged()), this, SLOT(onChangeSelection())); + myListBox = new TQListBox(myWidget); + myListBox->setSelectionMode(TQListBox::Single); + connect(myListBox, TQ_SIGNAL(selectionChanged()), this, TQ_SLOT(onChangeSelection())); layout->addMultiCellWidget(myListBox, 0, 1, 0, 0); - myUpButton = new QPushButton(myWidget); + myUpButton = new TQPushButton(myWidget); myUpButton->setText("Up"); layout->addWidget(myUpButton, 0, 1); - connect(myUpButton, SIGNAL(pressed()), this, SLOT(onUpButtonPressed())); + connect(myUpButton, TQ_SIGNAL(pressed()), this, TQ_SLOT(onUpButtonPressed())); - myDownButton = new QPushButton(myWidget); + myDownButton = new TQPushButton(myWidget); myDownButton->setText("Down"); layout->addWidget(myDownButton, 1, 1); - connect(myDownButton, SIGNAL(pressed()), this, SLOT(onDownButtonPressed())); + connect(myDownButton, TQ_SIGNAL(pressed()), this, TQ_SLOT(onDownButtonPressed())); const std::vector<std::string> &values = ((ZLOrderOptionEntry&)*myOption).values(); for (std::vector<std::string>::const_iterator it = values.begin(); it != values.end(); ++it) { @@ -564,7 +564,7 @@ void OrderOptionView::_onAccept() const { void StaticTextOptionView::_createItem() { const std::string &text = ((ZLStaticTextOptionEntry&)*myOption).initialValue(); - myLabel = new QLabel(::qtString(text), myTab->widget()); + myLabel = new TQLabel(::qtString(text), myTab->widget()); myTab->addItem(myLabel, myRow, myFromColumn, myToColumn); } @@ -578,3 +578,5 @@ void StaticTextOptionView::_hide() { void StaticTextOptionView::_onAccept() const { } + +#include "ZLTQtOptionView.moc" diff --git a/zlibrary/core/src/ui/dialogs/ZLTQtOptionView.h b/zlibrary/core/src/ui/dialogs/ZLTQtOptionView.h new file mode 100644 index 0000000..d0855aa --- /dev/null +++ b/zlibrary/core/src/ui/dialogs/ZLTQtOptionView.h @@ -0,0 +1,269 @@ +/* + * Copyright (C) 2004-2012 Geometer Plus <[email protected]> + * + * 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 __ZLTQTOPTIONVIEW_H__ +#define __ZLTQTOPTIONVIEW_H__ + +#include <tqobject.h> + +#include <ZLOptionsDialog.h> +#include <ZLOptionEntry.h> +#include "../../../../core/src/dialogs/ZLOptionView.h" + +class ZLTQtDialogContent; + +class TQButtonGroup; +class TQLabel; +class TQSpinBox; +class TQCheckBox; +class TQListBox; +class TQLineEdit; +class TQPushButton; +class TQRadioButton; +class TQComboBox; +class TQSlider; +class TQWidget; + +class ZLTQtOptionView : public ZLOptionView { + +protected: + ZLTQtOptionView(const std::string &name, const std::string &tooltip, ZLOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLOptionView(name, tooltip, option), myTab(tab), myRow(row), myFromColumn(fromColumn), myToColumn(toColumn) {} + +protected: + ZLTQtDialogContent *myTab; + int myRow, myFromColumn, myToColumn; +}; + +class ChoiceOptionView : public ZLTQtOptionView { + +public: + ChoiceOptionView(const std::string &name, const std::string &tooltip, ZLChoiceOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) { + myButtons = 0; + } + ~ChoiceOptionView() { if (myButtons != 0) delete[] myButtons; } + +protected: + void _createItem(); + void _show(); + void _hide(); + void _setActive(bool active); + void _onAccept() const; + +private: + TQButtonGroup *myGroup; + TQRadioButton **myButtons; +}; + +class BooleanOptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + BooleanOptionView(const std::string &name, const std::string &tooltip, ZLBooleanOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} + +protected: + void _createItem(); + void _show(); + void _hide(); + void _setActive(bool active); + void _onAccept() const; + +private slots: + void onStateChanged(bool) const; + +private: + TQCheckBox *myCheckBox; +}; + +class Boolean3OptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + Boolean3OptionView(const std::string &name, const std::string &tooltip, ZLBoolean3OptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} + +protected: + void _createItem(); + void _show(); + void _hide(); + void _setActive(bool active); + void _onAccept() const; + +private slots: + void onStateChanged(int) const; + +private: + TQCheckBox *myCheckBox; +}; + +class StringOptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + StringOptionView(const std::string &name, const std::string &tooltip, ZLStringOptionEntry *option, ZLTQtDialogContent *tab, bool passwordMode, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myLabel(0), myLineEdit(0), myPasswordMode(passwordMode) {} + +private: + void _createItem(); + void _show(); + void _hide(); + void _setActive(bool active); + void _onAccept() const; + void reset(); + +private slots: + void onValueEdited(const TQString &value); + +private: + TQLabel *myLabel; + TQLineEdit *myLineEdit; + const bool myPasswordMode; +}; + +class SpinOptionView : public ZLTQtOptionView { + +public: + SpinOptionView(const std::string &name, const std::string &tooltip, ZLSpinOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} + +protected: + void _createItem(); + void _show(); + void _hide(); + void _onAccept() const; + +private: + TQLabel *myLabel; + TQSpinBox *mySpinBox; +}; + +class ComboOptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + ComboOptionView(const std::string &name, const std::string &tooltip, ZLComboOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myLabel(0), myComboBox(0) {} + +private: + void _createItem(); + void _show(); + void _hide(); + void _setActive(bool active); + void _onAccept() const; + void reset(); + +private slots: + void onValueSelected(int index); + void onValueEdited(const TQString &value); + void onTabResized(const TQSize &size); + +private: + TQLabel *myLabel; + TQComboBox *myComboBox; +}; + +class KeyOptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + KeyOptionView(const std::string &name, const std::string &tooltip, ZLKeyOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myWidget(0), myKeyEditor(0), myLabel(0), myComboBox(0) {} + +private: + void _createItem(); + void _show(); + void _hide(); + void _onAccept() const; + void reset(); + +private slots: + void onValueChanged(int); + +private: + TQWidget *myWidget; + TQLineEdit *myKeyEditor; + TQLabel *myLabel; + TQComboBox *myComboBox; + std::string myCurrentKey; + +friend class KeyLineEdit; +}; + +class ColorOptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + ColorOptionView(const std::string &name, const std::string &tooltip, ZLColorOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myWidget(0), myRSlider(0), myGSlider(0), myBSlider(0), myColorBar(0) {} + +private: + void _createItem(); + void _show(); + void _hide(); + void _onAccept() const; + void reset(); + +private slots: + void onSliderMove(int); + +private: + TQWidget *myWidget; + TQSlider *myRSlider, *myGSlider, *myBSlider; + TQLabel *myColorBar; +}; + +class OrderOptionView : public TQObject, public ZLTQtOptionView { + +TQ_OBJECT + +public: + OrderOptionView(const std::string &name, const std::string &tooltip, ZLOrderOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} + +protected: + void _createItem(); + void _show(); + void _hide(); + void _onAccept() const; + +private slots: + void onChangeSelection(); + void onUpButtonPressed(); + void onDownButtonPressed(); + +private: + TQWidget *myWidget; + TQListBox *myListBox; + TQPushButton *myUpButton, *myDownButton; +}; + +class StaticTextOptionView : public ZLTQtOptionView { + +public: + StaticTextOptionView(const std::string &name, const std::string &tooltip, ZLStaticTextOptionEntry *option, ZLTQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLTQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myLabel(0) {} + +private: + void _createItem(); + void _show(); + void _hide(); + void _onAccept() const; + +private: + TQLabel *myLabel; +}; + +#endif /* __ZLTQTOPTIONVIEW_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtOptionsDialog.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtOptionsDialog.cpp index 7196802..81af5a8 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtOptionsDialog.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtOptionsDialog.cpp @@ -17,65 +17,66 @@ * 02110-1301, USA. */ -#include <qlayout.h> -#include <qpushbutton.h> +#include <tqlayout.h> +#include <tqpushbutton.h> #include <ZLDialogManager.h> -#include "ZLQtOptionsDialog.h" -#include "ZLQtDialogContent.h" -#include "ZLQtUtil.h" +#include "ZLTQtOptionsDialog.h" +#include "ZLTQtDialogContent.h" +#include "ZLTQtUtil.h" -ZLQtOptionsDialog::ZLQtOptionsDialog(const ZLResource &resource, shared_ptr<ZLRunnable> applyAction, bool showApplyButton) : QTabDialog(0, 0, true), ZLDesktopOptionsDialog(resource, applyAction) { +ZLTQtOptionsDialog::ZLTQtOptionsDialog(const ZLResource &resource, shared_ptr<ZLRunnable> applyAction, bool showApplyButton) : TQTabDialog(0, 0, true), ZLDesktopOptionsDialog(resource, applyAction) { setCaption(::qtString(ZLOptionsDialog::caption())); setOkButton(::qtButtonName(ZLDialogManager::OK_BUTTON)); setHelpButton(::qtButtonName(ZLDialogManager::CANCEL_BUTTON)); - connect(this, SIGNAL(helpButtonPressed()), this, SLOT(reject())); + connect(this, TQ_SIGNAL(helpButtonPressed()), this, TQ_SLOT(reject())); if (showApplyButton) { setApplyButton(::qtButtonName(ZLDialogManager::APPLY_BUTTON)); - connect(this, SIGNAL(applyButtonPressed()), this, SLOT(apply())); + connect(this, TQ_SIGNAL(applyButtonPressed()), this, TQ_SLOT(apply())); } } -void ZLQtOptionsDialog::apply() { +void ZLTQtOptionsDialog::apply() { ZLOptionsDialog::accept(); } -ZLDialogContent &ZLQtOptionsDialog::createTab(const ZLResourceKey &key) { - ZLQtDialogContent *tab = new ZLQtDialogContent(this, tabResource(key)); +ZLDialogContent &ZLTQtOptionsDialog::createTab(const ZLResourceKey &key) { + ZLTQtDialogContent *tab = new ZLTQtDialogContent(this, tabResource(key)); addTab(tab->widget(), ::qtString(tab->displayName())); myTabs.push_back(tab); return *tab; } -const std::string &ZLQtOptionsDialog::selectedTabKey() const { - QWidget *currentTab = currentPage(); +const std::string &ZLTQtOptionsDialog::selectedTabKey() const { + TQWidget *currentTab = currentPage(); for (std::vector<shared_ptr<ZLDialogContent> >::const_iterator it = myTabs.begin(); it != myTabs.end(); ++it) { - if (((ZLQtDialogContent&)**it).widget() == currentTab) { + if (((ZLTQtDialogContent&)**it).widget() == currentTab) { return (*it)->key(); } } return myTabs[0]->key(); } -void ZLQtOptionsDialog::selectTab(const ZLResourceKey &key) { +void ZLTQtOptionsDialog::selectTab(const ZLResourceKey &key) { for (std::vector<shared_ptr<ZLDialogContent> >::const_iterator it = myTabs.begin(); it != myTabs.end(); ++it) { if ((*it)->key() == key.Name) { - showPage(((ZLQtDialogContent&)**it).widget()); + showPage(((ZLTQtDialogContent&)**it).widget()); break; } } } -bool ZLQtOptionsDialog::runInternal() { +bool ZLTQtOptionsDialog::runInternal() { for (std::vector<shared_ptr<ZLDialogContent> >::iterator it = myTabs.begin(); it != myTabs.end(); ++it) { - ((ZLQtDialogContent&)**it).close(); + ((ZLTQtDialogContent&)**it).close(); } - return exec() == QDialog::Accepted; + return exec() == TQDialog::Accepted; } -void ZLQtOptionsDialog::resizeEvent(QResizeEvent *event) { - QTabDialog::resizeEvent(event); +void ZLTQtOptionsDialog::resizeEvent(TQResizeEvent *event) { + TQTabDialog::resizeEvent(event); emit resized(event->size()); } +#include "ZLTQtOptionsDialog.moc" diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtOptionsDialog.h b/zlibrary/core/src/ui/dialogs/ZLTQtOptionsDialog.h index a2d1793..cec7154 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtOptionsDialog.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtOptionsDialog.h @@ -17,21 +17,21 @@ * 02110-1301, USA. */ -#ifndef __ZLQTOPTIONSDIALOG_H__ -#define __ZLQTOPTIONSDIALOG_H__ +#ifndef __ZLTQTOPTIONSDIALOG_H__ +#define __ZLTQTOPTIONSDIALOG_H__ #include <vector> -#include <qwidget.h> -#include <qtabdialog.h> +#include <tqwidget.h> +#include <tqtabdialog.h> #include "../../../../core/src/desktop/dialogs/ZLDesktopOptionsDialog.h" -class ZLQtOptionsDialog : public QTabDialog, public ZLDesktopOptionsDialog { - Q_OBJECT +class ZLTQtOptionsDialog : public TQTabDialog, public ZLDesktopOptionsDialog { + TQ_OBJECT public: - ZLQtOptionsDialog(const ZLResource &resource, shared_ptr<ZLRunnable> applyAction, bool showApplyButton); + ZLTQtOptionsDialog(const ZLResource &resource, shared_ptr<ZLRunnable> applyAction, bool showApplyButton); ZLDialogContent &createTab(const ZLResourceKey &key); protected: @@ -39,16 +39,16 @@ protected: void selectTab(const ZLResourceKey &key); bool runInternal(); - void setSize(int width, int height) { QTabDialog::resize(width, height); } - int width() const { return QTabDialog::width(); } - int height() const { return QTabDialog::height(); } + void setSize(int width, int height) { TQTabDialog::resize(width, height); } + int width() const { return TQTabDialog::width(); } + int height() const { return TQTabDialog::height(); } private slots: - void resizeEvent(QResizeEvent *); + void resizeEvent(TQResizeEvent *); void apply(); signals: - void resized(const QSize &size); + void resized(const TQSize &size); }; -#endif /* __ZLQTOPTIONSDIALOG_H__ */ +#endif /* __ZLTQTOPTIONSDIALOG_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtProgressDialog.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtProgressDialog.cpp index 8ca04d7..f356e8d 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtProgressDialog.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtProgressDialog.cpp @@ -19,56 +19,56 @@ #include <unistd.h> -#include <qapplication.h> -#include <qcursor.h> -#include <qwidget.h> -#include <qpainter.h> +#include <tqapplication.h> +#include <tqcursor.h> +#include <tqwidget.h> +#include <tqpainter.h> -#include "ZLQtProgressDialog.h" -#include "ZLQtUtil.h" +#include "ZLTQtProgressDialog.h" +#include "ZLTQtUtil.h" -ZLQtProgressDialog::ZLQtProgressDialog(const ZLResourceKey &key) : ZLProgressDialog(key), myWaitMessage(0) { +ZLTQtProgressDialog::ZLTQtProgressDialog(const ZLResourceKey &key) : ZLProgressDialog(key), myWaitMessage(0) { } -void ZLQtProgressDialog::run(ZLRunnable &runnable) { - ZLQtWaitMessage waitMessage(messageText()); +void ZLTQtProgressDialog::run(ZLRunnable &runnable) { + ZLTQtWaitMessage waitMessage(messageText()); myWaitMessage = &waitMessage; runnable.run(); myWaitMessage = 0; } -void ZLQtProgressDialog::setMessage(const std::string &message) { +void ZLTQtProgressDialog::setMessage(const std::string &message) { if (myWaitMessage == 0) { return; } myWaitMessage->myLabelText = ::qtString(message); myWaitMessage->repaint(); - QFontMetrics metrics = myWaitMessage->fontMetrics(); + TQFontMetrics metrics = myWaitMessage->fontMetrics(); const int w = metrics.width(myWaitMessage->myLabelText) + 20; const int h = metrics.height() + 20; myWaitMessage->resize(w, h); - qApp->processEvents(); + tqApp->processEvents(); } -ZLQtWaitMessage::ZLQtWaitMessage(const std::string &message) : QWidget(0, 0, WStyle_Splash), myLabelText(::qtString(message)) { - QWidget *main = qApp->mainWidget(); +ZLTQtWaitMessage::ZLTQtWaitMessage(const std::string &message) : TQWidget(0, 0, WStyle_Splash), myLabelText(::qtString(message)) { + TQWidget *main = tqApp->mainWidget(); if (main != 0) { myCursorIsStored = true; myStoredCursor = main->cursor(); - main->setCursor(Qt::waitCursor); + main->setCursor(TQt::waitCursor); } else { myCursorIsStored = false; } - setCursor(Qt::waitCursor); + setCursor(TQt::waitCursor); - qApp->processEvents(); + tqApp->processEvents(); if (main == 0) { - main = QApplication::desktop(); + main = TQApplication::desktop(); } - QPoint position = main->pos(); - QFontMetrics metrics = fontMetrics(); + TQPoint position = main->pos(); + TQFontMetrics metrics = fontMetrics(); const int w = metrics.width(myLabelText) + 20; const int h = metrics.height() + 20; resize(1, 1); @@ -79,24 +79,24 @@ ZLQtWaitMessage::ZLQtWaitMessage(const std::string &message) : QWidget(0, 0, WSt w, h ); - qApp->processEvents(); + tqApp->processEvents(); for (int i = 0; i < 6; ++i) { usleep(5000); - qApp->processEvents(); + tqApp->processEvents(); } } -ZLQtWaitMessage::~ZLQtWaitMessage() { +ZLTQtWaitMessage::~ZLTQtWaitMessage() { if (myCursorIsStored) { - QWidget *main = qApp->mainWidget(); + TQWidget *main = tqApp->mainWidget(); if (main != 0) { main->setCursor(myStoredCursor); } } } -void ZLQtWaitMessage::paintEvent(QPaintEvent *event) { - QPainter painter; +void ZLTQtWaitMessage::paintEvent(TQPaintEvent *event) { + TQPainter painter; painter.begin(this); painter.drawText(10, fontMetrics().height() - fontMetrics().descent() + 10, myLabelText); painter.end(); diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtProgressDialog.h b/zlibrary/core/src/ui/dialogs/ZLTQtProgressDialog.h index e19b2b6..096de87 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtProgressDialog.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtProgressDialog.h @@ -17,45 +17,45 @@ * 02110-1301, USA. */ -#ifndef __ZLQTPROGRESSDIALOG_H__ -#define __ZLQTPROGRESSDIALOG_H__ +#ifndef __ZLTQTPROGRESSDIALOG_H__ +#define __ZLTQTPROGRESSDIALOG_H__ #include <string> -#include <qwidget.h> -#include <qcursor.h> +#include <tqwidget.h> +#include <tqcursor.h> #include <ZLProgressDialog.h> -class ZLQtWaitMessage; +class ZLTQtWaitMessage; -class ZLQtProgressDialog : public ZLProgressDialog { +class ZLTQtProgressDialog : public ZLProgressDialog { public: - ZLQtProgressDialog(const ZLResourceKey &key); + ZLTQtProgressDialog(const ZLResourceKey &key); private: void run(ZLRunnable &runnable); void setMessage(const std::string &message); private: - ZLQtWaitMessage *myWaitMessage; + ZLTQtWaitMessage *myWaitMessage; }; -class ZLQtWaitMessage : public QWidget { +class ZLTQtWaitMessage : public TQWidget { public: - ZLQtWaitMessage(const std::string &message); - ~ZLQtWaitMessage(); + ZLTQtWaitMessage(const std::string &message); + ~ZLTQtWaitMessage(); - void paintEvent(QPaintEvent *event); + void paintEvent(TQPaintEvent *event); private: - QCursor myStoredCursor; + TQCursor myStoredCursor; bool myCursorIsStored; - QString myLabelText; + TQString myLabelText; -friend class ZLQtProgressDialog; +friend class ZLTQtProgressDialog; }; -#endif /* __ZLQTPROGRESSDIALOG_H__ */ +#endif /* __ZLTQTPROGRESSDIALOG_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtUtil.cpp b/zlibrary/core/src/ui/dialogs/ZLTQtUtil.cpp index a8014e3..deb206f 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtUtil.cpp +++ b/zlibrary/core/src/ui/dialogs/ZLTQtUtil.cpp @@ -19,15 +19,15 @@ #include <ZLDialogManager.h> -#include "ZLQtUtil.h" +#include "ZLTQtUtil.h" -QString qtString(const std::string &text) { - return QString::fromUtf8(text.c_str()); +TQString qtString(const std::string &text) { + return TQString::fromUtf8(text.c_str()); } -QString qtButtonName(const ZLResourceKey &key) { +TQString qtButtonName(const ZLResourceKey &key) { if (key.Name.empty()) { - return QString::null; + return TQString::null; } return ::qtString(ZLDialogManager::buttonName(key)); } diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtUtil.h b/zlibrary/core/src/ui/dialogs/ZLTQtUtil.h index 1d5b4bb..691138a 100644 --- a/zlibrary/ui/src/qt/dialogs/ZLQtUtil.h +++ b/zlibrary/core/src/ui/dialogs/ZLTQtUtil.h @@ -17,14 +17,14 @@ * 02110-1301, USA. */ -#ifndef __ZLQTUTIL_H__ -#define __ZLQTUTIL_H__ +#ifndef __ZLTQTUTIL_H__ +#define __ZLTQTUTIL_H__ -#include <qstring.h> +#include <tqstring.h> #include <ZLResource.h> -QString qtButtonName(const ZLResourceKey &key); -QString qtString(const std::string &text); +TQString qtButtonName(const ZLResourceKey &key); +TQString qtString(const std::string &text); -#endif /* __ZLQTUTIL_H__ */ +#endif /* __ZLTQTUTIL_H__ */ diff --git a/zlibrary/ui/src/qt/filesystem/ZLQtFSManager.cpp b/zlibrary/core/src/ui/filesystem/ZLTQtFSManager.cpp index f0a4a44..e8c5cfd 100644 --- a/zlibrary/ui/src/qt/filesystem/ZLQtFSManager.cpp +++ b/zlibrary/core/src/ui/filesystem/ZLTQtFSManager.cpp @@ -17,20 +17,19 @@ * 02110-1301, USA. */ -#include <qstring.h> +#include <tqstring.h> -#include "ZLQtFSManager.h" +#include "ZLTQtFSManager.h" -std::string ZLQtFSManager::convertFilenameToUtf8(const std::string &name) const { +std::string ZLTQtFSManager::convertFilenameToUtf8(const std::string &name) const { if (name.empty()) { return name; } - QString qString = QString::fromLocal8Bit(name.c_str()); - return (qString == QString::null) ? "" : (const char*)qString.utf8(); + TQString qString = TQString::fromLocal8Bit(name.c_str()); + return (qString == TQString::null) ? "" : (const char*)qString.utf8(); } -shared_ptr<ZLMimeType> ZLQtFSManager::mimeType(const std::string &path) const { - // TODO: implement +shared_ptr<ZLMimeType> ZLTQtFSManager::mimeType(const std::string &path) const { return ZLMimeType::EMPTY; } diff --git a/zlibrary/ui/src/qt/filesystem/ZLQtFSManager.h b/zlibrary/core/src/ui/filesystem/ZLTQtFSManager.h index 7fd67d2..fe872e2 100644 --- a/zlibrary/ui/src/qt/filesystem/ZLQtFSManager.h +++ b/zlibrary/core/src/ui/filesystem/ZLTQtFSManager.h @@ -17,22 +17,22 @@ * 02110-1301, USA. */ -#ifndef __ZLQTFSMANAGER_H__ -#define __ZLQTFSMANAGER_H__ +#ifndef __ZLTQTFSMANAGER_H__ +#define __ZLTQTFSMANAGER_H__ #include "../../../../core/src/unix/filesystem/ZLUnixFSManager.h" -class ZLQtFSManager : public ZLUnixFSManager { +class ZLTQtFSManager : public ZLUnixFSManager { public: - static void createInstance() { ourInstance = new ZLQtFSManager(); } + static void createInstance() { ourInstance = new ZLTQtFSManager(); } private: - ZLQtFSManager() {} + ZLTQtFSManager() {} protected: std::string convertFilenameToUtf8(const std::string &name) const; - std::string mimeType(const std::string &path) const; + shared_ptr<ZLMimeType> mimeType(const std::string &path) const; }; -#endif /* __ZLQTFSMANAGER_H__ */ +#endif /* __ZLTQTFSMANAGER_H__ */ diff --git a/zlibrary/core/src/ui/image/ZLTQtImageManager.cpp b/zlibrary/core/src/ui/image/ZLTQtImageManager.cpp new file mode 100644 index 0000000..c72b61e --- /dev/null +++ b/zlibrary/core/src/ui/image/ZLTQtImageManager.cpp @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2004-2012 Geometer Plus <[email protected]> + * + * 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 <ZLImage.h> + +#include "ZLTQtImageManager.h" + +void ZLTQtImageData::init(unsigned int width, unsigned int height) { + create(width, height, 32); +} + +void ZLTQtImageData::setPosition(unsigned int x, unsigned int y) { + myX = x; + myY = y; +} + +void ZLTQtImageData::moveX(int delta) { + myX += delta; +} + +void ZLTQtImageData::moveY(int delta) { + myY += delta; +} + +void ZLTQtImageData::setPixel(unsigned char r, unsigned char g, unsigned char b) { + TQImage::setPixel(myX, myY, tqRgb(r, g, b)); +} + +void ZLTQtImageData::copyFrom(const ZLImageData &source, unsigned int targetX, unsigned int targetY) { + bitBlt(this, targetX, targetY, (const ZLTQtImageData*)&source, 0, 0); +} + +shared_ptr<ZLImageData> ZLTQtImageManager::createData() const { + return new ZLTQtImageData(); +} + +bool ZLTQtImageManager::convertImageDirect(const std::string &stringData, ZLImageData &data) const { + return ((ZLTQtImageData&)data).loadFromData((const unsigned char*)stringData.data(), stringData.length()); +} + +shared_ptr<const ZLImage> ZLTQtImageManager::makeBatchImage(const std::vector<shared_ptr<const ZLImage> > &images, shared_ptr<const ZLImage> defaultImage) const { + return defaultImage; +} diff --git a/zlibrary/ui/src/qt/image/ZLQtImageManager.h b/zlibrary/core/src/ui/image/ZLTQtImageManager.h index ea5576a..1914cc3 100644 --- a/zlibrary/ui/src/qt/image/ZLQtImageManager.h +++ b/zlibrary/core/src/ui/image/ZLTQtImageManager.h @@ -17,24 +17,24 @@ * 02110-1301, USA. */ -#ifndef __ZLQTIMAGEMANAGER_H__ -#define __ZLQTIMAGEMANAGER_H__ +#ifndef __ZLTQTIMAGEMANAGER_H__ +#define __ZLTQTIMAGEMANAGER_H__ #include <map> -#include <qimage.h> +#include <tqimage.h> #include <ZLImageManager.h> class ZLImage; -class ZLQtImageData : public ZLImageData, public QImage { +class ZLTQtImageData : public ZLImageData, public TQImage { public: - ZLQtImageData() : QImage(), myX(0), myY(0) {} - ~ZLQtImageData() {} + ZLTQtImageData() : TQImage(), myX(0), myY(0) {} + ~ZLTQtImageData() {} - unsigned int width() const { return QImage::width(); } - unsigned int height() const { return QImage::height(); } + unsigned int width() const { return TQImage::width(); } + unsigned int height() const { return TQImage::height(); } void init(unsigned int width, unsigned int height); void setPosition(unsigned int x, unsigned int y); @@ -47,21 +47,23 @@ public: private: unsigned int myX, myY; -friend class ZLQtImageManager; +friend class ZLTQtImageManager; }; -class ZLQtImageManager : public ZLImageManager { +class ZLTQtImageManager : public ZLImageManager { public: - static void createInstance() { ourInstance = new ZLQtImageManager(); } + static void createInstance() { ourInstance = new ZLTQtImageManager(); } private: - ZLQtImageManager() {} + ZLTQtImageManager() {} protected: - ~ZLQtImageManager() {} + ~ZLTQtImageManager() {} shared_ptr<ZLImageData> createData() const; bool convertImageDirect(const std::string &stringData, ZLImageData &imageData) const; + + shared_ptr<const ZLImage> makeBatchImage(const std::vector<shared_ptr<const ZLImage> > &images, shared_ptr<const ZLImage> defaultImage) const; }; -#endif /* __ZLQTIMAGEMANAGER_H__ */ +#endif /* __ZLTQTIMAGEMANAGER_H__ */ diff --git a/zlibrary/core/src/ui/library/ZLibrary.cpp b/zlibrary/core/src/ui/library/ZLibrary.cpp index 0780910..54f031d 100644 --- a/zlibrary/core/src/ui/library/ZLibrary.cpp +++ b/zlibrary/core/src/ui/library/ZLibrary.cpp @@ -25,6 +25,17 @@ #include "../../unix/library/ZLibraryImplementation.h" +#include "../filesystem/ZLTQtFSManager.h" +#include "../dialogs/ZLTQtDialogManager.h" +#include "../image/ZLTQtImageManager.h" +#include "../time/ZLTQtTime.h" +#include "../view/ZLTQtPaintContext.h" +#include "../../encoding/ZLEncodingConverter.h" +#include "../../unix/iconv/IConvEncodingConverter.h" +#include "../../unix/message/ZLUnixMessage.h" +#include "../../unix/xmlconfig/XMLConfig.h" +#include "../../util/ZLKeyUtil.h" + class ZLTQtLibraryImplementation : public ZLibraryImplementation { private: @@ -34,14 +45,33 @@ private: }; void initLibrary() { + new ZLTQtLibraryImplementation(); } void ZLTQtLibraryImplementation::init(int &argc, char **&argv) { + new TQApplication(argc, argv); + + ZLibrary::parseArguments(argc, argv); + + XMLConfigManager::createInstance(); + ZLTQtTimeManager::createInstance(); + ZLTQtFSManager::createInstance(); + ZLTQtDialogManager::createInstance(); + ZLUnixCommunicationManager::createInstance(); + ZLTQtImageManager::createInstance(); + ZLEncodingCollection::Instance().registerProvider(new IConvEncodingConverterProvider()); + + ZLKeyUtil::setKeyNamesFileName("keynames-qt.xml"); } ZLPaintContext *ZLTQtLibraryImplementation::createContext() { - return 0; + return new ZLTQtPaintContext(); } void ZLTQtLibraryImplementation::run(ZLApplication *application) { + tqApp->setReverseLayout(ZLLanguageUtil::isRTLLanguage(ZLibrary::Language())); + ZLDialogManager::Instance().createApplicationWindow(application); + application->initWindow(); + tqApp->exec(); + delete application; } diff --git a/zlibrary/ui/src/qt/time/ZLQtTime.cpp b/zlibrary/core/src/ui/time/ZLTQtTime.cpp index 26ca5c4..8c3865a 100644 --- a/zlibrary/ui/src/qt/time/ZLQtTime.cpp +++ b/zlibrary/core/src/ui/time/ZLTQtTime.cpp @@ -17,9 +17,9 @@ * 02110-1301, USA. */ -#include "ZLQtTime.h" +#include "ZLTQtTime.h" -void ZLQtTimeManager::addTask(shared_ptr<ZLRunnable> task, int interval) { +void ZLTQtTimeManager::addTask(shared_ptr<ZLRunnable> task, int interval) { removeTask(task); if ((interval > 0) && !task.isNull()) { int id = startTimer(interval); @@ -28,7 +28,7 @@ void ZLQtTimeManager::addTask(shared_ptr<ZLRunnable> task, int interval) { } } -void ZLQtTimeManager::removeTaskInternal(shared_ptr<ZLRunnable> task) { +void ZLTQtTimeManager::removeTaskInternal(shared_ptr<ZLRunnable> task) { std::map<shared_ptr<ZLRunnable>,int>::iterator it = myTimers.find(task); if (it != myTimers.end()) { killTimer(it->second); @@ -37,6 +37,6 @@ void ZLQtTimeManager::removeTaskInternal(shared_ptr<ZLRunnable> task) { } } -void ZLQtTimeManager::timerEvent(QTimerEvent *event) { +void ZLTQtTimeManager::timerEvent(TQTimerEvent *event) { myTasks[event->timerId()]->run(); } diff --git a/zlibrary/ui/src/qt/time/ZLQtTime.h b/zlibrary/core/src/ui/time/ZLTQtTime.h index 6f68438..36519a2 100644 --- a/zlibrary/ui/src/qt/time/ZLQtTime.h +++ b/zlibrary/core/src/ui/time/ZLTQtTime.h @@ -17,29 +17,29 @@ * 02110-1301, USA. */ -#ifndef __ZLQTTIME_H__ -#define __ZLQTTIME_H__ +#ifndef __ZLTQTTIME_H__ +#define __ZLTQTTIME_H__ #include <map> -#include <qobject.h> +#include <tqobject.h> #include "../../../../core/src/unix/time/ZLUnixTime.h" -class ZLQtTimeManager : public QObject, public ZLUnixTimeManager { +class ZLTQtTimeManager : public TQObject, public ZLUnixTimeManager { public: - static void createInstance() { ourInstance = new ZLQtTimeManager(); } + static void createInstance() { ourInstance = new ZLTQtTimeManager(); } void addTask(shared_ptr<ZLRunnable> task, int interval); void removeTaskInternal(shared_ptr<ZLRunnable> task); private: - void timerEvent(QTimerEvent *event); + void timerEvent(TQTimerEvent *event); private: std::map<shared_ptr<ZLRunnable>,int> myTimers; std::map<int,shared_ptr<ZLRunnable> > myTasks; }; -#endif /* __ZLQTTIME_H__ */ +#endif /* __ZLTQTTIME_H__ */ diff --git a/zlibrary/ui/src/qt/util/ZLQtKeyUtil.cpp b/zlibrary/core/src/ui/util/ZLTQtKeyUtil.cpp index 8c3065d..7075adb 100644 --- a/zlibrary/ui/src/qt/util/ZLQtKeyUtil.cpp +++ b/zlibrary/core/src/ui/util/ZLTQtKeyUtil.cpp @@ -19,13 +19,13 @@ #include <cctype> -#include <qevent.h> +#include <tqevent.h> #include <ZLUnicodeUtil.h> -#include "ZLQtKeyUtil.h" +#include "ZLTQtKeyUtil.h" -std::string ZLQtKeyUtil::keyName(QKeyEvent *keyEvent) { +std::string ZLTQtKeyUtil::keyName(TQKeyEvent *keyEvent) { ZLUnicodeUtil::Ucs2String s; ZLUnicodeUtil::utf8ToUcs2(s, (const char*)keyEvent->text().utf8()); int unicode = s.empty() ? 0 : s[0]; diff --git a/zlibrary/ui/src/qt/util/ZLQtKeyUtil.h b/zlibrary/core/src/ui/util/ZLTQtKeyUtil.h index 9c6e1ce..81f6031 100644 --- a/zlibrary/ui/src/qt/util/ZLQtKeyUtil.h +++ b/zlibrary/core/src/ui/util/ZLTQtKeyUtil.h @@ -17,17 +17,17 @@ * 02110-1301, USA. */ -#ifndef __ZLQTKEYUTIL_H__ -#define __ZLQTKEYUTIL_H__ +#ifndef __ZLTQTKEYUTIL_H__ +#define __ZLTQTKEYUTIL_H__ #include "../../../../core/src/util/ZLKeyUtil.h" -class QKeyEvent; +class TQKeyEvent; -class ZLQtKeyUtil : public ZLKeyUtil { +class ZLTQtKeyUtil : public ZLKeyUtil { public: - static std::string keyName(QKeyEvent *event); + static std::string keyName(TQKeyEvent *event); }; -#endif /* __ZLQTKEYUTIL_H__ */ +#endif /* __ZLTQTKEYUTIL_H__ */ diff --git a/zlibrary/ui/src/qt/view/ZLQtPaintContext.cpp b/zlibrary/core/src/ui/view/ZLTQtPaintContext.cpp index ce1d297..db55c55 100644 --- a/zlibrary/ui/src/qt/view/ZLQtPaintContext.cpp +++ b/zlibrary/core/src/ui/view/ZLTQtPaintContext.cpp @@ -17,26 +17,26 @@ * 02110-1301, USA. */ -#include <qpainter.h> -#include <qpixmap.h> -#include <qfontmetrics.h> -#include <qfontdatabase.h> -#include <qimage.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqfontmetrics.h> +#include <tqfontdatabase.h> +#include <tqimage.h> #include <ZLImage.h> -#include "ZLQtPaintContext.h" -#include "../image/ZLQtImageManager.h" +#include "ZLTQtPaintContext.h" +#include "../image/ZLTQtImageManager.h" -ZLQtPaintContext::ZLQtPaintContext() { - myPainter = new QPainter(); +ZLTQtPaintContext::ZLTQtPaintContext() { + myPainter = new TQPainter(); myPixmap = 0; mySpaceWidth = -1; myDescent = 0; myFontIsStored = false; } -ZLQtPaintContext::~ZLQtPaintContext() { +ZLTQtPaintContext::~ZLTQtPaintContext() { if (myPixmap != 0) { myPainter->end(); delete myPixmap; @@ -44,7 +44,7 @@ ZLQtPaintContext::~ZLQtPaintContext() { delete myPainter; } -void ZLQtPaintContext::setSize(int w, int h) { +void ZLTQtPaintContext::setSize(int w, int h) { if (myPixmap != 0) { if ((myPixmap->width() != w) || (myPixmap->height() != h)) { myPainter->end(); @@ -53,7 +53,7 @@ void ZLQtPaintContext::setSize(int w, int h) { } } if ((myPixmap == 0) && (w > 0) && (h > 0)) { - myPixmap = new QPixmap(w, h); + myPixmap = new TQPixmap(w, h); myPainter->begin(myPixmap); if (myFontIsStored) { myFontIsStored = false; @@ -64,11 +64,11 @@ void ZLQtPaintContext::setSize(int w, int h) { static const std::string HELVETICA = "Helvetica"; -void ZLQtPaintContext::fillFamiliesList(std::vector<std::string> &families) const { - QFontDatabase db; - QStringList qFamilies = db.families(); +void ZLTQtPaintContext::fillFamiliesList(std::vector<std::string> &families) const { + TQFontDatabase db; + TQStringList qFamilies = db.families(); bool helveticaFlag = false; - for (QStringList::Iterator it = qFamilies.begin(); it != qFamilies.end(); ++it) { + for (TQStringList::Iterator it = qFamilies.begin(); it != qFamilies.end(); ++it) { std::string family = (const char*)(*it).utf8(); if (family == HELVETICA) { helveticaFlag = true; @@ -80,18 +80,15 @@ void ZLQtPaintContext::fillFamiliesList(std::vector<std::string> &families) cons } } -const std::string ZLQtPaintContext::realFontFamilyName(std::string &fontFamily) const { - QString fullName = QFontInfo(QFont(fontFamily.c_str())).family(); +const std::string ZLTQtPaintContext::realFontFamilyName(std::string &fontFamily) const { + TQString fullName = TQFontInfo(TQFont(fontFamily.c_str())).family(); if (fullName.isNull() || fullName.isEmpty()) { - fullName = QFontInfo(QFont::defaultFont()).family(); - if (fullName.isNull() || fullName.isEmpty()) { - return HELVETICA; - } + return HELVETICA; } return fullName.left(fullName.find(" [")).ascii(); } -void ZLQtPaintContext::setFont(const std::string &family, int size, bool bold, bool italic) { +void ZLTQtPaintContext::setFont(const std::string &family, int size, bool bold, bool italic) { if (myPainter->device() == 0) { myFontIsStored = true; myStoredFamily = family; @@ -99,7 +96,7 @@ void ZLQtPaintContext::setFont(const std::string &family, int size, bool bold, b myStoredBold = bold; myStoredItalic= italic; } else { - QFont font = myPainter->font(); + TQFont font = myPainter->font(); bool fontChanged = false; if (font.family() != family.c_str()) { @@ -112,8 +109,8 @@ void ZLQtPaintContext::setFont(const std::string &family, int size, bool bold, b fontChanged = true; } - if ((font.weight() != (bold ? QFont::Bold : QFont::Normal))) { - font.setWeight(bold ? QFont::Bold : QFont::Normal); + if ((font.weight() != (bold ? TQFont::Bold : TQFont::Normal))) { + font.setWeight(bold ? TQFont::Bold : TQFont::Normal); fontChanged = true; } @@ -130,65 +127,65 @@ void ZLQtPaintContext::setFont(const std::string &family, int size, bool bold, b } } -void ZLQtPaintContext::setColor(ZLColor color, LineStyle style) { - myPainter->setPen(QPen( - QColor(color.Red, color.Green, color.Blue), +void ZLTQtPaintContext::setColor(ZLColor color, LineStyle style) { + myPainter->setPen(TQPen( + TQColor(color.Red, color.Green, color.Blue), 1, - (style == SOLID_LINE) ? QPainter::SolidLine : QPainter::DashLine + (style == SOLID_LINE) ? TQPainter::SolidLine : TQPainter::DashLine )); } -void ZLQtPaintContext::setFillColor(ZLColor color, FillStyle style) { - myPainter->setBrush(QBrush( - QColor(color.Red, color.Green, color.Blue), - (style == SOLID_FILL) ? QPainter::SolidPattern : QPainter::Dense4Pattern +void ZLTQtPaintContext::setFillColor(ZLColor color, FillStyle style) { + myPainter->setBrush(TQBrush( + TQColor(color.Red, color.Green, color.Blue), + (style == SOLID_FILL) ? TQPainter::SolidPattern : TQPainter::Dense4Pattern )); } -int ZLQtPaintContext::stringWidth(const char *str, int len, bool) const { - return myPainter->fontMetrics().width(QString::fromUtf8(str, len)); +int ZLTQtPaintContext::stringWidth(const char *str, int len, bool) const { + return myPainter->fontMetrics().width(TQString::fromUtf8(str, len)); } -int ZLQtPaintContext::spaceWidth() const { +int ZLTQtPaintContext::spaceWidth() const { if (mySpaceWidth == -1) { mySpaceWidth = myPainter->fontMetrics().width(' '); } return mySpaceWidth; } -int ZLQtPaintContext::descent() const { +int ZLTQtPaintContext::descent() const { return myDescent; } -int ZLQtPaintContext::stringHeight() const { +int ZLTQtPaintContext::stringHeight() const { return myPainter->font().pointSize() + 2; } -void ZLQtPaintContext::drawString(int x, int y, const char *str, int len, bool rtl) { - QString qStr = QString::fromUtf8(str, len); - myPainter->drawText(x, y, qStr, 0, len, rtl ? QPainter::RTL : QPainter::LTR); +void ZLTQtPaintContext::drawString(int x, int y, const char *str, int len, bool rtl) { + TQString qStr = TQString::fromUtf8(str, len); + myPainter->drawText(x, y, qStr, 0, len, rtl ? TQPainter::RTL : TQPainter::LTR); } -void ZLQtPaintContext::drawImage(int x, int y, const ZLImageData &image) { - const QImage &qImage = (ZLQtImageData&)image; +void ZLTQtPaintContext::drawImage(int x, int y, const ZLImageData &image) { + const TQImage &qImage = (ZLTQtImageData&)image; myPainter->drawImage(x, y - qImage.height(), qImage); } -void ZLQtPaintContext::drawImage(int x, int y, const ZLImageData &image, int width, int height, ScalingType type) { - const QImage &qImage = (ZLQtImageData&)image; - const QImage &scaled = qImage.smoothScale(imageWidth(image, width, height, type), imageHeight(image, width, height, type), QImage::ScaleMin); +void ZLTQtPaintContext::drawImage(int x, int y, const ZLImageData &image, int width, int height, ScalingType type) { + const TQImage &qImage = (ZLTQtImageData&)image; + const TQImage &scaled = qImage.smoothScale(imageWidth(image, width, height, type), imageHeight(image, width, height, type), TQImage::ScaleMin); if (qImage != 0) { myPainter->drawImage(x, y - scaled.height(), scaled); } } -void ZLQtPaintContext::drawLine(int x0, int y0, int x1, int y1) { +void ZLTQtPaintContext::drawLine(int x0, int y0, int x1, int y1) { myPainter->drawPoint(x0, y0); myPainter->drawLine(x0, y0, x1, y1); myPainter->drawPoint(x1, y1); } -void ZLQtPaintContext::fillRectangle(int x0, int y0, int x1, int y1) { +void ZLTQtPaintContext::fillRectangle(int x0, int y0, int x1, int y1) { if (x1 < x0) { int tmp = x1; x1 = x0; @@ -204,24 +201,24 @@ void ZLQtPaintContext::fillRectangle(int x0, int y0, int x1, int y1) { myPainter->brush()); } -void ZLQtPaintContext::drawFilledCircle(int x, int y, int r) { +void ZLTQtPaintContext::drawFilledCircle(int x, int y, int r) { myPainter->drawEllipse(x - r, y - r, 2 * r + 1, 2 * r + 1); } -void ZLQtPaintContext::clear(ZLColor color) { +void ZLTQtPaintContext::clear(ZLColor color) { if (myPixmap != 0) { - myPixmap->fill(QColor(color.Red, color.Green, color.Blue)); + myPixmap->fill(TQColor(color.Red, color.Green, color.Blue)); } } -int ZLQtPaintContext::width() const { +int ZLTQtPaintContext::width() const { if (myPixmap == 0) { return 0; } return myPixmap->width(); } -int ZLQtPaintContext::height() const { +int ZLTQtPaintContext::height() const { if (myPixmap == 0) { return 0; } diff --git a/zlibrary/ui/src/qt/view/ZLQtPaintContext.h b/zlibrary/core/src/ui/view/ZLTQtPaintContext.h index 3c4b4f7..6b28a2d 100644 --- a/zlibrary/ui/src/qt/view/ZLQtPaintContext.h +++ b/zlibrary/core/src/ui/view/ZLTQtPaintContext.h @@ -17,21 +17,21 @@ * 02110-1301, USA. */ -#ifndef __ZLQTPAINTCONTEXT_H__ -#define __ZLQTPAINTCONTEXT_H__ +#ifndef __ZLTQTPAINTCONTEXT_H__ +#define __ZLTQTPAINTCONTEXT_H__ #include <ZLPaintContext.h> -class QPainter; -class QPixmap; +class TQPainter; +class TQPixmap; -class ZLQtPaintContext : public ZLPaintContext { +class ZLTQtPaintContext : public ZLPaintContext { public: - ZLQtPaintContext(); - ~ZLQtPaintContext(); + ZLTQtPaintContext(); + ~ZLTQtPaintContext(); - const QPixmap &pixmap() const { return *myPixmap; } + const TQPixmap &pixmap() const { return *myPixmap; } void setSize(int w, int h); @@ -61,8 +61,8 @@ public: void drawFilledCircle(int x, int y, int r); private: - QPainter *myPainter; - QPixmap *myPixmap; + TQPainter *myPainter; + TQPixmap *myPixmap; mutable int mySpaceWidth; int myDescent; @@ -73,4 +73,4 @@ private: bool myStoredItalic; }; -#endif /* __ZLQTPAINTCONTEXT_H__ */ +#endif /* __ZLTQTPAINTCONTEXT_H__ */ diff --git a/zlibrary/ui/src/qt/view/ZLQtViewWidget.cpp b/zlibrary/core/src/ui/view/ZLTQtViewWidget.cpp index 630f7c2..519d403 100644 --- a/zlibrary/ui/src/qt/view/ZLQtViewWidget.cpp +++ b/zlibrary/core/src/ui/view/ZLTQtViewWidget.cpp @@ -17,74 +17,74 @@ * 02110-1301, USA. */ -#include <qpainter.h> -#include <qpixmap.h> -#include <qlayout.h> -#include <qframe.h> -#include <qscrollbar.h> +#include <tqpainter.h> +#include <tqpixmap.h> +#include <tqlayout.h> +#include <tqframe.h> +#include <tqscrollbar.h> #include <ZLibrary.h> #include <ZLLanguageUtil.h> -#include "ZLQtViewWidget.h" -#include "ZLQtPaintContext.h" +#include "ZLTQtViewWidget.h" +#include "ZLTQtPaintContext.h" -ZLQtViewWidget::ZLQtViewWidgetInternal::ZLQtViewWidgetInternal(QWidget *parent, ZLQtViewWidget &holder) : QWidget(parent), myHolder(holder) { +ZLTQtViewWidget::ZLTQtViewWidgetInternal::ZLTQtViewWidgetInternal(TQWidget *parent, ZLTQtViewWidget &holder) : TQWidget(parent), myHolder(holder) { setBackgroundMode(NoBackground); setFocusPolicy(ClickFocus); } -QScrollBar *ZLQtViewWidget::addScrollBar(QGridLayout *layout, Qt::Orientation orientation, int x, int y) { - QScrollBar *scrollBar = new QScrollBar(orientation, myFrame); +TQScrollBar *ZLTQtViewWidget::addScrollBar(TQGridLayout *layout, TQt::Orientation orientation, int x, int y) { + TQScrollBar *scrollBar = new TQScrollBar(orientation, myFrame); layout->addWidget(scrollBar, x, y); scrollBar->hide(); - if (orientation == Qt::Vertical) { - connect(scrollBar, SIGNAL(sliderMoved(int)), this, SLOT(onVerticalSliderMoved(int))); - connect(scrollBar, SIGNAL(nextLine()), this, SLOT(onVerticalSliderStepNext())); - connect(scrollBar, SIGNAL(nextPage()), this, SLOT(onVerticalSliderPageNext())); - connect(scrollBar, SIGNAL(prevLine()), this, SLOT(onVerticalSliderStepPrevious())); - connect(scrollBar, SIGNAL(prevPage()), this, SLOT(onVerticalSliderPagePrevious())); + if (orientation == TQt::Vertical) { + connect(scrollBar, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(onVerticalSliderMoved(int))); + connect(scrollBar, TQ_SIGNAL(nextLine()), this, TQ_SLOT(onVerticalSliderStepNext())); + connect(scrollBar, TQ_SIGNAL(nextPage()), this, TQ_SLOT(onVerticalSliderPageNext())); + connect(scrollBar, TQ_SIGNAL(prevLine()), this, TQ_SLOT(onVerticalSliderStepPrevious())); + connect(scrollBar, TQ_SIGNAL(prevPage()), this, TQ_SLOT(onVerticalSliderPagePrevious())); } else { - connect(scrollBar, SIGNAL(sliderMoved(int)), this, SLOT(onHorizontalSliderMoved(int))); - connect(scrollBar, SIGNAL(nextLine()), this, SLOT(onHorizontalSliderStepNext())); - connect(scrollBar, SIGNAL(nextPage()), this, SLOT(onHorizontalSliderPageNext())); - connect(scrollBar, SIGNAL(prevLine()), this, SLOT(onHorizontalSliderStepPrevious())); - connect(scrollBar, SIGNAL(prevPage()), this, SLOT(onHorizontalSliderPagePrevious())); + connect(scrollBar, TQ_SIGNAL(sliderMoved(int)), this, TQ_SLOT(onHorizontalSliderMoved(int))); + connect(scrollBar, TQ_SIGNAL(nextLine()), this, TQ_SLOT(onHorizontalSliderStepNext())); + connect(scrollBar, TQ_SIGNAL(nextPage()), this, TQ_SLOT(onHorizontalSliderPageNext())); + connect(scrollBar, TQ_SIGNAL(prevLine()), this, TQ_SLOT(onHorizontalSliderStepPrevious())); + connect(scrollBar, TQ_SIGNAL(prevPage()), this, TQ_SLOT(onHorizontalSliderPagePrevious())); } return scrollBar; } -ZLQtViewWidget::ZLQtViewWidget(QWidget *parent, ZLApplication *application, const ZLQtViewWidgetPositionInfo &positionInfo) : ZLViewWidget((ZLView::Angle)application->AngleStateOption.value()), myApplication(application), myPositionInfo(positionInfo) { - myFrame = new QFrame(parent); - QGridLayout *layout = new QGridLayout(myFrame, 3, 3); +ZLTQtViewWidget::ZLTQtViewWidget(TQWidget *parent, ZLApplication *application, const ZLTQtViewWidgetPositionInfo &positionInfo) : ZLViewWidget((ZLView::Angle)application->AngleStateOption.value()), myApplication(application), myPositionInfo(positionInfo) { + myFrame = new TQFrame(parent); + TQGridLayout *layout = new TQGridLayout(myFrame, 3, 3); layout->setRowStretch(0, 0); layout->setRowStretch(1, 1); layout->setRowStretch(2, 0); layout->setColStretch(0, 0); layout->setColStretch(1, 1); layout->setColStretch(2, 0); - myQWidget = new ZLQtViewWidgetInternal(myFrame, *this); - layout->addWidget(myQWidget, 1, 1); + myTQWidget = new ZLTQtViewWidgetInternal(myFrame, *this); + layout->addWidget(myTQWidget, 1, 1); - myRightScrollBar = addScrollBar(layout, Qt::Vertical, 1, 2); - myLeftScrollBar = addScrollBar(layout, Qt::Vertical, 1, 0); + myRightScrollBar = addScrollBar(layout, TQt::Vertical, 1, 2); + myLeftScrollBar = addScrollBar(layout, TQt::Vertical, 1, 0); myShowScrollBarAtRight = true; - myBottomScrollBar = addScrollBar(layout, Qt::Horizontal, 2, 1); - myTopScrollBar = addScrollBar(layout, Qt::Horizontal, 0, 1); + myBottomScrollBar = addScrollBar(layout, TQt::Horizontal, 2, 1); + myTopScrollBar = addScrollBar(layout, TQt::Horizontal, 0, 1); myShowScrollBarAtBottom = true; } -const ZLQtViewWidgetPositionInfo &ZLQtViewWidget::positionInfo() const { +const ZLTQtViewWidgetPositionInfo &ZLTQtViewWidget::positionInfo() const { return myPositionInfo; } -void ZLQtViewWidget::trackStylus(bool track) { - myQWidget->setMouseTracking(track); +void ZLTQtViewWidget::trackStylus(bool track) { + myTQWidget->setMouseTracking(track); } -void ZLQtViewWidget::ZLQtViewWidgetInternal::paintEvent(QPaintEvent*) { - ZLQtPaintContext &context = (ZLQtPaintContext&)myHolder.view()->context(); +void ZLTQtViewWidget::ZLTQtViewWidgetInternal::paintEvent(TQPaintEvent*) { + ZLTQtPaintContext &context = (ZLTQtPaintContext&)myHolder.view()->context(); switch (myHolder.rotation()) { default: context.setSize(width(), height()); @@ -95,7 +95,7 @@ void ZLQtViewWidget::ZLQtViewWidgetInternal::paintEvent(QPaintEvent*) { break; } myHolder.view()->paint(); - QPainter realPainter(this); + TQPainter realPainter(this); switch (myHolder.rotation()) { default: realPainter.drawPixmap(0, 0, context.pixmap()); @@ -115,16 +115,16 @@ void ZLQtViewWidget::ZLQtViewWidgetInternal::paintEvent(QPaintEvent*) { } } -void ZLQtViewWidget::ZLQtViewWidgetInternal::mousePressEvent(QMouseEvent *event) { +void ZLTQtViewWidget::ZLTQtViewWidgetInternal::mousePressEvent(TQMouseEvent *event) { myHolder.view()->onStylusMove(x(event), y(event)); myHolder.view()->onStylusPress(x(event), y(event)); } -void ZLQtViewWidget::ZLQtViewWidgetInternal::mouseReleaseEvent(QMouseEvent *event) { +void ZLTQtViewWidget::ZLTQtViewWidgetInternal::mouseReleaseEvent(TQMouseEvent *event) { myHolder.view()->onStylusRelease(x(event), y(event)); } -void ZLQtViewWidget::ZLQtViewWidgetInternal::mouseMoveEvent(QMouseEvent *event) { +void ZLTQtViewWidget::ZLTQtViewWidgetInternal::mouseMoveEvent(TQMouseEvent *event) { switch (event->state() & MouseButtonMask) { case LeftButton: myHolder.view()->onStylusMovePressed(x(event), y(event)); @@ -137,7 +137,7 @@ void ZLQtViewWidget::ZLQtViewWidgetInternal::mouseMoveEvent(QMouseEvent *event) } } -int ZLQtViewWidget::ZLQtViewWidgetInternal::x(const QMouseEvent *event) const { +int ZLTQtViewWidget::ZLTQtViewWidgetInternal::x(const TQMouseEvent *event) const { const int maxX = width() - 1; const int maxY = height() - 1; switch (myHolder.rotation()) { @@ -152,7 +152,7 @@ int ZLQtViewWidget::ZLQtViewWidgetInternal::x(const QMouseEvent *event) const { } } -int ZLQtViewWidget::ZLQtViewWidgetInternal::y(const QMouseEvent *event) const { +int ZLTQtViewWidget::ZLTQtViewWidgetInternal::y(const TQMouseEvent *event) const { const int maxX = width() - 1; const int maxY = height() - 1; switch (myHolder.rotation()) { @@ -167,17 +167,17 @@ int ZLQtViewWidget::ZLQtViewWidgetInternal::y(const QMouseEvent *event) const { } } -void ZLQtViewWidget::repaint() { - myQWidget->repaint(false); +void ZLTQtViewWidget::repaint() { + myTQWidget->repaint(false); } -void ZLQtViewWidget::ZLQtViewWidgetInternal::resizeEvent(QResizeEvent*) { +void ZLTQtViewWidget::ZLTQtViewWidgetInternal::resizeEvent(TQResizeEvent*) { /* - const ZLQtViewWidgetPositionInfo &info = myHolder.positionInfo(); + const ZLTQtViewWidgetPositionInfo &info = myHolder.positionInfo(); const int x = info.x(); const int y = info.y(); - const QPoint position = pos(); + const TQPoint position = pos(); if ((x != position.x()) || (y != position.y())) { move(x, y); } @@ -190,7 +190,7 @@ void ZLQtViewWidget::ZLQtViewWidgetInternal::resizeEvent(QResizeEvent*) { */ } -void ZLQtViewWidget::setScrollbarEnabled(ZLView::Direction direction, bool enabled) { +void ZLTQtViewWidget::setScrollbarEnabled(ZLView::Direction direction, bool enabled) { if (direction == ZLView::VERTICAL) { myRightScrollBar->setShown(enabled && myShowScrollBarAtRight); myLeftScrollBar->setShown(enabled && !myShowScrollBarAtRight); @@ -200,7 +200,7 @@ void ZLQtViewWidget::setScrollbarEnabled(ZLView::Direction direction, bool enabl } } -void ZLQtViewWidget::setScrollbarPlacement(ZLView::Direction direction, bool standard) { +void ZLTQtViewWidget::setScrollbarPlacement(ZLView::Direction direction, bool standard) { if ((rotation() == ZLView::DEGREES90) || (rotation() == ZLView::DEGREES270)) { if (ZLLanguageUtil::isRTLLanguage(ZLibrary::Language())) { standard = !standard; @@ -209,8 +209,8 @@ void ZLQtViewWidget::setScrollbarPlacement(ZLView::Direction direction, bool sta if (direction == ZLView::VERTICAL) { if (standard != myShowScrollBarAtRight) { myShowScrollBarAtRight = standard; - QScrollBar *old = standard ? myLeftScrollBar : myRightScrollBar; - QScrollBar *current = standard ? myRightScrollBar : myLeftScrollBar; + TQScrollBar *old = standard ? myLeftScrollBar : myRightScrollBar; + TQScrollBar *current = standard ? myRightScrollBar : myLeftScrollBar; if (old->isShown()) { old->hide(); current->show(); @@ -219,8 +219,8 @@ void ZLQtViewWidget::setScrollbarPlacement(ZLView::Direction direction, bool sta } else { if (standard != myShowScrollBarAtBottom) { myShowScrollBarAtBottom = standard; - QScrollBar *old = standard ? myTopScrollBar : myBottomScrollBar; - QScrollBar *current = standard ? myBottomScrollBar : myTopScrollBar; + TQScrollBar *old = standard ? myTopScrollBar : myBottomScrollBar; + TQScrollBar *current = standard ? myBottomScrollBar : myTopScrollBar; if (old->isShown()) { old->hide(); current->show(); @@ -229,8 +229,8 @@ void ZLQtViewWidget::setScrollbarPlacement(ZLView::Direction direction, bool sta } } -void ZLQtViewWidget::setScrollbarParameters(ZLView::Direction direction, size_t full, size_t from, size_t to) { - QScrollBar *bar = +void ZLTQtViewWidget::setScrollbarParameters(ZLView::Direction direction, size_t full, size_t from, size_t to) { + TQScrollBar *bar = (direction == ZLView::VERTICAL) ? verticalScrollBar() : horizontalScrollBar(); bar->setMinValue(0); bar->setMaxValue(full + from - to); @@ -238,12 +238,12 @@ void ZLQtViewWidget::setScrollbarParameters(ZLView::Direction direction, size_t bar->setPageStep(to - from); } -QWidget *ZLQtViewWidget::widget() const { +TQWidget *ZLTQtViewWidget::widget() const { return myFrame; } -void ZLQtViewWidget::onVerticalSliderMoved(int value) { - QScrollBar *bar = verticalScrollBar(); +void ZLTQtViewWidget::onVerticalSliderMoved(int value) { + TQScrollBar *bar = verticalScrollBar(); size_t maxValue = bar->maxValue(); size_t pageStep = bar->pageStep(); onScrollbarMoved( @@ -254,24 +254,24 @@ void ZLQtViewWidget::onVerticalSliderMoved(int value) { ); } -void ZLQtViewWidget::onVerticalSliderStepNext() { +void ZLTQtViewWidget::onVerticalSliderStepNext() { onScrollbarStep(ZLView::VERTICAL, 1); } -void ZLQtViewWidget::onVerticalSliderStepPrevious() { +void ZLTQtViewWidget::onVerticalSliderStepPrevious() { onScrollbarStep(ZLView::VERTICAL, -1); } -void ZLQtViewWidget::onVerticalSliderPageNext() { +void ZLTQtViewWidget::onVerticalSliderPageNext() { onScrollbarPageStep(ZLView::VERTICAL, 1); } -void ZLQtViewWidget::onVerticalSliderPagePrevious() { +void ZLTQtViewWidget::onVerticalSliderPagePrevious() { onScrollbarPageStep(ZLView::VERTICAL, -1); } -void ZLQtViewWidget::onHorizontalSliderMoved(int value) { - QScrollBar *bar = horizontalScrollBar(); +void ZLTQtViewWidget::onHorizontalSliderMoved(int value) { + TQScrollBar *bar = horizontalScrollBar(); size_t maxValue = bar->maxValue(); size_t pageStep = bar->pageStep(); onScrollbarMoved( @@ -282,26 +282,28 @@ void ZLQtViewWidget::onHorizontalSliderMoved(int value) { ); } -void ZLQtViewWidget::onHorizontalSliderStepNext() { +void ZLTQtViewWidget::onHorizontalSliderStepNext() { onScrollbarStep(ZLView::HORIZONTAL, 1); } -void ZLQtViewWidget::onHorizontalSliderStepPrevious() { +void ZLTQtViewWidget::onHorizontalSliderStepPrevious() { onScrollbarStep(ZLView::HORIZONTAL, -1); } -void ZLQtViewWidget::onHorizontalSliderPageNext() { +void ZLTQtViewWidget::onHorizontalSliderPageNext() { onScrollbarPageStep(ZLView::HORIZONTAL, 1); } -void ZLQtViewWidget::onHorizontalSliderPagePrevious() { +void ZLTQtViewWidget::onHorizontalSliderPagePrevious() { onScrollbarPageStep(ZLView::HORIZONTAL, -1); } -QScrollBar *ZLQtViewWidget::verticalScrollBar() { +TQScrollBar *ZLTQtViewWidget::verticalScrollBar() { return myShowScrollBarAtRight ? myRightScrollBar : myLeftScrollBar; } -QScrollBar *ZLQtViewWidget::horizontalScrollBar() { +TQScrollBar *ZLTQtViewWidget::horizontalScrollBar() { return myShowScrollBarAtBottom ? myBottomScrollBar : myTopScrollBar; } + +#include "ZLTQtViewWidget.moc" diff --git a/zlibrary/ui/src/qt/view/ZLQtViewWidget.h b/zlibrary/core/src/ui/view/ZLTQtViewWidget.h index b3963e1..65d72c9 100644 --- a/zlibrary/ui/src/qt/view/ZLQtViewWidget.h +++ b/zlibrary/core/src/ui/view/ZLTQtViewWidget.h @@ -17,23 +17,23 @@ * 02110-1301, USA. */ -#ifndef __ZLQTVIEWWIDGET_H__ -#define __ZLQTVIEWWIDGET_H__ +#ifndef __ZLTQTVIEWWIDGET_H__ +#define __ZLTQTVIEWWIDGET_H__ -#include <qwidget.h> +#include <tqwidget.h> #include "../../../../core/src/view/ZLViewWidget.h" #include <ZLApplication.h> -class ZLQtApplicationWindow; -class QFrame; -class QScrollBar; -class QGridLayout; +class ZLTQtApplicationWindow; +class TQFrame; +class TQScrollBar; +class TQGridLayout; -class ZLQtViewWidgetPositionInfo { +class ZLTQtViewWidgetPositionInfo { public: - ZLQtViewWidgetPositionInfo(const ZLQtApplicationWindow &window); + ZLTQtViewWidgetPositionInfo(const ZLTQtApplicationWindow &window); int x() const; int y() const; @@ -41,36 +41,36 @@ public: int height() const; private: - const ZLQtApplicationWindow &myWindow; + const ZLTQtApplicationWindow &myWindow; }; -class ZLQtViewWidget : public QObject, public ZLViewWidget { - Q_OBJECT +class ZLTQtViewWidget : public TQObject, public ZLViewWidget { + TQ_OBJECT private: - class ZLQtViewWidgetInternal : public QWidget { + class ZLTQtViewWidgetInternal : public TQWidget { public: - ZLQtViewWidgetInternal(QWidget *parent, ZLQtViewWidget &holder); + ZLTQtViewWidgetInternal(TQWidget *parent, ZLTQtViewWidget &holder); private: - void paintEvent(QPaintEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - void resizeEvent(QResizeEvent *event); + void paintEvent(TQPaintEvent *event); + void mousePressEvent(TQMouseEvent *event); + void mouseReleaseEvent(TQMouseEvent *event); + void mouseMoveEvent(TQMouseEvent *event); + void resizeEvent(TQResizeEvent *event); - int x(const QMouseEvent *event) const; - int y(const QMouseEvent *event) const; + int x(const TQMouseEvent *event) const; + int y(const TQMouseEvent *event) const; private: - ZLQtViewWidget &myHolder; + ZLTQtViewWidget &myHolder; }; public: - ZLQtViewWidget(QWidget *parent, ZLApplication *application, const ZLQtViewWidgetPositionInfo &positionInfo); - QWidget *widget() const; - const ZLQtViewWidgetPositionInfo &positionInfo() const; + ZLTQtViewWidget(TQWidget *parent, ZLApplication *application, const ZLTQtViewWidgetPositionInfo &positionInfo); + TQWidget *widget() const; + const ZLTQtViewWidgetPositionInfo &positionInfo() const; private: void repaint(); @@ -80,9 +80,9 @@ private: void setScrollbarPlacement(ZLView::Direction direction, bool standard); void setScrollbarParameters(ZLView::Direction direction, size_t full, size_t from, size_t to); - QScrollBar *addScrollBar(QGridLayout *layout, Qt::Orientation orientation, int x, int y); - QScrollBar *verticalScrollBar(); - QScrollBar *horizontalScrollBar(); + TQScrollBar *addScrollBar(TQGridLayout *layout, TQt::Orientation orientation, int x, int y); + TQScrollBar *verticalScrollBar(); + TQScrollBar *horizontalScrollBar(); private slots: void onVerticalSliderMoved(int value); @@ -97,19 +97,19 @@ private slots: void onHorizontalSliderPagePrevious(); private: - ZLQtViewWidgetInternal *myQWidget; - QFrame *myFrame; + ZLTQtViewWidgetInternal *myTQWidget; + TQFrame *myFrame; - QScrollBar *myRightScrollBar; - QScrollBar *myLeftScrollBar; + TQScrollBar *myRightScrollBar; + TQScrollBar *myLeftScrollBar; bool myShowScrollBarAtRight; - QScrollBar *myBottomScrollBar; - QScrollBar *myTopScrollBar; + TQScrollBar *myBottomScrollBar; + TQScrollBar *myTopScrollBar; bool myShowScrollBarAtBottom; ZLApplication *myApplication; - const ZLQtViewWidgetPositionInfo myPositionInfo; + const ZLTQtViewWidgetPositionInfo myPositionInfo; }; -#endif /* __ZLQTVIEWWIDGET_H__ */ +#endif /* __ZLTQTVIEWWIDGET_H__ */ diff --git a/zlibrary/core/src/unix/message/ZLUnixMessage.cpp b/zlibrary/core/src/unix/message/ZLUnixMessage.cpp new file mode 100644 index 0000000..3df76cd --- /dev/null +++ b/zlibrary/core/src/unix/message/ZLUnixMessage.cpp @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2004-2012 Geometer Plus <[email protected]> + * + * 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 <unistd.h> +#include <cstdlib> + +#include <ZLFile.h> + +#include "ZLUnixMessage.h" + +ZLUnixCommunicationManager::ZLUnixCommunicationManager() { +} + +void ZLUnixCommunicationManager::createInstance() { + if (ourInstance == 0) { + ourInstance = new ZLUnixCommunicationManager(); + } +} + +shared_ptr<ZLMessageOutputChannel> ZLUnixCommunicationManager::createMessageOutputChannel(const std::string &protocol, const std::string &testFile) { + if (protocol != "execute") { + return 0; + } + + if (!testFile.empty() && !ZLFile(testFile).exists()) { + return 0; + } + + return new ZLUnixExecMessageOutputChannel(); +} + +shared_ptr<ZLMessageSender> ZLUnixExecMessageOutputChannel::createSender(const ZLCommunicationManager::Data &data) { + ZLCommunicationManager::Data::const_iterator it = data.find("command"); + if (it == data.end()) { + return 0; + } + const std::string &command = it->second; + return (!command.empty()) ? new ZLUnixExecMessageSender(command) : 0; +} + +ZLUnixExecMessageSender::ZLUnixExecMessageSender(const std::string &command) : myCommand(command) { +} + +void ZLUnixExecMessageSender::sendStringMessage(const std::string &message) { + if (fork() == 0) { + std::string escapedMessage = message; + int index = 0; + while (true) { + index = escapedMessage.find('&', index); + if (index == -1) { + break; + } + escapedMessage.insert(index, "\\"); + index += 2; + } + index = 0; + while (true) { + index = escapedMessage.find(' ', index); + if (index == -1) { + break; + } + escapedMessage.insert(index, "\\"); + index += 2; + } + + std::string command = myCommand; + index = command.find("%1"); + if (index >= 0) { + command = command.substr(0, index) + escapedMessage + command.substr(index + 2); + } + if (std::system(command.c_str()) == -1) { + std::exit(-1); + } + std::exit(0); + } +} diff --git a/zlibrary/core/src/unix/message/ZLUnixMessage.h b/zlibrary/core/src/unix/message/ZLUnixMessage.h new file mode 100644 index 0000000..69b33c9 --- /dev/null +++ b/zlibrary/core/src/unix/message/ZLUnixMessage.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2004-2012 Geometer Plus <[email protected]> + * + * 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 __ZLUNIXMESSAGE_H__ +#define __ZLUNIXMESSAGE_H__ + +#include <string> + +#include <ZLMessage.h> + +class ZLUnixCommunicationManager : public ZLCommunicationManager { + +public: + static void createInstance(); + + shared_ptr<ZLMessageOutputChannel> createMessageOutputChannel(const std::string &protocol, const std::string &testFile); + void addInputMessageDescription(const std::string&, const std::string&, const Data&) {} + +private: + ZLUnixCommunicationManager(); +}; + +class ZLUnixExecMessageOutputChannel : public ZLMessageOutputChannel { + +public: + shared_ptr<ZLMessageSender> createSender(const ZLCommunicationManager::Data &data); +}; + +class ZLUnixExecMessageSender : public ZLMessageSender { + +private: + ZLUnixExecMessageSender(const std::string &command); + +public: + void sendStringMessage(const std::string &message); + +private: + std::string myCommand; + +friend class ZLUnixExecMessageOutputChannel; +}; + +#endif /* __ZLUNIXMESSAGE_H__ */ diff --git a/zlibrary/ui/src/qt/application-desktop/moc.mk b/zlibrary/ui/src/qt/application-desktop/moc.mk deleted file mode 100644 index c0b0512..0000000 --- a/zlibrary/ui/src/qt/application-desktop/moc.mk +++ /dev/null @@ -1 +0,0 @@ -SRCMOC = ZLQtApplicationWindow.moc.cpp ZLQtPopupMenu.moc.cpp diff --git a/zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.cpp b/zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.cpp deleted file mode 100644 index 227419c..0000000 --- a/zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (C) 2004-2012 Geometer Plus <[email protected]> - * - * 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 <qapplication.h> -#include <qpixmap.h> -#include <qmenubar.h> - -#include <ZLibrary.h> - -#include "ZLQtApplicationWindow.h" -#include "../dialogs/ZLQtDialogManager.h" -#include "../util/ZLQtKeyUtil.h" -#include "../view/ZLQtViewWidget.h" - -void ZLQtDialogManager::createApplicationWindow(ZLApplication *application) const { - new ZLQtApplicationWindow(application); -} - -static const std::string OPTIONS = "Options"; - -ZLQtApplicationWindow::ZLQtApplicationWindow(ZLApplication *application) : - ZLApplicationWindow(application), - myWidthOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "Width", 10, 800, 350), - myHeightOption(ZLCategoryKey::LOOK_AND_FEEL, OPTIONS, "Height", 10, 800, 350), - myFullScreen(false), - myWasMaximized(false) { - - setWFlags(getWFlags() | WStyle_Customize); - - connect(menuBar(), SIGNAL(activated(int)), this, SLOT(doActionSlot(int))); - - resize(myWidthOption.value(), myHeightOption.value()); - - qApp->setMainWidget(this); - showMaximized(); -} - -ZLQtApplicationWindow::~ZLQtApplicationWindow() { - if (!isFullscreen()) { - myWidthOption.setValue(width()); - myHeightOption.setValue(height()); - } -} - -void ZLQtApplicationWindow::keyPressEvent(QKeyEvent *event) { - application().doActionByKey(ZLQtKeyUtil::keyName(event)); -} - -void ZLQtApplicationWindow::setFullscreen(bool fullscreen) { - if (fullscreen == myFullScreen) { - return; - } - myFullScreen = fullscreen; - if (myFullScreen) { - myWasMaximized = isMaximized(); - menuBar()->hide(); - showFullScreen(); - } else { - menuBar()->show(); - showNormal(); - if (myWasMaximized) { - showMaximized(); - } - } -} - -bool ZLQtApplicationWindow::isFullscreen() const { - return myFullScreen; -} - -void ZLQtApplicationWindow::close() { - QMainWindow::close(); -} - -void ZLQtApplicationWindow::closeEvent(QCloseEvent *event) { - if (application().closeView()) { - event->accept(); - } else { - event->ignore(); - } -} - -void ZLQtApplicationWindow::addToolbarItem(ZLApplication::Toolbar::ItemPtr item) { - if (item->type() == ZLApplication::Toolbar::Item::BUTTON) { - const ZLApplication::Toolbar::ButtonItem &buttonItem = (const ZLApplication::Toolbar::ButtonItem&)*item; - static const std::string imagePrefix = ZLibrary::ApplicationImageDirectory() + ZLibrary::FileNameDelimiter; - const std::string &actionId = buttonItem.actionId(); - std::map<std::string,int>::const_iterator iter = myActionIndices.find(actionId); - int actionIndex; - if (iter != myActionIndices.end()) { - actionIndex = iter->second; - } else { - actionIndex = myActionIndices.size() + 1; - myActionIndices[actionId] = actionIndex; - myActionIds[actionIndex] = actionId; - } - menuBar()->insertItem(QPixmap((imagePrefix + buttonItem.iconName() + ".png").c_str()), this, SLOT(emptySlot()), 0, actionIndex); - } -} - -void ZLQtApplicationWindow::refresh() { - const ZLApplication::Toolbar::ItemVector &items = application().toolbar().items(); - for (ZLApplication::Toolbar::ItemVector::const_iterator it = items.begin(); it != items.end(); ++it) { - if ((*it)->type() == ZLApplication::Toolbar::Item::BUTTON) { - const ZLApplication::Toolbar::ButtonItem &button = (const ZLApplication::Toolbar::ButtonItem&)**it; - const std::string &actionId = button.actionId(); - const int id = myActionIndices[actionId]; - if (menuBar()->findItem(id) != 0) { - menuBar()->setItemVisible(id, application().isActionVisible(actionId)); - menuBar()->setItemEnabled(id, application().isActionEnabled(actionId)); - } - } - } -} - -void ZLQtApplicationWindow::setCaption(const std::string &caption) { - QString qCaption = QString::fromUtf8(caption.c_str()); - if (qCaption.length() > 60) { - qCaption = qCaption.left(57) + "..."; - } - QMainWindow::setCaption(qCaption); -} - -void ZLQtApplicationWindow::doActionSlot(int buttonNumber) { - application().doAction(myActionIds[buttonNumber]); -} - -void ZLQtApplicationWindow::grabAllKeys(bool) { -} - -ZLQtViewWidgetPositionInfo::ZLQtViewWidgetPositionInfo(const ZLQtApplicationWindow &window) : myWindow(window) { -} - -int ZLQtViewWidgetPositionInfo::x() const { - return 0; -} - -int ZLQtViewWidgetPositionInfo::y() const { - return ((myWindow.menuBar() != 0) && myWindow.menuBar()->isVisible()) ? - myWindow.menuBar()->height() : 0; -} - -int ZLQtViewWidgetPositionInfo::width() const { - return myWindow.width(); -} - -int ZLQtViewWidgetPositionInfo::height() const { - return myWindow.height() - y(); -} - -ZLViewWidget *ZLQtApplicationWindow::createViewWidget() { - ZLQtViewWidgetPositionInfo positionInfo(*this); - ZLQtViewWidget *viewWidget = new ZLQtViewWidget(this, &application(), positionInfo); - setCentralWidget(viewWidget->widget()); - viewWidget->widget()->show(); - return viewWidget; -} diff --git a/zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.h b/zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.h deleted file mode 100644 index f602bf2..0000000 --- a/zlibrary/ui/src/qt/application-pdaxrom/ZLQtApplicationWindow.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2004-2012 Geometer Plus <[email protected]> - * - * 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 __ZLQTAPPLICATIONWINDOW_H__ -#define __ZLQTAPPLICATIONWINDOW_H__ - -#include <map> - -#include <qmainwindow.h> - -#include "../../../../core/src/application/ZLApplicationWindow.h" - -class ZLQtApplicationWindow : public QMainWindow, public ZLApplicationWindow { - Q_OBJECT - -public: - ZLQtApplicationWindow(ZLApplication *application); - ~ZLQtApplicationWindow(); - -private: - ZLViewWidget *createViewWidget(); - void addToolbarItem(ZLApplication::Toolbar::ItemPtr item); - void refresh(); - void close(); - - void grabAllKeys(bool grab); - - void setCaption(const std::string &caption); - - bool isFullscreen() const; - void setFullscreen(bool fullscreen); - - void closeEvent(QCloseEvent *event); - void keyPressEvent(QKeyEvent *event); - -private slots: - void doActionSlot(int buttonNumber); - void emptySlot() {} - -private: - ZLIntegerRangeOption myWidthOption; - ZLIntegerRangeOption myHeightOption; - - bool myFullScreen; - bool myWasMaximized; - - std::map<std::string,int> myActionIndices; - std::map<int,std::string> myActionIds; -}; - -#endif /* __ZLQTAPPLICATIONWINDOW_H__ */ diff --git a/zlibrary/ui/src/qt/application-pdaxrom/moc.mk b/zlibrary/ui/src/qt/application-pdaxrom/moc.mk deleted file mode 100644 index b84e639..0000000 --- a/zlibrary/ui/src/qt/application-pdaxrom/moc.mk +++ /dev/null @@ -1 +0,0 @@ -SRCMOC = ZLQtApplicationWindow.moc.cpp diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.cpp b/zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.cpp deleted file mode 100644 index cf00dcd..0000000 --- a/zlibrary/ui/src/qt/dialogs/ZLQtDialogManager.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2004-2012 Geometer Plus <[email protected]> - * - * 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 <qapplication.h> -#include <qmessagebox.h> -#include <qfiledialog.h> -#include <qclipboard.h> - -#include "ZLQtDialogManager.h" -#include "ZLQtDialog.h" -#include "ZLQtOptionsDialog.h" -#include "ZLQtOpenFileDialog.h" -#include "ZLQtDialogContent.h" -#include "ZLQtProgressDialog.h" -#include "ZLQtUtil.h" - -#include "../image/ZLQtImageManager.h" - -shared_ptr<ZLDialog> ZLQtDialogManager::createDialog(const ZLResourceKey &key) const { - return new ZLQtDialog(resource()[key]); -} - -shared_ptr<ZLOptionsDialog> ZLQtDialogManager::createOptionsDialog(const ZLResourceKey &key, shared_ptr<ZLRunnable> applyAction, bool showApplyButton) const { - return new ZLQtOptionsDialog(resource()[key], applyAction, showApplyButton); -} - -shared_ptr<ZLOpenFileDialog> ZLQtDialogManager::createOpenFileDialog(const ZLResourceKey &key, const std::string &directoryPath, const std::string &filePath, const ZLOpenFileDialog::Filter &filter) const { - return new ZLQtOpenFileDialog(dialogTitle(key), directoryPath, filePath, filter); -} - -void ZLQtDialogManager::informationBox(const std::string &title, const std::string &message) const { - QMessageBox::information( - qApp->mainWidget(), - ::qtString(title), - ::qtString(message), - ::qtButtonName(OK_BUTTON) - ); -} - -void ZLQtDialogManager::errorBox(const ZLResourceKey &key, const std::string &message) const { - QMessageBox::critical( - qApp->mainWidget(), - ::qtString(dialogTitle(key)), - ::qtString(message), - ::qtButtonName(OK_BUTTON) - ); -} - -int ZLQtDialogManager::questionBox(const ZLResourceKey &key, const std::string &message, const ZLResourceKey &button0, const ZLResourceKey &button1, const ZLResourceKey &button2) const { - return QMessageBox::question( - qApp->mainWidget(), - ::qtString(dialogTitle(key)), - ::qtString(message), - ::qtButtonName(button0), - ::qtButtonName(button1), - ::qtButtonName(button2) - ); -} - -shared_ptr<ZLProgressDialog> ZLQtDialogManager::createProgressDialog(const ZLResourceKey &key) const { - return new ZLQtProgressDialog(key); -} - -bool ZLQtDialogManager::isClipboardSupported(ClipboardType type) const { - return true; -} - -void ZLQtDialogManager::setClipboardText(const std::string &text, ClipboardType type) const { - if (!text.empty()) { - qApp->clipboard()->setText( - ::qtString(text), - (type == CLIPBOARD_MAIN) ? QClipboard::Clipboard : QClipboard::Selection - ); - } -} - -void ZLQtDialogManager::setClipboardImage(const ZLImageData &imageData, ClipboardType type) const { - qApp->clipboard()->setImage( - (ZLQtImageData&)imageData, - (type == CLIPBOARD_MAIN) ? QClipboard::Clipboard : QClipboard::Selection - ); -} diff --git a/zlibrary/ui/src/qt/dialogs/ZLQtOptionView.h b/zlibrary/ui/src/qt/dialogs/ZLQtOptionView.h deleted file mode 100644 index bc91776..0000000 --- a/zlibrary/ui/src/qt/dialogs/ZLQtOptionView.h +++ /dev/null @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2004-2012 Geometer Plus <[email protected]> - * - * 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 __ZLQTOPTIONVIEW_H__ -#define __ZLQTOPTIONVIEW_H__ - -#include <qobject.h> - -#include <ZLOptionsDialog.h> -#include <ZLOptionEntry.h> -#include "../../../../core/src/dialogs/ZLOptionView.h" - -class ZLQtDialogContent; - -class QButtonGroup; -class QLabel; -class QSpinBox; -class QCheckBox; -class QListBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QComboBox; -class QSlider; -class QWidget; - -class ZLQtOptionView : public ZLOptionView { - -protected: - ZLQtOptionView(const std::string &name, const std::string &tooltip, ZLOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLOptionView(name, tooltip, option), myTab(tab), myRow(row), myFromColumn(fromColumn), myToColumn(toColumn) {} - -protected: - ZLQtDialogContent *myTab; - int myRow, myFromColumn, myToColumn; -}; - -class ChoiceOptionView : public ZLQtOptionView { - -public: - ChoiceOptionView(const std::string &name, const std::string &tooltip, ZLChoiceOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) { - myButtons = 0; - } - ~ChoiceOptionView() { if (myButtons != 0) delete[] myButtons; } - -protected: - void _createItem(); - void _show(); - void _hide(); - void _setActive(bool active); - void _onAccept() const; - -private: - QButtonGroup *myGroup; - QRadioButton **myButtons; -}; - -class BooleanOptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - BooleanOptionView(const std::string &name, const std::string &tooltip, ZLBooleanOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} - -protected: - void _createItem(); - void _show(); - void _hide(); - void _setActive(bool active); - void _onAccept() const; - -private slots: - void onStateChanged(bool) const; - -private: - QCheckBox *myCheckBox; -}; - -class Boolean3OptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - Boolean3OptionView(const std::string &name, const std::string &tooltip, ZLBoolean3OptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} - -protected: - void _createItem(); - void _show(); - void _hide(); - void _setActive(bool active); - void _onAccept() const; - -private slots: - void onStateChanged(int) const; - -private: - QCheckBox *myCheckBox; -}; - -class StringOptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - StringOptionView(const std::string &name, const std::string &tooltip, ZLStringOptionEntry *option, ZLQtDialogContent *tab, bool passwordMode, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myLabel(0), myLineEdit(0), myPasswordMode(passwordMode) {} - -private: - void _createItem(); - void _show(); - void _hide(); - void _setActive(bool active); - void _onAccept() const; - void reset(); - -private slots: - void onValueEdited(const QString &value); - -private: - QLabel *myLabel; - QLineEdit *myLineEdit; - const bool myPasswordMode; -}; - -class SpinOptionView : public ZLQtOptionView { - -public: - SpinOptionView(const std::string &name, const std::string &tooltip, ZLSpinOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} - -protected: - void _createItem(); - void _show(); - void _hide(); - void _onAccept() const; - -private: - QLabel *myLabel; - QSpinBox *mySpinBox; -}; - -class ComboOptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - ComboOptionView(const std::string &name, const std::string &tooltip, ZLComboOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myLabel(0), myComboBox(0) {} - -private: - void _createItem(); - void _show(); - void _hide(); - void _setActive(bool active); - void _onAccept() const; - void reset(); - -private slots: - void onValueSelected(int index); - void onValueEdited(const QString &value); - void onTabResized(const QSize &size); - -private: - QLabel *myLabel; - QComboBox *myComboBox; -}; - -class KeyOptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - KeyOptionView(const std::string &name, const std::string &tooltip, ZLKeyOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myWidget(0), myKeyEditor(0), myLabel(0), myComboBox(0) {} - -private: - void _createItem(); - void _show(); - void _hide(); - void _onAccept() const; - void reset(); - -private slots: - void onValueChanged(int); - -private: - QWidget *myWidget; - QLineEdit *myKeyEditor; - QLabel *myLabel; - QComboBox *myComboBox; - std::string myCurrentKey; - -friend class KeyLineEdit; -}; - -class ColorOptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - ColorOptionView(const std::string &name, const std::string &tooltip, ZLColorOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myWidget(0), myRSlider(0), myGSlider(0), myBSlider(0), myColorBar(0) {} - -private: - void _createItem(); - void _show(); - void _hide(); - void _onAccept() const; - void reset(); - -private slots: - void onSliderMove(int); - -private: - QWidget *myWidget; - QSlider *myRSlider, *myGSlider, *myBSlider; - QLabel *myColorBar; -}; - -class OrderOptionView : public QObject, public ZLQtOptionView { - -Q_OBJECT - -public: - OrderOptionView(const std::string &name, const std::string &tooltip, ZLOrderOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn) {} - -protected: - void _createItem(); - void _show(); - void _hide(); - void _onAccept() const; - -private slots: - void onChangeSelection(); - void onUpButtonPressed(); - void onDownButtonPressed(); - -private: - QWidget *myWidget; - QListBox *myListBox; - QPushButton *myUpButton, *myDownButton; -}; - -class StaticTextOptionView : public ZLQtOptionView { - -public: - StaticTextOptionView(const std::string &name, const std::string &tooltip, ZLStaticTextOptionEntry *option, ZLQtDialogContent *tab, int row, int fromColumn, int toColumn) : ZLQtOptionView(name, tooltip, option, tab, row, fromColumn, toColumn), myLabel(0) {} - -private: - void _createItem(); - void _show(); - void _hide(); - void _onAccept() const; - -private: - QLabel *myLabel; -}; - -#endif /* __ZLQTOPTIONVIEW_H__ */ diff --git a/zlibrary/ui/src/qt/dialogs/moc.mk b/zlibrary/ui/src/qt/dialogs/moc.mk deleted file mode 100644 index 225863a..0000000 --- a/zlibrary/ui/src/qt/dialogs/moc.mk +++ /dev/null @@ -1 +0,0 @@ -SRCMOC = ZLQtOptionsDialog.moc.cpp ZLQtOptionView.moc.cpp diff --git a/zlibrary/ui/src/qt/image/ZLQtImageManager.cpp b/zlibrary/ui/src/qt/image/ZLQtImageManager.cpp deleted file mode 100644 index 42a2b86..0000000 --- a/zlibrary/ui/src/qt/image/ZLQtImageManager.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2004-2012 Geometer Plus <[email protected]> - * - * 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 <ZLImage.h> - -#include "ZLQtImageManager.h" - -void ZLQtImageData::init(unsigned int width, unsigned int height) { - create(width, height, 32); -} - -void ZLQtImageData::setPosition(unsigned int x, unsigned int y) { - myX = x; - myY = y; -} - -void ZLQtImageData::moveX(int delta) { - myX += delta; -} - -void ZLQtImageData::moveY(int delta) { - myY += delta; -} - -void ZLQtImageData::setPixel(unsigned char r, unsigned char g, unsigned char b) { - QImage::setPixel(myX, myY, qRgb(r, g, b)); -} - -void ZLQtImageData::copyFrom(const ZLImageData &source, unsigned int targetX, unsigned int targetY) { - bitBlt(this, targetX, targetY, (const ZLQtImageData*)&source, 0, 0); -} - -shared_ptr<ZLImageData> ZLQtImageManager::createData() const { - return new ZLQtImageData(); -} - -bool ZLQtImageManager::convertImageDirect(const std::string &stringData, ZLImageData &data) const { - return ((ZLQtImageData&)data).loadFromData((const unsigned char*)stringData.data(), stringData.length()); -} diff --git a/zlibrary/ui/src/qt/library/ZLibrary.cpp b/zlibrary/ui/src/qt/library/ZLibrary.cpp deleted file mode 100644 index ed93971..0000000 --- a/zlibrary/ui/src/qt/library/ZLibrary.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2004-2012 Geometer Plus <[email protected]> - * - * 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 <qapplication.h> - -#include <ZLApplication.h> -#include <ZLibrary.h> -#include <ZLLanguageUtil.h> - -#include "../../../../core/src/unix/library/ZLibraryImplementation.h" - -#include "../filesystem/ZLQtFSManager.h" -#include "../time/ZLQtTime.h" -#include "../dialogs/ZLQtDialogManager.h" -#include "../image/ZLQtImageManager.h" -#include "../view/ZLQtPaintContext.h" -#include "../../unix/message/ZLUnixMessage.h" -#include "../../../../core/src/util/ZLKeyUtil.h" -#include "../../../../core/src/unix/xmlconfig/XMLConfig.h" -#include "../../../../core/src/unix/iconv/IConvEncodingConverter.h" -#include "../../../../core/src/unix/curl/ZLCurlNetworkManager.h" - -class ZLQtLibraryImplementation : public ZLibraryImplementation { - -private: - void init(int &argc, char **&argv); - ZLPaintContext *createContext(); - void run(ZLApplication *application); -}; - -void initLibrary() { - new ZLQtLibraryImplementation(); -} - -void ZLQtLibraryImplementation::init(int &argc, char **&argv) { - new QApplication(argc, argv); - - ZLibrary::parseArguments(argc, argv); - - XMLConfigManager::createInstance(); - ZLQtTimeManager::createInstance(); - ZLQtFSManager::createInstance(); - ZLQtDialogManager::createInstance(); - ZLUnixCommunicationManager::createInstance(); - ZLQtImageManager::createInstance(); - ZLEncodingCollection::Instance().registerProvider(new IConvEncodingConverterProvider()); - ZLCurlNetworkManager::createInstance(); - - ZLKeyUtil::setKeyNamesFileName("keynames-qt.xml"); -} - -ZLPaintContext *ZLQtLibraryImplementation::createContext() { - return new ZLQtPaintContext(); -} - -void ZLQtLibraryImplementation::run(ZLApplication *application) { - qApp->setReverseLayout(ZLLanguageUtil::isRTLLanguage(ZLibrary::Language())); - ZLDialogManager::Instance().createApplicationWindow(application); - application->initWindow(); - qApp->exec(); - delete application; -} diff --git a/zlibrary/ui/src/qt/view/moc.mk b/zlibrary/ui/src/qt/view/moc.mk deleted file mode 100644 index 6becb53..0000000 --- a/zlibrary/ui/src/qt/view/moc.mk +++ /dev/null @@ -1 +0,0 @@ -SRCMOC = ZLQtViewWidget.moc.cpp |