19 Commits

Author SHA1 Message Date
ruglory 8d3ae587dd Tagging the 0.6 release
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/tags/release-0.6@58 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-05 01:45:51 +00:00
ruglory 4f826f942d label mode radiobutton is set from scene on initialization
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@57 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-05 01:44:55 +00:00
ruglory 5497269ca7 Bug with changing mode without changing picture fixed
Sizes for different modes adjusted


git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@56 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-05 01:39:05 +00:00
ruglory f3a8eef96f Fixed bug with loading old save file with black color
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@55 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 23:21:23 +00:00
ruglory c8a517b222 added news for 0.6
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@54 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 23:02:45 +00:00
ruglory 76ea823c6f Dialog added to edit CD properties
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@53 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 22:55:44 +00:00
ruglory 0b80340d5e Label mode in background color is added to cd scene
Menu item new replaced with new lables with subitems
cd view shows cd scene mode and color
print dialog gets cd scene mode


git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@52 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 19:32:39 +00:00
ruglory e3d9befa07 header added for projectwise includes
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@51 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 19:30:38 +00:00
ruglory 545eb3a9bb default y position changed to -40 as more usable
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@50 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 19:27:34 +00:00
ruglory 3dc6e5badd prepared for 0.6
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@49 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-04 18:11:03 +00:00
ruglory 14fb9dfd2b git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@47 cac9541e-1b8d-4bfa-827e-589bba606050 2009-02-01 02:19:03 +00:00
ruglory 890990fb64 News updated for 0.5 release
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@46 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-01 02:18:39 +00:00
ruglory 759cf0f28a Fixed bug wit missing button "OK" on pixmap edit dialog
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@45 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-01 02:13:33 +00:00
ruglory 178c6ad757 Text scaled to 1/2
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@44 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-01 02:08:05 +00:00
ruglory e196cb6bf5 Fixed bug with not setting color on round text
Text scaled to 1/2


