Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| db7a258602 | |||
| bbcd213258 | |||
| 8c07618aff | |||
| cce010828c | |||
| ebe0677b7c | |||
| 2ad40d2507 | |||
| dac561fdad | |||
| 82e4a20b80 | |||
| 527033561e | |||
| 66570f00c1 | |||
| 8b5ff178eb | |||
| aab969817e |
@@ -1,5 +1,10 @@
|
||||
NEWS - list of user-visible changes between releases of qlscribe
|
||||
|
||||
New in 0.15
|
||||
Added ability to align regular text to left, right or center the same way as rounded text
|
||||
Fixed issue with filters in open dialog
|
||||
Added image preview to Qt open file dialog
|
||||
|
||||
New in 0.14
|
||||
Added Software Render for preview to make preview when no drive is available
|
||||
Items have Z coordinate set to remove ambiguity
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,5 @@
|
||||
qlscribe (0.14-0ubuntu1) unstable; urgency=low
|
||||
qlscribe (0.15-0ubuntu1) unstable; urgency=low
|
||||
* Release 0.15 imported
|
||||
* Release 0.14 imported
|
||||
* Release 0.13 imported
|
||||
* Release 0.12 imported
|
||||
|
||||
+2
-2
@@ -25,14 +25,14 @@ SET( QLSCRIBE_SRCS main.cpp mainwindow.cpp qcdscene.cpp qcdview.cpp
|
||||
qdialogpixmap.cpp qdialogroundtext.cpp qdialogtext.cpp qlightroundtextitem.cpp
|
||||
qlightscribe.cpp qshapefactory.cpp qlighttextitem.cpp qlightpixmapitem.cpp
|
||||
qdialogprint.cpp qdialogprogress.cpp qdialogcdproperties.cpp qconsoleprintprogress.cpp
|
||||
qdialogsettings.cpp )
|
||||
qdialogsettings.cpp previewinjector.cpp )
|
||||
|
||||
SET( QLSCRIBE_UIS qdialogtext.ui qdialogroundtext.ui qdialogpixmap.ui
|
||||
qdialogprint.ui qdialogprogress.ui qdialogcdproperties.ui qdialogsettings.ui )
|
||||
|
||||
SET( QLSCRIBE_MOC_HDRS mainwindow.h qcdscene.h qdialogpixmap.h qdialogroundtext.h
|
||||
qdialogtext.h qlightscribe.h qdialogprint.h qdialogprogress.h
|
||||
qdialogcdproperties.h qconsoleprintprogress.h qdialogsettings.h )
|
||||
qdialogcdproperties.h qconsoleprintprogress.h qdialogsettings.h previewinjector.h )
|
||||
|
||||
ADD_DEFINITIONS( -Wall )
|
||||
|
||||
|
||||
+14
-8
@@ -28,6 +28,7 @@
|
||||
#include "qdialogprogress.h"
|
||||
#include "qdialogcdproperties.h"
|
||||
#include "qdialogsettings.h"
|
||||
#include "previewinjector.h"
|
||||
|
||||
#include <QMenuBar>
|
||||
#include <QStatusBar>
|
||||
@@ -330,18 +331,23 @@ void MainWindow::onMenuInsert( int id )
|
||||
|
||||
void MainWindow::onMenuOpen()
|
||||
{
|
||||
QString filter( tr("qlscribe document (*.qlx)\nImages ( ") );
|
||||
QString filter( tr("qlscribe document (*.qlx);;Images ( ") );
|
||||
QList<QByteArray> list = QImageReader::supportedImageFormats();
|
||||
foreach( QByteArray arr, list ) {
|
||||
filter += QString( "*." ) + arr.data() + " ";
|
||||
}
|
||||
filter += tr( ")\nAll Files (*)" );
|
||||
filter += tr( ");;All Files (*)" );
|
||||
|
||||
QString fileName = QFileDialog::getOpenFileName( this,
|
||||
tr( "Open:" ),
|
||||
QString(),
|
||||
filter );
|
||||
|
||||
QFileDialog fd( this, "Open:", QString(), filter );
|
||||
|
||||
bool injectPreview = QSettings().value( cfgInjectPreview, true ).toBool();
|
||||
PreviewInjector pj( injectPreview ? &fd : 0 );
|
||||
fd.setFileMode( QFileDialog::ExistingFile );
|
||||
|
||||
if( fd.exec() != QDialog::Accepted )
|
||||
return;
|
||||
|
||||
QString fileName = fd.selectedFiles().value(0);
|
||||
if( fileName.isNull() )
|
||||
return;
|
||||
|
||||
@@ -539,7 +545,7 @@ void MainWindow::onMenuAbout()
|
||||
QMessageBox::about( this,
|
||||
tr( "About" ),
|
||||
tr( "<h3>qlscribe - Qt lisghtScribe</h3>"
|
||||
"<p>release 0.14 $Revision$</p>"
|
||||
"<p>release 0.15 $Revision$</p>"
|
||||
"<p>visit project at home page "
|
||||
"<a href=\"http://qlscribe.sourceforge.net/\">qlscribe.sourceforge.net</a></p>" ) );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#include "previewinjector.h"
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QLabel>
|
||||
#include <QSplitter>
|
||||
#include <QImageReader>
|
||||
|
||||
PreviewInjector::PreviewInjector( QFileDialog * dl ) :
|
||||
m_label( 0 ),
|
||||
m_size( 160, 120 )
|
||||
{
|
||||
if( !dl )
|
||||
return;
|
||||
|
||||
QSplitter *sp = qFindChild<QSplitter *>( dl, "splitter" );
|
||||
if( !sp )
|
||||
return;
|
||||
|
||||
m_label = new QLabel;
|
||||
m_label->resize( m_size );
|
||||
sp->addWidget( m_label );
|
||||
connect( dl, SIGNAL(currentChanged(QString)),SLOT(onSelectionChanged(QString)));
|
||||
}
|
||||
|
||||
PreviewInjector::~PreviewInjector()
|
||||
{
|
||||
delete m_label;
|
||||
}
|
||||
|
||||
void PreviewInjector::onSelectionChanged(QString file)
|
||||
{
|
||||
QImageReader reader( file );
|
||||
|
||||
if( !reader.canRead() ) {
|
||||
m_label->setPixmap( QPixmap() );
|
||||
return;
|
||||
}
|
||||
|
||||
m_label->resize( m_size );
|
||||
QSize toSize = m_size;
|
||||
QSize sz = reader.size();
|
||||
if( !sz.isNull() ) {
|
||||
double r1 = m_label->size().width() / double( sz.width() );
|
||||
double r2 = m_label->size().height() / double( sz.height() );
|
||||
|
||||
double ratio = std::max( r1, r2 );
|
||||
if( ratio < 1.0 ) {
|
||||
toSize.setWidth( sz.width() * ratio );
|
||||
toSize.setHeight( sz.height() * ratio );
|
||||
}
|
||||
}
|
||||
|
||||
reader.setScaledSize( toSize );
|
||||
QImage img = reader.read();
|
||||
if( img.isNull() ) {
|
||||
m_label->setPixmap( QPixmap() );
|
||||
return;
|
||||
}
|
||||
m_label->setPixmap( QPixmap::fromImage( img ) );
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef PREVIEWINJECTOR_HPP
|
||||
#define PREVIEWINJECTOR_HPP
|
||||
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
|
||||
class QFileDialog;
|
||||
class QLabel;
|
||||
|
||||
class PreviewInjector : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
PreviewInjector( QFileDialog * dl );
|
||||
~PreviewInjector();
|
||||
|
||||
bool injected() const { return m_label; }
|
||||
|
||||
private slots:
|
||||
void onSelectionChanged(QString );
|
||||
|
||||
private:
|
||||
QLabel *m_label;
|
||||
QSize m_size;
|
||||
};
|
||||
|
||||
#endif // PREVIEWINJECTOR_HPP
|
||||
+15
-2
@@ -22,10 +22,12 @@
|
||||
#include "ui_qdialogpixmap.h"
|
||||
#include "qlightpixmapitem.h"
|
||||
#include "qcdscene.h"
|
||||
#include "previewinjector.h"
|
||||
|
||||
#include <QImageReader>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
|
||||
QDialogPixmap::QDialogPixmap(QWidget *parent) :
|
||||
QItemDialog( parent ),
|
||||
@@ -118,8 +120,19 @@ void QDialogPixmap::onLoadImage()
|
||||
foreach( QByteArray arr, list ) {
|
||||
filter += QString( "*." ) + arr.data() + " ";
|
||||
}
|
||||
filter += tr( ")\nAll Files (*)" );
|
||||
QString fileName = QFileDialog::getOpenFileName( this, "Load image:", QString(), filter );
|
||||
filter += tr( ");;All Files (*.*)" );
|
||||
|
||||
QFileDialog fd( this, "Load image:", QString(), filter );
|
||||
fd.setOption( QFileDialog::DontUseNativeDialog ); // for testing
|
||||
|
||||
bool injectPreview = QSettings().value( cfgInjectPreview, true ).toBool();
|
||||
PreviewInjector pj( injectPreview ? &fd : 0 );
|
||||
fd.setFileMode( QFileDialog::ExistingFile );
|
||||
|
||||
if( fd.exec() != QDialog::Accepted )
|
||||
return;
|
||||
|
||||
QString fileName = fd.selectedFiles().value(0);
|
||||
if( fileName.isNull() )
|
||||
return;
|
||||
|
||||
|
||||
@@ -60,11 +60,13 @@ bool QDialogSettings::exec( QWidget *parent )
|
||||
dialog.m_font = sts.value( cfgDefaultFont ).value<QFont>();
|
||||
dialog.m_ui->fontName->setCurrentFont( dialog.m_font );
|
||||
dialog.m_ui->chkEject->setChecked( sts.value( cfgEjectAfterFinish, false ).toBool() );
|
||||
dialog.m_ui->chkPreview->setChecked( sts.value( cfgInjectPreview, true ).toBool() );
|
||||
|
||||
if( dialog.QDialog::exec() == Rejected ) return false;
|
||||
|
||||
sts.setValue( cfgDefaultFont, dialog.m_font );
|
||||
sts.setValue( cfgEjectAfterFinish, dialog.m_ui->chkEject->isChecked() );
|
||||
sts.setValue( cfgInjectPreview, dialog.m_ui->chkPreview->isChecked() );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
+46
-38
@@ -1,48 +1,49 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QDialogSettings</class>
|
||||
<widget class="QDialog" name="QDialogSettings" >
|
||||
<property name="windowModality" >
|
||||
<widget class="QDialog" name="QDialogSettings">
|
||||
<property name="windowModality">
|
||||
<enum>Qt::NonModal</enum>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>305</width>
|
||||
<height>156</height>
|
||||
<width>320</width>
|
||||
<height>170</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
<property name="modal" >
|
||||
<property name="modal">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="frameShape" >
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Default font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QFontComboBox" name="fontName" >
|
||||
<property name="enabled" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QFontComboBox" name="fontName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -50,13 +51,13 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
@@ -65,15 +66,15 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnFont" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="btnFont">
|
||||
<property name="text">
|
||||
<string>Font...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnLastUsedFont" >
|
||||
<property name="text" >
|
||||
<widget class="QPushButton" name="btnLastUsedFont">
|
||||
<property name="text">
|
||||
<string>Last used</string>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -81,21 +82,28 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkEject" >
|
||||
<property name="text" >
|
||||
<widget class="QCheckBox" name="chkEject">
|
||||
<property name="text">
|
||||
<string>Eject tray after finish</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="chkPreview">
|
||||
<property name="text">
|
||||
<string>Enable image preview in open dialog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -110,11 +118,11 @@
|
||||
<receiver>QDialogSettings</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@@ -126,11 +134,11 @@
|
||||
<receiver>QDialogSettings</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
|
||||
+24
-9
@@ -22,8 +22,8 @@
|
||||
#include "ui_qdialogtext.h"
|
||||
#include "qcdscene.h"
|
||||
#include "qdialogsettings.h"
|
||||
#include "qlighttextitem.h"
|
||||
|
||||
#include <QGraphicsSimpleTextItem>
|
||||
#include <QFontDialog>
|
||||
#include <QColorDialog>
|
||||
|
||||
@@ -55,19 +55,20 @@ void QDialogText::changeEvent(QEvent *e)
|
||||
|
||||
bool QDialogText::exec( QGraphicsItem *graphicsItem )
|
||||
{
|
||||
QGraphicsSimpleTextItem *item = dynamic_cast< QGraphicsSimpleTextItem * >( graphicsItem );
|
||||
QLightTextItem *item = dynamic_cast< QLightTextItem * >( graphicsItem );
|
||||
if( !item )
|
||||
return false;
|
||||
|
||||
QCDScene scene;
|
||||
m_ui->cdView->setScene( &scene );
|
||||
m_item = new QGraphicsSimpleTextItem;
|
||||
m_item = new QLightTextItem;
|
||||
|
||||
m_item->setPos( item->pos() );
|
||||
m_item->setText( item->text() );
|
||||
m_item->setFont( item->font() );
|
||||
m_item->setBrush( item->brush() );
|
||||
m_item->setColor( item->color() );
|
||||
m_item->setTransform( item->transform() );
|
||||
m_item->setAlignment( item->alignment() );
|
||||
|
||||
scene.addItem( m_item, true );
|
||||
|
||||
@@ -75,19 +76,27 @@ bool QDialogText::exec( QGraphicsItem *graphicsItem )
|
||||
m_ui->spinY->setValue( m_item->pos().y() );
|
||||
m_ui->textEdit->setPlainText( m_item->text() );
|
||||
|
||||
int index = 0;
|
||||
if( m_item->alignment() == Qt::AlignRight ) index = 2;
|
||||
else if( m_item->alignment() == Qt::AlignCenter ) index = 1;
|
||||
|
||||
m_ui->comboAlignment->setCurrentIndex( index );
|
||||
|
||||
colorChanged();
|
||||
fontChanged();
|
||||
|
||||
connect( m_ui->textEdit, SIGNAL(textChanged()), this, SLOT(textChanged()) );
|
||||
connect( m_ui->spinX, SIGNAL(valueChanged(double)), this, SLOT(posChanged()) );
|
||||
connect( m_ui->spinY, SIGNAL(valueChanged(double)), this, SLOT(posChanged()) );
|
||||
connect( m_ui->comboAlignment, SIGNAL(currentIndexChanged(int)),this, SLOT(alignChanged()) );
|
||||
|
||||
if( QDialog::exec() == Rejected ) return false;
|
||||
|
||||
item->setPos( m_item->pos() );
|
||||
item->setText( m_item->text() );
|
||||
item->setFont( m_item->font() );
|
||||
item->setBrush( m_item->brush() );
|
||||
item->setColor( m_item->color() );
|
||||
item->setAlignment( m_item->alignment() );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -105,11 +114,11 @@ void QDialogText::onFont()
|
||||
|
||||
void QDialogText::onColor()
|
||||
{
|
||||
QColor color = QColorDialog::getColor( m_item->brush().color(), this );
|
||||
QColor color = QColorDialog::getColor( m_item->color(), this );
|
||||
if( color.isValid() ){
|
||||
m_item->setBrush( color );
|
||||
m_item->setColor( color );
|
||||
colorChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QDialogText::fontChanged()
|
||||
@@ -120,7 +129,7 @@ void QDialogText::fontChanged()
|
||||
void QDialogText::colorChanged()
|
||||
{
|
||||
QPixmap pixmap( m_ui->colorWidget->size() );
|
||||
pixmap.fill( m_item->brush().color() );
|
||||
pixmap.fill( m_item->color() );
|
||||
m_ui->colorWidget->setPixmap( pixmap );
|
||||
}
|
||||
|
||||
@@ -134,3 +143,9 @@ void QDialogText::posChanged()
|
||||
m_item->setPos( m_ui->spinX->value(), m_ui->spinY->value() );
|
||||
}
|
||||
|
||||
void QDialogText::alignChanged()
|
||||
{
|
||||
Qt::Alignment align[] = { Qt::AlignLeft, Qt::AlignCenter, Qt::AlignRight };
|
||||
m_item->setAlignment( align[ m_ui->comboAlignment->currentIndex() ] );
|
||||
}
|
||||
|
||||
|
||||
+5
-4
@@ -16,7 +16,7 @@
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
$Id:$ */
|
||||
$Id$ */
|
||||
|
||||
#ifndef QDIALOGTEXT_H
|
||||
#define QDIALOGTEXT_H
|
||||
@@ -27,7 +27,7 @@ namespace Ui {
|
||||
class QDialogText;
|
||||
}
|
||||
|
||||
class QGraphicsSimpleTextItem;
|
||||
class QLightTextItem;
|
||||
|
||||
class QDialogText : public QItemDialog {
|
||||
Q_OBJECT
|
||||
@@ -48,10 +48,11 @@ private slots:
|
||||
void fontChanged();
|
||||
void colorChanged();
|
||||
void posChanged();
|
||||
void alignChanged();
|
||||
|
||||
private:
|
||||
Ui::QDialogText *m_ui;
|
||||
QGraphicsSimpleTextItem *m_item;
|
||||
Ui::QDialogText *m_ui;
|
||||
QLightTextItem *m_item;
|
||||
};
|
||||
|
||||
#endif // QDIALOGTEXT_H
|
||||
|
||||
+127
-92
@@ -1,10 +1,11 @@
|
||||
<ui version="4.0" >
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>QDialogText</class>
|
||||
<widget class="QDialog" name="QDialogText" >
|
||||
<property name="enabled" >
|
||||
<widget class="QDialog" name="QDialogText">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="geometry" >
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
@@ -12,70 +13,70 @@
|
||||
<height>627</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<property name="windowTitle">
|
||||
<string>Text properties</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="frameShape" >
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow" >
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth" >
|
||||
<property name="lineWidth">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||
<property name="sizeConstraint" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label" >
|
||||
<property name="text" >
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>X:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QDoubleSpinBox" name="spinX" >
|
||||
<property name="decimals" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spinX">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<property name="minimum">
|
||||
<double>-61.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<property name="maximum">
|
||||
<double>61.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_2" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Y:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QDoubleSpinBox" name="spinY" >
|
||||
<property name="decimals" >
|
||||
<item row="1" column="1">
|
||||
<widget class="QDoubleSpinBox" name="spinY">
|
||||
<property name="decimals">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<property name="minimum">
|
||||
<double>-61.000000000000000</double>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<property name="maximum">
|
||||
<double>61.000000000000000</double>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -83,11 +84,11 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer" >
|
||||
<property name="orientation" >
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>13</width>
|
||||
<height>20</height>
|
||||
@@ -96,70 +97,104 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_3" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="label_5" >
|
||||
<property name="text" >
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
<string>Font:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="label_6" >
|
||||
<property name="text" >
|
||||
<item row="0" column="1">
|
||||
<widget class="QFontComboBox" name="fontName">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="text">
|
||||
<string>Color:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QFontComboBox" name="fontName" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editable" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="colorWidget" >
|
||||
<property name="minimumSize" >
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="colorWidget">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize" >
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape" >
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Box</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
</property>
|
||||
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="comboAlignment" >
|
||||
<property name="currentIndex" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Left</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Center</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text" >
|
||||
<string>Right</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Alignment:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2" >
|
||||
<property name="orientation" >
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>17</width>
|
||||
<height>20</height>
|
||||
@@ -168,20 +203,20 @@
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout_4" >
|
||||
<property name="fieldGrowthPolicy" >
|
||||
<layout class="QFormLayout" name="formLayout_4">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QPushButton" name="btnColor" >
|
||||
<property name="text" >
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="btnColor">
|
||||
<property name="text">
|
||||
<string>Color...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" >
|
||||
<widget class="QPushButton" name="btnFont" >
|
||||
<property name="text" >
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="btnFont">
|
||||
<property name="text">
|
||||
<string>Font...</string>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -191,26 +226,26 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2" >
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Text</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPlainTextEdit" name="textEdit" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<widget class="QPlainTextEdit" name="textEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>50</height>
|
||||
@@ -221,20 +256,20 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCDView" name="cdView" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<widget class="QCDView" name="cdView">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>2</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="baseSize" >
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="interactive" >
|
||||
<property name="interactive">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -243,11 +278,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
@@ -278,11 +313,11 @@
|
||||
<receiver>QDialogText</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>258</x>
|
||||
<y>582</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
@@ -294,11 +329,11 @@
|
||||
<receiver>QDialogText</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<hint type="sourcelabel">
|
||||
<x>326</x>
|
||||
<y>582</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
|
||||
@@ -227,7 +227,7 @@ void QLightRoundTextItem::paint( QPainter *painter, const QStyleOptionGraphicsIt
|
||||
painter->restore();
|
||||
if (option->state & QStyle::State_Selected) {
|
||||
painter->setPen( QPen( option->palette.windowText(), 0, Qt::DashLine ) );
|
||||
painter->setBrush(Qt::NoBrush);
|
||||
painter->setBrush( Qt::NoBrush );
|
||||
painter->drawPath( shape() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
class QLightRoundTextItem : public QAbstractGraphicsShapeItem {
|
||||
public:
|
||||
enum { Type = UserType + 1 };
|
||||
enum { Type = UserType + 1 };
|
||||
|
||||
QLightRoundTextItem( QGraphicsItem * parent = 0 );
|
||||
|
||||
|
||||
+64
-5
@@ -25,6 +25,7 @@
|
||||
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QXmlStreamReader>
|
||||
#include <QTextDocument>
|
||||
|
||||
|
||||
QLightTextItem::QLightTextItem()
|
||||
@@ -39,6 +40,58 @@ QVariant QLightTextItem::itemChange( GraphicsItemChange change, const QVariant &
|
||||
return value;
|
||||
}
|
||||
|
||||
QString QLightTextItem::text() const
|
||||
{
|
||||
return QGraphicsSimpleTextItem::text();
|
||||
}
|
||||
|
||||
QColor QLightTextItem::color() const
|
||||
{
|
||||
return this->brush().color();
|
||||
}
|
||||
|
||||
Qt::Alignment QLightTextItem::alignment() const
|
||||
{
|
||||
return m_alignment;
|
||||
}
|
||||
|
||||
void QLightTextItem::setText( const QString &txt )
|
||||
{
|
||||
QGraphicsSimpleTextItem::setText( txt );
|
||||
updateTrans();
|
||||
}
|
||||
|
||||
void QLightTextItem::setFont( const QFont &font )
|
||||
{
|
||||
QGraphicsSimpleTextItem::setFont( font );
|
||||
updateTrans();
|
||||
}
|
||||
|
||||
|
||||
void QLightTextItem::setColor( const QColor &color )
|
||||
{
|
||||
this->setBrush( color );
|
||||
}
|
||||
|
||||
|
||||
void QLightTextItem::setAlignment( Qt::Alignment align )
|
||||
{
|
||||
m_alignment = align;
|
||||
updateTrans();
|
||||
}
|
||||
|
||||
void QLightTextItem::updateTrans()
|
||||
{
|
||||
double size = this->boundingRect().width();
|
||||
|
||||
QTransform trans;
|
||||
trans.scale( 0.5, 0.5 );
|
||||
switch( m_alignment ) {
|
||||
case Qt::AlignRight : trans.translate( -size, 0 ); break;
|
||||
case Qt::AlignCenter : trans.translate( -size / 2.0, 0 ); break;
|
||||
}
|
||||
this->setTransform( trans );
|
||||
}
|
||||
|
||||
RegisterController< QShapeControllerText > regControllerText;
|
||||
|
||||
@@ -69,20 +122,21 @@ QItemDialog *QShapeControllerText::createDialog( QWidget *parent ) const
|
||||
|
||||
void QShapeControllerText::writeData( QXmlStreamWriter &writer, const QGraphicsItem *item ) const
|
||||
{
|
||||
const QGraphicsSimpleTextItem *textItem = static_cast< const QGraphicsSimpleTextItem * >( item );
|
||||
const QLightTextItem *textItem = static_cast< const QLightTextItem * >( item );
|
||||
writer.writeEmptyElement( "pos" );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "x", QString::number( textItem->pos().x() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "y", QString::number( textItem->pos().y() ) ) );
|
||||
writer.writeAttribute( QXmlStreamAttribute( "z", QString::number( textItem->zValue() ) ) );
|
||||
|
||||
writer.writeTextElement( "font", textItem->font().toString() );
|
||||
writer.writeTextElement( "color", textItem->brush().color().name() );
|
||||
writer.writeTextElement( "color", textItem->color().name() );
|
||||
writer.writeTextElement( "text", textItem->text() );
|
||||
writer.writeTextElement( "alignment", QString::number( textItem->alignment() ) );
|
||||
}
|
||||
|
||||
void QShapeControllerText::replace( QGraphicsItem *item, const QString &from, const QString &to ) const
|
||||
{
|
||||
QGraphicsSimpleTextItem *textItem = static_cast< QGraphicsSimpleTextItem * >( item );
|
||||
QLightTextItem *textItem = static_cast< QLightTextItem * >( item );
|
||||
|
||||
bool placeHolder = textItem->text().left( 1 ) == "?" && textItem->text().right( 1 ) == "?";
|
||||
|
||||
@@ -102,7 +156,7 @@ void QShapeControllerText::readData( const QString &element,
|
||||
const QString &data,
|
||||
QGraphicsItem *item ) const
|
||||
{
|
||||
QGraphicsSimpleTextItem *textItem = static_cast< QGraphicsSimpleTextItem * >( item );
|
||||
QLightTextItem *textItem = static_cast< QLightTextItem * >( item );
|
||||
|
||||
if( element == "pos" ) {
|
||||
textItem->setPos( attrs.value( "x" ).toString().toDouble(),
|
||||
@@ -119,7 +173,7 @@ void QShapeControllerText::readData( const QString &element,
|
||||
}
|
||||
|
||||
if( element == "color" ) {
|
||||
textItem->setBrush( QColor( data ) );
|
||||
textItem->setColor( QColor( data ) );
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,4 +181,9 @@ void QShapeControllerText::readData( const QString &element,
|
||||
textItem->setText( data );
|
||||
return;
|
||||
}
|
||||
|
||||
if( element == "alignment" ) {
|
||||
textItem->setAlignment( Qt::Alignment( data.toInt() ) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,22 @@ class QLightTextItem : public QGraphicsSimpleTextItem
|
||||
public:
|
||||
QLightTextItem();
|
||||
|
||||
QString text() const;
|
||||
Qt::Alignment alignment() const;
|
||||
QColor color() const;
|
||||
|
||||
void setText( const QString &txt );
|
||||
void setColor( const QColor &color );
|
||||
void setFont( const QFont &font );
|
||||
void setAlignment( Qt::Alignment align );
|
||||
|
||||
protected:
|
||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant & value );
|
||||
|
||||
private:
|
||||
void updateTrans();
|
||||
|
||||
Qt::Alignment m_alignment;
|
||||
};
|
||||
|
||||
class QShapeControllerText : public QShapeController {
|
||||
|
||||
@@ -67,6 +67,7 @@ const char * const DBusManagerPath = "@QLSCRIBE_DBUS_MANAGER_PATH@";
|
||||
// config keys
|
||||
const char * const cfgDefaultFont = "DefaultTextFont";
|
||||
const char * const cfgEjectAfterFinish = "EjectAfterFinish";
|
||||
const char * const cfgInjectPreview = "InjectPreview";
|
||||
|
||||
|
||||
#endif // QLSCRIBE_H
|
||||
|
||||
+4
-2
@@ -21,7 +21,8 @@ SOURCES += main.cpp \
|
||||
qlightpixmapitem.cpp \
|
||||
qdialogcdproperties.cpp \
|
||||
qconsoleprintprogress.cpp \
|
||||
qdialogsettings.cpp
|
||||
qdialogsettings.cpp \
|
||||
previewinjector.cpp
|
||||
QMAKE_LIBS += -llightscribe
|
||||
HEADERS += mainwindow.h \
|
||||
qlightroundtextitem.h \
|
||||
@@ -38,7 +39,8 @@ HEADERS += mainwindow.h \
|
||||
qlightpixmapitem.h \
|
||||
qdialogcdproperties.h \
|
||||
qconsoleprintprogress.h \
|
||||
qdialogsettings.h
|
||||
qdialogsettings.h \
|
||||
previewinjector.h
|
||||
FORMS += qdialogtext.ui \
|
||||
qdialogroundtext.ui \
|
||||
qdialogpixmap.ui \
|
||||
|
||||
Reference in New Issue
Block a user