parent
bfc2deaeb6
commit
5e5423ec5d
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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
|
||||
);
|
||||
}
|
@ -0,0 +1,269 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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__ */
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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__ */
|
@ -1 +0,0 @@
|
||||
SRCMOC = ZLQtApplicationWindow.moc.cpp ZLQtPopupMenu.moc.cpp
|
@ -1,173 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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__ */
|
@ -1 +0,0 @@
|
||||
SRCMOC = ZLQtApplicationWindow.moc.cpp
|
@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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
|
||||
);
|
||||
}
|
@ -1,269 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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__ */
|
@ -1 +0,0 @@
|
||||
SRCMOC = ZLQtOptionsDialog.moc.cpp ZLQtOptionView.moc.cpp
|
@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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());
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004-2012 Geometer Plus <contact@geometerplus.com>
|
||||
*
|
||||
* 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;
|
||||
}
|
@ -1 +0,0 @@
|
||||
SRCMOC = ZLQtViewWidget.moc.cpp
|
Loading…
Reference in new issue