git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@43 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-01 02:07:35 +00:00
ruglory 4ed5ad84db Maximum image size increased to 150
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@42 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-01 02:05:07 +00:00
ruglory a828af2348 CD inner size updated
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@41 cac9541e-1b8d-4bfa-827e-589bba606050
2009-02-01 02:04:10 +00:00
ruglory 9c8e9bde5f Bugfix for crash on writing
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@40 cac9541e-1b8d-4bfa-827e-589bba606050
2009-01-31 20:02:59 +00:00
ruglory 6bba618cad About is prepared for release 0.5
git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@39 cac9541e-1b8d-4bfa-827e-589bba606050
2009-01-31 05:06:00 +00:00
24 changed files with 663 additions and 75 deletions
+13
View File
@@ -1,5 +1,18 @@
NEWS - list of user-visible changes between releases of qlscribe
New in 0.6:
Label mode and background color is added to scene
Added dialog to edit properties (color and mode) of the scene (label)
Scene passes mode to the print dialog
New in 0.5:
Bugfix for crash on writing
CD inner size increased to 25mm on QCDView
Maximum image size increased to 150
Fixed bug with not setting color on round text
Text scaled to 1/2
Fixed bug with missing button "OK" on pixmap edit dialog
New in 0.4:
Scene detects when item is moved by mouse and changes status to unsaved
On installation sticky bit is set, qlscribe becomes root when burns label
+8 -5
View File
@@ -18,14 +18,17 @@
#
# $Id$
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 )
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)
SET( QLSCRIBE_UIS qdialogtext.ui qdialogroundtext.ui qdialogpixmap.ui qdialogprint.ui qdialogprogress.ui )
SET( QLSCRIBE_UIS qdialogtext.ui qdialogroundtext.ui qdialogpixmap.ui
qdialogprint.ui qdialogprogress.ui qdialogcdproperties.ui)
SET( QLSCRIBE_MOC_HDRS mainwindow.h qcdscene.h qdialogpixmap.h qdialogroundtext.h
qdialogtext.h qlightscribe.h qdialogprint.h qdialogprogress.h )
qdialogtext.h qlightscribe.h qdialogprint.h qdialogprogress.h
qdialogcdproperties.h)
ADD_DEFINITIONS( -Wall )
+39 -6
View File
@@ -26,6 +26,7 @@
#include "qlightscribe.h"
#include "qdialogprint.h"
#include "qdialogprogress.h"
#include "qdialogcdproperties.h"
#include <QMenuBar>
#include <QStatusBar>
@@ -37,19 +38,36 @@
#include <QLabel>
#include <QCloseEvent>
MainWindow::MainWindow( bool enablePrint )
: QMainWindow( 0 ),
m_mdiArea( new QMdiArea( this ) ),
m_menuFile( 0 ), m_menuInsert( 0 ),
m_insertMapper( new QSignalMapper( this ) )
m_insertMapper( new QSignalMapper( this ) ),
m_newLabelMapper( new QSignalMapper( this ) )
{
setCentralWidget( m_mdiArea );
m_menuFile = menuBar()->addMenu( tr( "File", "Menu item \"File\"" ) );
m_menuFile->addAction( tr( "New", "Menu item \"New\"" ),
this,
SLOT(onMenuNew()) );
{
QMenu *newSubMenu = m_menuFile->addMenu( tr( "New label", "Menu item \"New lable\"" ) );
QAction *action = newSubMenu->addAction( tr( "Full", "Menu item \"Full\"" ),
m_newLabelMapper,
SLOT(map()) );
m_newLabelMapper->setMapping( action, modeFull );
action = newSubMenu->addAction( tr( "Content", "Menu item \"Content\"" ),
m_newLabelMapper,
SLOT(map()) );
m_newLabelMapper->setMapping( action, modeContent );
action = newSubMenu->addAction( tr( "Title", "Menu item \"Title\"" ),
m_newLabelMapper,
SLOT(map()) );
m_newLabelMapper->setMapping( action, modeTitle );
}
connect( m_newLabelMapper, SIGNAL(mapped(int)), this, SLOT(onMenuNewLabel(int)) );
m_menuFile->addAction( tr( "Open...", "Menu item \"Open\"" ),
this,
@@ -66,6 +84,12 @@ MainWindow::MainWindow( bool enablePrint )
m_menuFile->addSeparator();
m_menuFile->addAction( tr( "Label properties...", "Menu item \"Label propeties...\"" ),
this,
SLOT(onMenuProperties()) );
m_menuFile->addSeparator();
m_menuFile->addAction( tr( "Print preview...", "Menu item \"Print preview\"" ),
this,
SLOT(onMenuPrintPreview()) );
@@ -173,10 +197,11 @@ bool MainWindow::saveScene( QCDScene *scene )
event->accept();
}
void MainWindow::onMenuNew()
void MainWindow::onMenuNewLabel( int mode )
{
QCDView *newView = new QCDView;
QCDScene *scene = new QCDScene( newView );
scene->setLabelMode( LabelMode( mode ) );
newView->setScene( scene );
scene->setName();
@@ -260,6 +285,13 @@ void MainWindow::onMenuSaveAs()
saveSceneAs( scene );
}
void MainWindow::onMenuProperties()
{
QCDScene *scene = getScene( m_mdiArea );
if( scene )
QDialogCDProperties::exec( this, scene );
}
void MainWindow::onMenuPrintPreview()
{
QCDScene *cdscene = getScene( m_mdiArea );
@@ -267,6 +299,7 @@ void MainWindow::onMenuPrintPreview()
return;
QLightScribe::PrintParameters params;
params.m_labelMode = cdscene->labelMode();
QLightDrive *drive = QDialogPrint::exec( this, params );
if( !drive )
return;
@@ -299,7 +332,7 @@ void MainWindow::onMenuAbout()
QMessageBox::about( this,
tr( "About" ),
tr( "<h3>qlscribe - Qt lisghtScribe</h3>"
"<p>release 0.4 $Revision$</p>"
"<p>release 0.6 $Revision$</p>"
"<p>visit project at home page "
"<a href=\"http://qlscribe.sourceforge.net/\">qlscribe.sourceforge.net</a></p>" ) );
}
+3 -1
View File
@@ -39,10 +39,11 @@ protected:
virtual void closeEvent( QCloseEvent *event );
private slots:
void onMenuNew();
void onMenuNewLabel( int mode );
void onMenuOpen();
void onMenuSave();
void onMenuSaveAs();
void onMenuProperties();
void onMenuPrintPreview();
void onMenuPrint();
void onMenuInsert( int id );
@@ -59,6 +60,7 @@ private:
QMenu *m_menuHelp;
QSignalMapper *m_insertMapper;
QSignalMapper *m_newLabelMapper;
};
#endif // MAINWINDOW_H
+27 -2
View File
@@ -35,7 +35,9 @@
QCDScene::QCDScene( QObject * parent )
: QGraphicsScene( parent ),
m_index( 0 ),
m_saved( true )
m_saved( true ),
m_labelMode( modeFull ),
m_cdColor( Qt::white )
{
setSceneRect( -60.0, -60.0, 60.0 * 2, 60.0 * 2 );
}
@@ -82,6 +84,20 @@ bool QCDScene::save()
return true;
}
void QCDScene::setLabelMode( LabelMode mode )
{
m_labelMode = mode;
update();
setChanged();
}
void QCDScene::setCDColor( const QColor &color )
{
m_cdColor = color;
update();
setChanged();
}
void QCDScene::setName()
{
if( m_fileName.isEmpty() ) {
@@ -107,7 +123,7 @@ void QCDScene::setChanged()
void QCDScene::updateTitles() const
{
QString name = m_name;
QString name = tr( "Label: ", "Window title \"Label\"" ) + m_name;
if( !m_saved )
name += " *";
@@ -117,6 +133,10 @@ void QCDScene::updateTitles() const
}
}
void QCDScene::redrawViews() const
{
}
bool QCDScene::saveAs( const QString &fileName )
{
QFile file( fileName );
@@ -137,6 +157,8 @@ void QCDScene::write( QXmlStreamWriter &writer )
{
writer.writeStartDocument();
writer.writeStartElement( "scene" );
writer.writeAttribute( QXmlStreamAttribute( "mode", QString::number( m_labelMode ) ) );
writer.writeAttribute( QXmlStreamAttribute( "color", m_cdColor.name() ) );
QShapeFactory &sfactory = QShapeFactory::instance();
QList<QGraphicsItem *> list = items();
@@ -170,6 +192,9 @@ void QCDScene::read( QXmlStreamReader &reader )
throw QString( "QCDScene: missing expected root element \"scene\", got \"" )
+ elementName + "\" intead";
m_labelMode = LabelMode( reader.attributes().value( "mode" ).toString().toInt() );
QString colorStr = reader.attributes().value( "color" ).toString();
m_cdColor = colorStr.isEmpty() ? Qt::white : QColor( colorStr );
gotScene = true;
continue;
}
+15 -4
View File
@@ -21,6 +21,8 @@
#ifndef QCDSCENE_H
#define QCDSCENE_H
#include "qlscribe.h"
#include <QGraphicsScene>
class QXmlStreamWriter;
@@ -32,6 +34,12 @@ public:
QCDScene( QObject * parent = 0 );
virtual ~QCDScene();
LabelMode labelMode() const { return m_labelMode; }
void setLabelMode( LabelMode mode );
QColor cdColor() const { return m_cdColor; }
void setCDColor( const QColor &color );
bool isSaved() const { return m_saved; }
bool isUnnamed() const { return m_fileName.isEmpty(); }
@@ -42,6 +50,7 @@ public:
bool saveAs( const QString &fileName );
void updateTitles() const;
void redrawViews() const;
QString name() const { return m_name; }
protected:
@@ -59,10 +68,12 @@ private:
void sendItemTo( bool front );
private:
QString m_name;
QString m_fileName;
int m_index;
bool m_saved;
QString m_name;
QString m_fileName;
int m_index;
bool m_saved;
LabelMode m_labelMode;
QColor m_cdColor;
};
#endif //QCDSCENE_H
+48 -8
View File
@@ -27,7 +27,8 @@
QCDView::QCDView( QWidget *parent )
: QGraphicsView( parent ),
m_mask( new QPixmap )
m_mask( new QPixmap ),
m_labelMode( -1 )
{
setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
@@ -83,8 +84,7 @@ void QCDView::closeEvent( QCloseEvent *event )
inline
void drawCircle( QPainter *painter, double radi )
{
painter->drawEllipse( int( -radi ), int( -radi ),
int( radi * 2 ), int( radi * 2 ) );
painter->drawEllipse( QRectF( -radi, -radi, radi * 2, radi * 2 ) );
}
void QCDView::drawCD( QPainter *painter, const QRectF & rect, bool alpha )
@@ -92,11 +92,47 @@ void QCDView::drawCD( QPainter *painter, const QRectF & rect, bool alpha )
painter->setBrush( alpha ? Qt::lightGray : Qt::gray );
painter->drawRect( rect );
painter->setBrush( alpha ? Qt::black : Qt::white );
drawCircle( painter, 59.0 );
const double fullInner = 24.7, fullOuter = 60.0;
painter->setBrush( alpha ? Qt::lightGray : Qt::darkGray );
drawCircle( painter, 21.7 );
QCDScene *cdscene = scene();
if( cdscene ) {
double inner = 0, outer = 0;
switch( cdscene->labelMode() ) {
case modeFull : inner = 24.7; outer = 60.0; break;
case modeTitle : inner = 32.0; outer = 37.4; break;
case modeContent : inner = 25.8; outer = 37.4; break;
}
if( alpha ) {
painter->setBrush( Qt::black );
drawCircle( painter, outer );
painter->setBrush( Qt::lightGray );
drawCircle( painter, inner );
} else {
QColor darker( cdscene->cdColor().darker( 150 ) );
if( outer < fullOuter ) {
painter->setBrush( darker );
drawCircle( painter, fullOuter );
}
painter->setBrush( cdscene->cdColor() );
drawCircle( painter, outer );
if( inner > fullInner ) {
painter->setBrush( darker );
drawCircle( painter, inner );
}
painter->setBrush( Qt::darkGray );
drawCircle( painter, fullInner );
}
} else {
painter->setBrush( alpha ? Qt::black : Qt::white );
drawCircle( painter, fullOuter );
painter->setBrush( alpha ? Qt::lightGray : Qt::darkGray );
drawCircle( painter, fullInner );
}
painter->setBrush( alpha ? Qt::white : Qt::gray );
drawCircle( painter, 10.7 );
@@ -105,7 +141,11 @@ void QCDView::drawCD( QPainter *painter, const QRectF & rect, bool alpha )
void QCDView::drawForeground ( QPainter * painter, const QRectF & rect )
{
if( !painter ) return;
if( m_mask->size() != frameSize() ) {
QCDScene *cdscene = scene();
if( m_mask->size() != frameSize() || ( cdscene && m_labelMode != cdscene->labelMode() ) ) {
if( cdscene )
m_labelMode = cdscene->labelMode();
*m_mask = QPixmap( frameSize() );
{
+1
View File
@@ -49,6 +49,7 @@ private:
void drawCD( QPainter * painter, const QRectF & rect, bool alpha );
QPixmap *m_mask;
int m_labelMode;
};
#endif // QCDVIEW_H
+100
View File
@@ -0,0 +1,100 @@
/* qlscribe - Qt based application to print lightScribe discs
Copyright (C) 2009 Vyacheslav Kononenko <vyacheslav@kononenko.net>
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
$Id$ */
#include "qdialogcdproperties.h"
#include "ui_qdialogcdproperties.h"
#include "qcdscene.h"
#include <QColorDialog>
QDialogCDProperties::QDialogCDProperties(QWidget *parent) :
QDialog(parent),
m_ui(new Ui::QDialogCDProperties)
{
m_ui->setupUi(this);
connect( m_ui->btnColor, SIGNAL(clicked()), this, SLOT(onColor()) );
connect( m_ui->radioModeFull, SIGNAL(toggled(bool)), this, SLOT(onChangeMode()) );
connect( m_ui->radioModeContent, SIGNAL(toggled(bool)), this, SLOT(onChangeMode()) );
connect( m_ui->radioModeTitle, SIGNAL(toggled(bool)), this, SLOT(onChangeMode()) );
}
bool QDialogCDProperties::exec( QWidget *parent, QCDScene *scene )
{
QCDScene lscene;
lscene.setLabelMode( scene->labelMode() );
lscene.setCDColor( scene->cdColor() );
QDialogCDProperties dialog( parent );
dialog.setWindowTitle( tr( "Label properties: ", "Dialog title \"Label properties: \"" )
+ scene->name() );
dialog.m_ui->cdView->setScene( &lscene );
switch( scene->labelMode() ) {
case modeFull : dialog.m_ui->radioModeFull->setChecked( true ); break;
case modeTitle : dialog.m_ui->radioModeTitle->setChecked( true ); break;
case modeContent : dialog.m_ui->radioModeContent->setChecked( true ); break;
}
if( dialog.QDialog::exec() == Rejected ) return false;
scene->setLabelMode( lscene.labelMode() );
scene->setCDColor( lscene.cdColor() );
return true;
}
QDialogCDProperties::~QDialogCDProperties()
{
delete m_ui;
}
void QDialogCDProperties::changeEvent(QEvent *e)
{
switch (e->type()) {
case QEvent::LanguageChange:
m_ui->retranslateUi(this);
break;
default:
break;
}
}
void QDialogCDProperties::onChangeMode()
{
QCDScene *scene = m_ui->cdView->scene();
if( m_ui->radioModeFull->isChecked() )
scene->setLabelMode( modeFull );
if( m_ui->radioModeTitle->isChecked() )
scene->setLabelMode( modeTitle );
if( m_ui->radioModeContent->isChecked() )
scene->setLabelMode( modeContent );
}
void QDialogCDProperties::onColor()
{
QCDScene *scene = m_ui->cdView->scene();
QColor color = QColorDialog::getColor( scene->cdColor(), this );
if( color.isValid() ){
scene->setCDColor( color );
}
}
+53
View File
@@ -0,0 +1,53 @@
/* qlscribe - Qt based application to print lightScribe discs
Copyright (C) 2009 Vyacheslav Kononenko <vyacheslav@kononenko.net>
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
$Id$ */
#ifndef QDIALOGCDPROPERTIES_H
#define QDIALOGCDPROPERTIES_H
#include <QtGui/QDialog>
namespace Ui {
class QDialogCDProperties;
}
class QCDScene;
class QDialogCDProperties : public QDialog {
Q_OBJECT
Q_DISABLE_COPY(QDialogCDProperties)
public:
static bool exec( QWidget *parent, QCDScene *scene );
protected:
virtual void changeEvent(QEvent *e);
private slots:
void onChangeMode();
void onColor();
private:
explicit QDialogCDProperties(QWidget *parent = 0);
virtual ~QDialogCDProperties();
Ui::QDialogCDProperties *m_ui;
};
#endif // QDIALOGCDPROPERTIES_H
+191
View File
@@ -0,0 +1,191 @@
<ui version="4.0" >
<class>QDialogCDProperties</class>
<widget class="QDialog" name="QDialogCDProperties" >
<property name="windowModality" >
<enum>Qt::NonModal</enum>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>398</width>
<height>532</height>
</rect>
</property>
<property name="windowTitle" >
<string>Label properties</string>
</property>
<property name="modal" >
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3" >
<item>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth" >
<number>3</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4" >
<item>
<layout class="QHBoxLayout" name="horizontalLayout" >
<item>
<layout class="QFormLayout" name="formLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Label mode:</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QFrame" name="frame_2" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<widget class="QRadioButton" name="radioModeFull" >
<property name="text" >
<string>Full</string>
</property>
<property name="checked" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioModeTitle" >
<property name="text" >
<string>Title</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="radioModeContent" >
<property name="text" >
<string>Content</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QPushButton" name="btnColor" >
<property name="text" >
<string>Change color...</string>
</property>
<property name="autoDefault" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCDView" name="cdView" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>2</verstretch>
</sizepolicy>
</property>
<property name="baseSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="interactive" >
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QCDView</class>
<extends>QGraphicsView</extends>
<header>qcdview.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>buttonBox</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>QDialogCDProperties</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>258</x>
<y>582</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>QDialogCDProperties</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>326</x>
<y>582</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
+1
View File
@@ -79,6 +79,7 @@ bool QDialogPixmap::exec( QGraphicsItem *graphicsItem )
m_ui->spinWidth->setValue( scale.x() );
m_ui->spinHeight->setValue( scale.y() );
m_ui->lockedRatio->setChecked( scale.x() == scale.y() ? Qt::Checked : Qt::Unchecked );
m_ui->buttonBox->setStandardButtons( m_ui->buttonBox->standardButtons() | QDialogButtonBox::Ok );
}
connect( m_ui->spinX, SIGNAL(valueChanged(double)),
+2 -2
View File
@@ -94,7 +94,7 @@
<double>1.000000000000000</double>
</property>
<property name="maximum" >
<double>70.000000000000000</double>
<double>200.000000000000000</double>
</property>
</widget>
</item>
@@ -111,7 +111,7 @@
<double>1.000000000000000</double>
</property>
<property name="maximum" >
<double>70.000000000000000</double>
<double>200.000000000000000</double>
</property>
</widget>
</item>
+11 -2
View File
@@ -54,6 +54,12 @@ QLightDrive *QDialogPrint::exec( QWidget *parent, QLightScribe::PrintParameters
return 0;
}
QDialogPrint dialog( parent );
switch( params.m_labelMode ) {
case modeFull : dialog.m_ui->radioModeFull->setChecked( true ); break;
case modeContent : dialog.m_ui->radioModeContent->setChecked( true ); break;
case modeTitle : dialog.m_ui->radioModeTitle->setChecked( true ); break;
}
int index = 0;
foreach( QLightDrive *drv, drives ) {
dialog.m_ui->comboDrive->insertItem( index++, drv->displayName() );
@@ -63,11 +69,14 @@ QLightDrive *QDialogPrint::exec( QWidget *parent, QLightScribe::PrintParameters
params = QLightScribe::PrintParameters(); // reset to default
if( dialog.m_ui->radioModeFull->isChecked() )
params.m_labelMode = modeFull;
if( dialog.m_ui->radioModeTitle->isChecked() )
params.m_labelMode = QLightScribe::modeTitle;
params.m_labelMode = modeTitle;
if( dialog.m_ui->radioModeContent->isChecked() )
params.m_labelMode = QLightScribe::modeContent;
params.m_labelMode = modeContent;
if( dialog.m_ui->radioQualityNormal->isChecked() )
params.m_printQuality = QLightScribe::qualityNormal;
+1
View File
@@ -62,6 +62,7 @@ void QDialogProgress::changeEvent(QEvent *e)
bool QDialogProgress::exec( QWidget *parent, QCDScene *scene )
{
QLightScribe::PrintParameters params;
params.m_labelMode = scene->labelMode();
QLightDrive *drive = QDialogPrint::exec( parent, params );
if( !drive )
return false;
+1
View File
@@ -129,6 +129,7 @@ void QDialogRoundText::onFont()
{
bool ok = true;
QFont font = QFontDialog::getFont( &ok, m_item->font(), this );
//font.setPointSizeF( font.pointSizeF() / 2.0 );
if( ok ) {
m_item->setFont( font );
fontChanged();
+3
View File
@@ -206,6 +206,9 @@
</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>
+4 -3
View File
@@ -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$ */
#include "qdialogtext.h"
#include "ui_qdialogtext.h"
@@ -32,8 +32,8 @@ QDialogText::QDialogText(QWidget *parent) :
m_item( 0 )
{
m_ui->setupUi(this);
connect( m_ui->btnFont, SIGNAL(clicked()), this, SLOT(onFont()) );
connect( m_ui->btnColor, SIGNAL(clicked()), this, SLOT(onColor()) );
connect( m_ui->btnFont, SIGNAL(clicked()), this, SLOT(onFont()) );
connect( m_ui->btnColor, SIGNAL(clicked()), this, SLOT(onColor()) );
}
QDialogText::~QDialogText()
@@ -66,6 +66,7 @@ bool QDialogText::exec( QGraphicsItem *graphicsItem )
m_item->setText( item->text() );
m_item->setFont( item->font() );
m_item->setBrush( item->brush() );
m_item->setTransform( item->transform() );
scene.addItem( m_item );
+18 -4
View File
@@ -27,6 +27,7 @@
#include <QStyleOptionGraphicsItem>
#include <QMessageBox>
#include <QXmlStreamWriter>
#include <QTextLayout>
#include <math.h>
@@ -37,6 +38,7 @@ QLightRoundTextItem::QLightRoundTextItem( QGraphicsItem *parent )
m_alignment( Qt::AlignLeft ),
m_outside( true )
{
setBrush( Qt::black );
}
const QFont & QLightRoundTextItem::font() const
@@ -118,7 +120,9 @@ QRectF QLightRoundTextItem::boundingRect() const
QPainterPath QLightRoundTextItem::shape() const
{
QFontMetrics mcs( m_font );
QFont font( m_font );
font.setPointSizeF( m_font.pointSizeF() / 2 );
QFontMetrics mcs( font );
double arcAngle = 0.0;
const double pad = 1;
@@ -172,11 +176,13 @@ void QLightRoundTextItem::paint( QPainter *painter, const QStyleOptionGraphicsIt
if( !painter || !m_radius ) return;
painter->save();
painter->setFont( m_font );
QFont font( m_font );
font.setPointSizeF( m_font.pointSizeF() / 2 );
painter->setFont( font );
//painter->drawEllipse( - m_radius, - m_radius, m_radius * 2, m_radius * 2 );
QFontMetrics mcs( m_font );
QFontMetrics mcs( font );
const double radi = m_radius - ( m_outside ? 0 : mcs.xHeight() );
const double diam = 2 * radi;
@@ -193,8 +199,14 @@ void QLightRoundTextItem::paint( QPainter *painter, const QStyleOptionGraphicsIt
QTransform trans;
trans.rotateRadians( angle );
painter->setRenderHint( QPainter::TextAntialiasing, true );
painter->setWorldTransform( trans, true );
QPen p;
p.setBrush( brush() );
painter->setPen( p );
painter->setBrush( Qt::NoBrush );
int prevWidth = 0;
for( int i = 0; i < m_text.size(); ++i ) {
QChar ch = m_text[ i ];
@@ -203,6 +215,7 @@ void QLightRoundTextItem::paint( QPainter *painter, const QStyleOptionGraphicsIt
trans.reset();
trans.rotateRadians( m_outside ? d : -d );
painter->setWorldTransform( trans, true );
prevWidth = mcs.width( ch );
painter->drawText( int( -prevWidth / 2.0 ),
@@ -239,7 +252,8 @@ QString QShapeControllerRoundText::menuName() const
QGraphicsItem *QShapeControllerRoundText::create() const
{
return new QLightRoundTextItem;
QLightRoundTextItem *item = new QLightRoundTextItem;
return item;
}
QItemDialog *QShapeControllerRoundText::createDialog( QWidget *parent ) const
+77 -25
View File
@@ -202,6 +202,66 @@ bool QLightScribe::clReportLabelTimeEstimate(long time)
}
namespace {
class AutoUidSetter {
public:
AutoUidSetter() : m_saved( 0 ) {}
AutoUidSetter( uid_t userId ) : m_saved( 0 ) { set( userId ); }
~AutoUidSetter() { unset(); }
void set( uid_t userId )
{
if( userId ) {
setreuid( userId, 0 );
m_saved = userId;
}
}
void unset()
{
if( m_saved ) {
setreuid( 0, m_saved );
m_saved = 0;
}
}
private:
uid_t m_saved;
};
typedef void (LightScribe::DiscPrinter::*DiscPrinterOp)();
template<DiscPrinterOp dlock, DiscPrinterOp dunlock >
class AutoOp {
public:
AutoOp( LightScribe::DiscPrinter &printer ) : m_printer( &printer ), m_locked( false ) {}
AutoOp() { unlock(); }
void lock()
{
if( !m_locked ) {
(m_printer->*dlock)();
m_locked = true;
}
}
void unlock()
{
if( m_locked ) {
try {
(m_printer->*dunlock)();
}
catch(...){}
m_locked = false;
}
}
private:
LightScribe::DiscPrinter *m_printer;
bool m_locked;
};
}
extern uid_t realUserId;
void QLightScribe::run()
@@ -257,12 +317,17 @@ void QLightScribe::run()
throw tr( "Cannot find drive: \"" ) + m_task->m_selectedDrive->displayName() + "\"";
DiscPrinter printer = printers.Item( found );
AutoUidSetter autoUid;
AutoOp< &DiscPrinter::AddExclusiveUse, &DiscPrinter::ReleaseExclusiveUse > autoExclusive( printer );
AutoOp< &DiscPrinter::LockDriveTray, &DiscPrinter::UnlockDriveTray > autoLock( printer );
if( m_task->m_action == Task::print ) {
setreuid( realUserId, 0 );
autoUid.set( realUserId );
function = "LS_DiscPrinter_AddExclusiveUse";
printer.AddExclusiveUse();
autoExclusive.lock();
function = "LS_DiscPrinter_LockDriveTray";
printer.LockDriveTray();
autoLock.lock();
}
{
@@ -308,31 +373,18 @@ void QLightScribe::run()
m_task = 0;
lock.unlock();
// print here
try {
session.PrintDisc( LS_windows_bitmap,
LS_LabelMode( params.m_labelMode ),
LS_DrawOptions( params.m_drawOptions ),
LS_PrintQuality( params.m_printQuality ),
LS_MediaOptimizationLevel( params.m_mediaOptimizationLevel ),
ba.data() + 14,
bitmapHeaderSize - 14,
ba.data() + bitmapHeaderSize,
ba.size() - bitmapHeaderSize );
}
catch( LightScribe::LSException &ex ) {
emit finished( ex.GetCode() );
throw;
}
session.PrintDisc( LS_windows_bitmap,
LS_LabelMode( params.m_labelMode ),
LS_DrawOptions( params.m_drawOptions ),
LS_PrintQuality( params.m_printQuality ),
LS_MediaOptimizationLevel( params.m_mediaOptimizationLevel ),
ba.data() + 14,
bitmapHeaderSize - 14,
ba.data() + bitmapHeaderSize,
ba.size() - bitmapHeaderSize );
}
}
if( m_task->m_action == Task::print ) {
function = "LS_DiscPrinter_UnlockDriveTray";
printer.UnlockDriveTray();
function = "LS_DiscPrinter_ReleaseExclusiveUse";
printer.ReleaseExclusiveUse();
setreuid( 0, realUserId );
}
function = "";
}
}
+2 -9
View File
@@ -21,6 +21,8 @@
#ifndef QLIGHTSCRIBE_H
#define QLIGHTSCRIBE_H
#include "qlscribe.h"
#include <QThread>
#include <QPixmap>
@@ -37,15 +39,6 @@ class QLightDrive;
class QLightScribe : public QThread {
Q_OBJECT
public:
enum LabelMode {
/** label the entire disc */
modeFull=0,
/** label within the title mode constraints */
modeTitle=1,
/** label within the content mode constraints */
modeContent=2
};
enum DrawOptions {
/** disable scaling of bitmaps; they will be cropped if needed */
drawDefault=0,
+5 -1
View File
@@ -53,7 +53,11 @@ QString QShapeControllerText::menuName() const
QGraphicsItem *QShapeControllerText::create() const
{
return new QLightTextItem;
QGraphicsItem *item = new QLightTextItem;
item->setTransform( QTransform().scale( 0.5, 0.5 ), true );
item->setPos( 0, -40.0 );
return item;
}
QItemDialog *QShapeControllerText::createDialog( QWidget *parent ) const
+33
View File
@@ -0,0 +1,33 @@
/* qlscribe - Qt based application to print lightScribe discs
Copyright (C) 2009 Vyacheslav Kononenko <vyacheslav@kononenko.net>
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
$Id:$ */
#ifndef QLSCRIBE_H
#define QLSCRIBE_H
enum LabelMode {
/** label the entire disc */
modeFull=0,
/** label within the title mode constraints */
modeTitle=1,
/** label within the content mode constraints */
modeContent=2
};
#endif // QLSCRIBE_H
+7 -3
View File
@@ -18,7 +18,8 @@ SOURCES += main.cpp \
qdialogprint.cpp \
qdialogprogress.cpp \
qlighttextitem.cpp \
qlightpixmapitem.cpp
qlightpixmapitem.cpp \
qdialogcdproperties.cpp
QMAKE_LIBS += -llightscribe
HEADERS += mainwindow.h \
qlightroundtextitem.h \
@@ -32,9 +33,12 @@ HEADERS += mainwindow.h \
qdialogprint.h \
qdialogprogress.h \
qlighttextitem.h \
qlightpixmapitem.h
qlightpixmapitem.h \
qlscribe.h \
qdialogcdproperties.h
FORMS += qdialogtext.ui \
qdialogroundtext.ui \
qdialogpixmap.ui \
qdialogprint.ui \
qdialogprogress.ui
qdialogprogress.ui \
qdialogcdproperties.ui