diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2969a45..43a3ce6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -24,14 +24,15 @@ SET( QT_USE_QTDBUS 1 )
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)
+ qdialogprint.cpp qdialogprogress.cpp qdialogcdproperties.cpp qconsoleprintprogress.cpp
+ qdialogsettings.cpp )
SET( QLSCRIBE_UIS qdialogtext.ui qdialogroundtext.ui qdialogpixmap.ui
- qdialogprint.ui qdialogprogress.ui qdialogcdproperties.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)
+ qdialogcdproperties.h qconsoleprintprogress.h qdialogsettings.h )
ADD_DEFINITIONS( -Wall )
diff --git a/src/lightscribe.xml b/src/lightscribe.xml
index d9c5870..8bef6ec 100644
--- a/src/lightscribe.xml
+++ b/src/lightscribe.xml
@@ -47,13 +47,13 @@
-
+
-
+
diff --git a/src/main.cpp b/src/main.cpp
index 4b78427..802f3eb 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -56,6 +56,9 @@ void usage()
int main( int argc, char **argv )
{
QApplication app( argc, argv );
+ app.setApplicationName( "qlscribe" );
+ //app.setOrganizationName( "" );
+ app.setOrganizationDomain( "qlscribe.sourceforge.org" );
app.addLibraryPath( "/usr/lib32/qt4/plugins" );
app.setWindowIcon( QIcon( ":/qlscribe64.png" ) );
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 4d88df6..288e070 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -27,6 +27,7 @@
#include "qdialogprint.h"
#include "qdialogprogress.h"
#include "qdialogcdproperties.h"
+#include "qdialogsettings.h"
#include
#include
@@ -74,7 +75,8 @@ MainWindow::MainWindow( bool enablePrint )
m_menuFile->addAction( tr( "Open...", "Menu item \"Open\"" ),
this,
- SLOT(onMenuOpen()) );
+ SLOT(onMenuOpen()),
+ QKeySequence( Qt::CTRL + Qt::Key_O ) );
m_actionSave = m_menuFile->addAction( tr( "Save", "Menu item \"Save\"" ),
this,
@@ -107,7 +109,7 @@ MainWindow::MainWindow( bool enablePrint )
m_menuFile->addAction( tr( "Exit", "Menu item \"Exit\"" ),
this,
SLOT(close()),
- QKeySequence( Qt::CTRL + Qt::Key_X ) );
+ QKeySequence( Qt::CTRL + Qt::Key_Q ) );
m_menuEdit = menuBar()->addMenu( tr( "Edit", "Menu item \"Edit\"" ) );
@@ -139,6 +141,12 @@ MainWindow::MainWindow( bool enablePrint )
m_menuInsert = m_menuEdit->addMenu( tr( "Insert", "Menu item \"Insert\"" ) );
+ m_menuEdit->addSeparator();
+
+ m_actionSettings = m_menuEdit->addAction( tr( "Settings...", "Menu item \"Settings\"" ),
+ this,
+ SLOT(onMenuSettings()) );
+
m_menuHelp = menuBar()->addMenu( tr( "Help", "Menu item \"Help\"" ) );
m_menuHelp->addAction( tr( "About...", "Menu item \"About\"" ),
@@ -379,8 +387,8 @@ void MainWindow::onMenuPrint()
{
QCDScene *cdscene = getScene( m_mdiArea );
if( !cdscene )
-
return;
+
try {
QDialogProgress::exec( this, cdscene );
}
@@ -439,6 +447,11 @@ void MainWindow::onMenuQtAbout()
QMessageBox::aboutQt( this );
}
+void MainWindow::onMenuSettings()
+{
+ QDialogSettings::exec( this );
+}
+
void MainWindow::updateMenu()
{
QCDScene *scene = getScene( m_mdiArea );
diff --git a/src/mainwindow.h b/src/mainwindow.h
index b2faa6b..72f8e83 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -53,6 +53,7 @@ private slots:
void onMenuCopy();
void onMenuCut();
void onMenuPaste();
+ void onMenuSettings();
void onMenuInsert( int id );
void onMenuAbout();
void onMenuQtAbout();
@@ -79,6 +80,7 @@ private:
QAction *m_actionCopy;
QAction *m_actionCut;
QAction *m_actionPaste;
+ QAction *m_actionSettings;
QSignalMapper *m_insertMapper;
QSignalMapper *m_newLabelMapper;
diff --git a/src/qdialogprogress.cpp b/src/qdialogprogress.cpp
index 4f6e485..8a89e40 100644
--- a/src/qdialogprogress.cpp
+++ b/src/qdialogprogress.cpp
@@ -28,6 +28,7 @@
#include
#include
#include
+#include
QDialogProgress::QDialogProgress( QWidget *parent, QLightDrive *drive )
: QDialog(parent),
@@ -68,6 +69,8 @@ bool QDialogProgress::exec( QWidget *parent, QCDScene *scene )
if( !drive )
return false;
+ params.m_ejectAfterComplete = QSettings().value( cfgEjectAfterFinish, false ).toBool();
+
QDialogProgress dialog( parent, drive );
dialog.setWindowTitle( tr( "Printing: " ) + scene->name() );
diff --git a/src/qdialogsettings.cpp b/src/qdialogsettings.cpp
new file mode 100644
index 0000000..1c73977
--- /dev/null
+++ b/src/qdialogsettings.cpp
@@ -0,0 +1,99 @@
+/* qlscribe - Qt based application to print lightScribe discs
+
+ Copyright (C) 2009 Vyacheslav Kononenko
+
+ 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 "qdialogsettings.h"
+#include "ui_qdialogsettings.h"
+#include "qlscribe.h"
+
+#include
+#include
+
+QFont *QDialogSettings::m_lastUsedFont = 0;
+
+QDialogSettings::QDialogSettings(QWidget *parent) :
+ QDialog( parent ),
+ m_ui( new Ui::QDialogSettings )
+{
+ m_ui->setupUi( this );
+ connect( m_ui->btnFont, SIGNAL(clicked()), this, SLOT(onFont()) );
+ connect( m_ui->btnLastUsedFont, SIGNAL(clicked()), this, SLOT(onLastUsedFont()) );
+ m_ui->btnLastUsedFont->setEnabled( m_lastUsedFont );
+}
+
+QDialogSettings::~QDialogSettings()
+{
+ delete m_ui;
+}
+
+void QDialogSettings::changeEvent(QEvent *e)
+{
+ switch (e->type()) {
+ case QEvent::LanguageChange:
+ m_ui->retranslateUi(this);
+ break;
+ default:
+ break;
+ }
+}
+
+bool QDialogSettings::exec( QWidget *parent )
+{
+ QDialogSettings dialog( parent );
+ QSettings sts;
+ dialog.m_font = sts.value( cfgDefaultFont ).value();
+ dialog.m_ui->fontName->setCurrentFont( dialog.m_font );
+ dialog.m_ui->chkEject->setChecked( sts.value( cfgEjectAfterFinish, false ).toBool() );
+
+ if( dialog.QDialog::exec() == Rejected ) return false;
+
+ sts.setValue( cfgDefaultFont, dialog.m_font );
+ sts.setValue( cfgEjectAfterFinish, dialog.m_ui->chkEject->isChecked() );
+
+ return true;
+}
+
+void QDialogSettings::onFont()
+{
+ bool ok = true;
+ QFont font = QFontDialog::getFont( &ok, m_font, this );
+ if( ok ) {
+ m_font = font;
+ m_ui->fontName->setCurrentFont( font );
+ }
+}
+
+void QDialogSettings::onLastUsedFont()
+{
+ if( m_lastUsedFont ) {
+ m_font = *m_lastUsedFont;
+ m_ui->fontName->setCurrentFont( *m_lastUsedFont );
+ }
+}
+
+void QDialogSettings::setLastUsedFont( const QFont &font )
+{
+ if( !m_lastUsedFont ) m_lastUsedFont = new QFont( font );
+ else *m_lastUsedFont = font;
+}
+
+QFont QDialogSettings::defaultFont()
+{
+ return QSettings().value( cfgDefaultFont ).value();
+}
diff --git a/src/qdialogsettings.h b/src/qdialogsettings.h
new file mode 100644
index 0000000..e545a25
--- /dev/null
+++ b/src/qdialogsettings.h
@@ -0,0 +1,56 @@
+/* qlscribe - Qt based application to print lightScribe discs
+
+ Copyright (C) 2009 Vyacheslav Kononenko
+
+ 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 QDIALOGSETTINGS_H
+#define QDIALOGSETTINGS_H
+
+#include
+
+namespace Ui {
+ class QDialogSettings;
+}
+
+class QDialogSettings : public QDialog {
+ Q_OBJECT
+ Q_DISABLE_COPY(QDialogSettings)
+public:
+
+ static bool exec( QWidget *parent = 0 );
+ static void setLastUsedFont( const QFont &font );
+ static QFont defaultFont();
+
+private:
+ explicit QDialogSettings( QWidget *parent = 0 );
+ virtual ~QDialogSettings();
+
+protected:
+ virtual void changeEvent(QEvent *e);
+
+private slots:
+ void onFont();
+ void onLastUsedFont();
+
+private:
+ Ui::QDialogSettings *m_ui;
+ QFont m_font;
+ static QFont *m_lastUsedFont;
+};
+
+#endif // QDIALOGSETTINGS_H
diff --git a/src/qdialogsettings.ui b/src/qdialogsettings.ui
new file mode 100644
index 0000000..8174e44
--- /dev/null
+++ b/src/qdialogsettings.ui
@@ -0,0 +1,140 @@
+
+ QDialogSettings
+
+
+ Qt::NonModal
+
+
+
+ 0
+ 0
+ 305
+ 156
+
+
+
+ Settings
+
+
+ false
+
+
+ -
+
+
+ QFrame::StyledPanel
+
+
+ QFrame::Raised
+
+
+
-
+
+
-
+
+
+ Default font:
+
+
+
+ -
+
+
+ false
+
+
+ false
+
+
+
+
+
+ -
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Font...
+
+
+
+ -
+
+
+ Last used
+
+
+
+
+
+ -
+
+
+ Eject tray after finish
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+
+ buttonBox
+ accepted()
+ QDialogSettings
+ accept()
+
+
+ 248
+ 254
+
+
+ 157
+ 274
+
+
+
+
+ buttonBox
+ rejected()
+ QDialogSettings
+ reject()
+
+
+ 316
+ 260
+
+
+ 286
+ 274
+
+
+
+
+
diff --git a/src/qdialogtext.cpp b/src/qdialogtext.cpp
index a5be18a..85c0084 100644
--- a/src/qdialogtext.cpp
+++ b/src/qdialogtext.cpp
@@ -21,6 +21,7 @@
#include "qdialogtext.h"
#include "ui_qdialogtext.h"
#include "qcdscene.h"
+#include "qdialogsettings.h"
#include
#include
@@ -97,6 +98,7 @@ void QDialogText::onFont()
QFont font = QFontDialog::getFont( &ok, m_item->font(), this );
if( ok ) {
m_item->setFont( font );
+ QDialogSettings::setLastUsedFont( font );
fontChanged();
}
}
diff --git a/src/qdialogtext.ui b/src/qdialogtext.ui
index 169f2e2..04b7690 100644
--- a/src/qdialogtext.ui
+++ b/src/qdialogtext.ui
@@ -1,8 +1,8 @@
QDialogText
-
- Qt::NonModal
+
+ true
@@ -15,9 +15,6 @@
Text properties
-
- false
-
-
diff --git a/src/qlightroundtextitem.cpp b/src/qlightroundtextitem.cpp
index 148d7ff..f5fa013 100644
--- a/src/qlightroundtextitem.cpp
+++ b/src/qlightroundtextitem.cpp
@@ -21,6 +21,7 @@
#include "qlightroundtextitem.h"
#include "qdialogroundtext.h"
#include "qcdscene.h"
+#include "qdialogsettings.h"
#include
#include
@@ -253,6 +254,7 @@ QString QShapeControllerRoundText::menuName() const
QGraphicsItem *QShapeControllerRoundText::create() const
{
QLightRoundTextItem *item = new QLightRoundTextItem;
+ item->setFont( QDialogSettings::defaultFont() );
return item;
}
diff --git a/src/qlightscribe.cpp b/src/qlightscribe.cpp
index 4b075a6..bb0a594 100644
--- a/src/qlightscribe.cpp
+++ b/src/qlightscribe.cpp
@@ -37,7 +37,7 @@
QDBusArgument &operator<<( QDBusArgument &argument, const PrintParameters &p )
{
argument.beginStructure();
- argument << p.m_labelMode << p.m_drawOptions << p.m_printQuality << p.m_mediaOptimizationLevel;
+ argument << p.m_labelMode << p.m_drawOptions << p.m_printQuality << p.m_mediaOptimizationLevel << (int) p.m_ejectAfterComplete;
argument.endStructure();
return argument;
}
@@ -46,13 +46,14 @@
const QDBusArgument &operator>>( const QDBusArgument &argument, PrintParameters &p )
{
argument.beginStructure();
- int drawOptions = 0, labelMode = 0, mediaOptimizationLevel = 0, printQuality = 0;
- argument >> labelMode >> drawOptions >> printQuality >> mediaOptimizationLevel;
+ int drawOptions = 0, labelMode = 0, mediaOptimizationLevel = 0, printQuality = 0, ejectAfterComplete = 0;
+ argument >> labelMode >> drawOptions >> printQuality >> mediaOptimizationLevel >> ejectAfterComplete;
argument.endStructure();
p = PrintParameters( LabelMode( labelMode ),
DrawOptions( drawOptions ),
PrintQuality( printQuality ),
- MediaOptimizationLevel( mediaOptimizationLevel ) );
+ MediaOptimizationLevel( mediaOptimizationLevel ),
+ ejectAfterComplete );
return argument;
}
diff --git a/src/qlightscribe.h b/src/qlightscribe.h
index 1be57cb..3466e2d 100644
--- a/src/qlightscribe.h
+++ b/src/qlightscribe.h
@@ -35,13 +35,20 @@ struct PrintParameters {
DrawOptions m_drawOptions;
PrintQuality m_printQuality;
MediaOptimizationLevel m_mediaOptimizationLevel;
+ bool m_ejectAfterComplete;
PrintParameters()
: m_labelMode( modeFull ), m_drawOptions( drawDefault ),
- m_printQuality( qualityBest ), m_mediaOptimizationLevel( mediaRecognized ) {}
- PrintParameters( LabelMode labelMode, DrawOptions drawOptions, PrintQuality printQuality, MediaOptimizationLevel mediaOptimizationLevel )
+ m_printQuality( qualityBest ), m_mediaOptimizationLevel( mediaRecognized ), m_ejectAfterComplete( false ) {}
+ PrintParameters( LabelMode labelMode,
+ DrawOptions drawOptions,
+ PrintQuality printQuality,
+ MediaOptimizationLevel mediaOptimizationLevel,
+ bool ejectAfterComplete )
: m_labelMode( labelMode ), m_drawOptions( drawOptions ),
- m_printQuality( printQuality ), m_mediaOptimizationLevel( mediaOptimizationLevel ) {}
+ m_printQuality( printQuality ), m_mediaOptimizationLevel( mediaOptimizationLevel ),
+ m_ejectAfterComplete( ejectAfterComplete )
+ {}
};
Q_DECLARE_METATYPE( PrintParameters );
diff --git a/src/qlighttextitem.cpp b/src/qlighttextitem.cpp
index 0f05cab..4d38c48 100644
--- a/src/qlighttextitem.cpp
+++ b/src/qlighttextitem.cpp
@@ -21,6 +21,7 @@
#include "qlighttextitem.h"
#include "qdialogtext.h"
#include "qcdscene.h"
+#include "qdialogsettings.h"
#include
#include
@@ -53,7 +54,8 @@ QString QShapeControllerText::menuName() const
QGraphicsItem *QShapeControllerText::create() const
{
- QGraphicsItem *item = new QLightTextItem;
+ QLightTextItem *item = new QLightTextItem;
+ item->setFont( QDialogSettings::defaultFont() );
item->setTransform( QTransform().scale( 0.5, 0.5 ), true );
item->setPos( 0, -40.0 );
diff --git a/src/qlscribe.h.in b/src/qlscribe.h.in
index 1533481..2ae2047 100644
--- a/src/qlscribe.h.in
+++ b/src/qlscribe.h.in
@@ -64,4 +64,9 @@ const char * const itemMimeType = "application/x-qlscribe;item";
const char * const DBusServiceName = "@QLSCRIBE_DBUS_MANAGER_SERVICE@";
const char * const DBusManagerPath = "@QLSCRIBE_DBUS_MANAGER_PATH@";
+// config keys
+const char * const cfgDefaultFont = "DefaultTextFont";
+const char * const cfgEjectAfterFinish = "EjectAfterFinish";
+
+
#endif // QLSCRIBE_H
diff --git a/src/qlscribe.pro b/src/qlscribe.pro
index 8920146..6f889b5 100644
--- a/src/qlscribe.pro
+++ b/src/qlscribe.pro
@@ -20,7 +20,8 @@ SOURCES += main.cpp \
qlighttextitem.cpp \
qlightpixmapitem.cpp \
qdialogcdproperties.cpp \
- qconsoleprintprogress.cpp
+ qconsoleprintprogress.cpp \
+ qdialogsettings.cpp
QMAKE_LIBS += -llightscribe
HEADERS += mainwindow.h \
qlightroundtextitem.h \
@@ -36,10 +37,12 @@ HEADERS += mainwindow.h \
qlighttextitem.h \
qlightpixmapitem.h \
qdialogcdproperties.h \
- qconsoleprintprogress.h
+ qconsoleprintprogress.h \
+ qdialogsettings.h
FORMS += qdialogtext.ui \
qdialogroundtext.ui \
qdialogpixmap.ui \
qdialogprint.ui \
qdialogprogress.ui \
- qdialogcdproperties.ui
+ qdialogcdproperties.ui \
+ qdialogsettings.ui