Merge branch 'master' of gitorious.org:qtermwidget/qtermwidget
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
###| Cmake qtermwidget |###
|
||||
|
||||
option(BUILD_DESIGNER_PLUGIN "Build Qt4 designer plugin" ON)
|
||||
|
||||
#| Setting required version
|
||||
cmake_minimum_required( VERSION 2.4 )
|
||||
|
||||
|
||||
@@ -115,6 +115,13 @@ endif (HAVE_UPDWTMPX)
|
||||
#add_library( qtermwidget STATIC ${SRCS} ${MOC_SRCS} )
|
||||
add_library ( qtermwidget SHARED ${SRCS} ${MOC_SRCS} )
|
||||
|
||||
if (APPLE)
|
||||
# this is a must to load the lib correctly
|
||||
set_target_properties( qtermwidget PROPERTIES
|
||||
INSTALL_NAME_DIR ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX} )
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
#| Set Build Type
|
||||
if (NOT CMAKE_BUILD_TYPE)
|
||||
set ( CMAKE_BUILD_TYPE
|
||||
@@ -143,3 +150,40 @@ install(FILES ${HDRS_DISTRIB} DESTINATION include)
|
||||
# keyboard layouts
|
||||
install(DIRECTORY kb-layouts/ DESTINATION ${KB_LAYOUT_DIR} FILES_MATCHING PATTERN "*.keytab" )
|
||||
|
||||
|
||||
#
|
||||
# Qt4 designer plugin
|
||||
#
|
||||
if (BUILD_DESIGNER_PLUGIN)
|
||||
message(STATUS "Building Qt designer plugin")
|
||||
|
||||
include_directories(designer
|
||||
${QT_QTDESIGNER_INCLUDE_DIR})
|
||||
|
||||
set(DESIGNER_SRC designer/qtermwidgetplugin.cpp)
|
||||
QT4_WRAP_CPP( DESIGNER_MOC designer/qtermwidgetplugin.h)
|
||||
QT4_ADD_RESOURCES( DESIGNER_QRC designer/qtermwidgetplugin.qrc)
|
||||
|
||||
link_directories(${CMAKE_BINARY_DIR})
|
||||
add_library( qtermwidgetplugin SHARED
|
||||
${DESIGNER_MOC}
|
||||
${DESIGNER_QRC}
|
||||
${DESIGNER_SRC}
|
||||
)
|
||||
|
||||
target_link_libraries( qtermwidgetplugin
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTDESIGNER_LIBRARY}
|
||||
${QT_QTDESIGNERCOMPONENTS_LIBRARY}
|
||||
qtermwidget
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
# this is a must to load the lib correctly
|
||||
set_target_properties( qtermwidgetplugin PROPERTIES
|
||||
INSTALL_NAME_DIR ${QT_PLUGINS_DIR}/designer )
|
||||
endif (APPLE)
|
||||
|
||||
install( TARGETS qtermwidgetplugin DESTINATION ${QT_PLUGINS_DIR}/designer )
|
||||
|
||||
endif (BUILD_DESIGNER_PLUGIN)
|
||||
|
||||
+12
-2
@@ -232,6 +232,16 @@ void TerminalDisplay::setVTFont(const QFont& f)
|
||||
{
|
||||
QFont font = f;
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
#if QT_VERSION >= 0x040700
|
||||
// mac uses floats for font width specification.
|
||||
// this ensures the same handling for all platforms
|
||||
font.setStyleStrategy(QFont::ForceIntegerMetrics);
|
||||
#else
|
||||
#warning "Correct handling of the QFont metrics requited Qt>=4.7"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
QFontMetrics metrics(font);
|
||||
|
||||
if ( !QFontInfo(font).fixedPitch() ) {
|
||||
@@ -549,14 +559,14 @@ void TerminalDisplay::setOpacity(qreal opacity)
|
||||
|
||||
// enable automatic background filling to prevent the display
|
||||
// flickering if there is no transparency
|
||||
/*if ( color.alpha() == 255 )
|
||||
if ( color.alpha() == 255 )
|
||||
{
|
||||
setAutoFillBackground(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAutoFillBackground(false);
|
||||
}*/
|
||||
}
|
||||
|
||||
_blendColor = color.rgba();
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.2 KiB |
@@ -0,0 +1,102 @@
|
||||
|
||||
#include "qtermwidgetplugin.h"
|
||||
|
||||
#include <QtPlugin>
|
||||
|
||||
#include "qtermwidget.h"
|
||||
|
||||
|
||||
QTermWidgetPlugin::QTermWidgetPlugin(QObject *parent)
|
||||
: QObject(parent), initialized(false)
|
||||
{
|
||||
Q_INIT_RESOURCE(qtermwidgetplugin);
|
||||
}
|
||||
|
||||
|
||||
QTermWidgetPlugin::~QTermWidgetPlugin()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void QTermWidgetPlugin::initialize(QDesignerFormEditorInterface * /* core */)
|
||||
{
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
|
||||
bool QTermWidgetPlugin::isInitialized() const
|
||||
{
|
||||
return initialized;
|
||||
}
|
||||
|
||||
|
||||
QWidget *QTermWidgetPlugin::createWidget(QWidget *parent)
|
||||
{
|
||||
return new QTermWidget(0, parent);
|
||||
}
|
||||
|
||||
|
||||
QString QTermWidgetPlugin::name() const
|
||||
{
|
||||
return "QTermWidget";
|
||||
}
|
||||
|
||||
|
||||
QString QTermWidgetPlugin::group() const
|
||||
{
|
||||
return "Input Widgets";
|
||||
}
|
||||
|
||||
|
||||
QIcon QTermWidgetPlugin::icon() const
|
||||
{
|
||||
return QIcon(":qtermwidget.png");
|
||||
}
|
||||
|
||||
|
||||
QString QTermWidgetPlugin::toolTip() const
|
||||
{
|
||||
return "QTermWidget component/widget";
|
||||
}
|
||||
|
||||
|
||||
QString QTermWidgetPlugin::whatsThis() const
|
||||
{
|
||||
return "Qt based terminal emulator";
|
||||
}
|
||||
|
||||
|
||||
bool QTermWidgetPlugin::isContainer() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
QString QTermWidgetPlugin::domXml() const
|
||||
{
|
||||
return "<widget class=\"QTermWidget\" name=\"termWidget\">\n"
|
||||
" <property name=\"geometry\">\n"
|
||||
" <rect>\n"
|
||||
" <x>0</x>\n"
|
||||
" <y>0</y>\n"
|
||||
" <width>400</width>\n"
|
||||
" <height>200</height>\n"
|
||||
" </rect>\n"
|
||||
" </property>\n"
|
||||
" <property name=\"toolTip\" >\n"
|
||||
" <string></string>\n"
|
||||
" </property>\n"
|
||||
" <property name=\"whatsThis\" >\n"
|
||||
" <string></string>\n"
|
||||
" </property>\n"
|
||||
"</widget>\n";
|
||||
}
|
||||
|
||||
|
||||
QString QTermWidgetPlugin::includeFile() const
|
||||
{
|
||||
return "qtermwidget.h";
|
||||
}
|
||||
|
||||
|
||||
Q_EXPORT_PLUGIN2(QTermWidgetPlugin, QTermWidgetPlugin)
|
||||
@@ -0,0 +1,33 @@
|
||||
|
||||
#ifndef QTERMWIDGETPLUGIN_H
|
||||
#define QTERMWIDGETPLUGIN_H
|
||||
|
||||
#include <QDesignerCustomWidgetInterface>
|
||||
|
||||
|
||||
class QTermWidgetPlugin : public QObject, public QDesignerCustomWidgetInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
QTermWidgetPlugin(QObject *parent = 0);
|
||||
virtual ~QTermWidgetPlugin();
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget *createWidget(QWidget *parent);
|
||||
void initialize(QDesignerFormEditorInterface *core);
|
||||
|
||||
private:
|
||||
bool initialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE RCC>
|
||||
<RCC version="1.0">
|
||||
<qresource>
|
||||
<file>qtermwidget.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
@@ -196,6 +196,13 @@ void QTermWidget::setTerminalFont(QFont &font)
|
||||
m_impl->m_terminalDisplay->setVTFont(font);
|
||||
}
|
||||
|
||||
void QTermWidget::setTerminalOpacity(qreal level)
|
||||
{
|
||||
if (!m_impl->m_terminalDisplay)
|
||||
return;
|
||||
m_impl->m_terminalDisplay->setOpacity(level);
|
||||
}
|
||||
|
||||
void QTermWidget::setShellProgram(const QString &progname)
|
||||
{
|
||||
if (!m_impl->m_session)
|
||||
|
||||
@@ -66,6 +66,8 @@ public:
|
||||
// otherwise symbols' position could be incorrect
|
||||
void setTerminalFont(QFont & font);
|
||||
|
||||
void setTerminalOpacity(qreal level);
|
||||
|
||||
//environment
|
||||
void setEnvironment(const QStringList & environment);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user