Added a startup wizard.
This commit is contained in:
@@ -43,6 +43,7 @@ set (glabels_sources
|
||||
PreviewOverlayItem.cpp
|
||||
SelectProductDialog.cpp
|
||||
SimplePreview.cpp
|
||||
StartupWizard.cpp
|
||||
TemplatePicker.cpp
|
||||
TemplatePickerItem.cpp
|
||||
TextNode.cpp
|
||||
@@ -77,6 +78,7 @@ set (glabels_qobject_headers
|
||||
Preview.h
|
||||
SelectProductDialog.h
|
||||
SimplePreview.h
|
||||
StartupWizard.h
|
||||
TemplatePicker.h
|
||||
View.h
|
||||
)
|
||||
@@ -87,6 +89,7 @@ set (glabels_forms
|
||||
ui/PrintView.ui
|
||||
ui/PropertiesView.ui
|
||||
ui/SelectProductDialog.ui
|
||||
ui/StartupWizard.ui
|
||||
)
|
||||
|
||||
set (glabels_resource_files
|
||||
|
||||
+19
-5
@@ -22,7 +22,7 @@
|
||||
|
||||
#include "MainWindow.h"
|
||||
#include "LabelModel.h"
|
||||
#include "libglabels/Db.h"
|
||||
#include "SelectProductDialog.h"
|
||||
#include "XmlLabelParser.h"
|
||||
#include "XmlLabelCreator.h"
|
||||
#include "FileUtil.h"
|
||||
@@ -36,17 +36,31 @@
|
||||
///
|
||||
/// New Label Dialog
|
||||
///
|
||||
void File::newLabel( MainWindow *window )
|
||||
bool File::newLabel( MainWindow *window )
|
||||
{
|
||||
// @TODO lookup latest template, if none default based on locale
|
||||
const glabels::Template* tmplate = glabels::Db::lookupTemplateFromBrandPart( "Avery", "5159" );
|
||||
SelectProductDialog dialog( window );
|
||||
dialog.exec();
|
||||
|
||||
const glabels::Template* tmplate = dialog.tmplate();
|
||||
if ( tmplate )
|
||||
{
|
||||
LabelModel* label = new LabelModel();
|
||||
label->setTmplate( tmplate );
|
||||
label->setRotate( false );
|
||||
|
||||
// Intelligently decide to rotate label by default
|
||||
const glabels::Frame* frame = tmplate->frames().first();
|
||||
label->setRotate( frame->h() > frame->w() );
|
||||
|
||||
MainWindow *newWindow = new MainWindow();
|
||||
newWindow->setModel( label );
|
||||
newWindow->show();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ class File : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static void newLabel( MainWindow *window = 0 );
|
||||
static bool newLabel( MainWindow *window = 0 );
|
||||
static void open( MainWindow *window );
|
||||
static bool save( MainWindow *window );
|
||||
static bool saveAs( MainWindow *window );
|
||||
|
||||
+8
-13
@@ -81,6 +81,13 @@ MainWindow::MainWindow()
|
||||
setPasteVerbsEnabled( false );
|
||||
setTitle();
|
||||
|
||||
connect( mView, SIGNAL(zoomChanged()), this, SLOT(onZoomChanged()) );
|
||||
#if 0
|
||||
connect( mView, SIGNAL(pointerMoved(double, double)),
|
||||
this, SLOT(onPointerMoved(double, double)) );
|
||||
connect( mView, SIGNAL(pointerExited()), this, SLOT(onPointerExit()) );
|
||||
#endif
|
||||
|
||||
readSettings();
|
||||
|
||||
smWindowList.push_back( this );
|
||||
@@ -603,19 +610,7 @@ void MainWindow::createToolBars()
|
||||
///
|
||||
void MainWindow::createStatusBar()
|
||||
{
|
||||
cursorInfoLabel = new QLabel;
|
||||
cursorInfoLabel->setIndent( 3 );
|
||||
cursorInfoLabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
|
||||
|
||||
statusBar()->addWidget( cursorInfoLabel, 1 );
|
||||
|
||||
onZoomChanged();
|
||||
onPointerExit();
|
||||
|
||||
connect( mView, SIGNAL(zoomChanged()), this, SLOT(onZoomChanged()) );
|
||||
connect( mView, SIGNAL(pointerMoved(double, double)),
|
||||
this, SLOT(onPointerMoved(double, double)) );
|
||||
connect( mView, SIGNAL(pointerExited()), this, SLOT(onPointerExit()) );
|
||||
statusBar();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/* StartupWizard.cpp
|
||||
*
|
||||
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "StartupWizard.h"
|
||||
|
||||
#include "File.h"
|
||||
#include <QtDebug>
|
||||
|
||||
|
||||
///
|
||||
/// Constructor
|
||||
///
|
||||
StartupWizard::StartupWizard( QWidget *parent )
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi( this );
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// "New Project" Button Clicked Slot
|
||||
///
|
||||
void StartupWizard::onNewProjectButtonClicked()
|
||||
{
|
||||
hide();
|
||||
|
||||
if ( File::newLabel() )
|
||||
{
|
||||
close();
|
||||
}
|
||||
else
|
||||
{
|
||||
show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// "Open Project" Button Clicked Slot
|
||||
///
|
||||
void StartupWizard::onOpenProjectButtonClicked()
|
||||
{
|
||||
qDebug() << "OPEN PROJECT";
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/* StartupWizard.h
|
||||
*
|
||||
* Copyright (C) 2016 Jim Evins <evins@snaught.com>
|
||||
*
|
||||
* This file is part of gLabels-qt.
|
||||
*
|
||||
* gLabels-qt 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 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gLabels-qt 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 gLabels-qt. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef StartupWizard_h
|
||||
#define StartupWizard_h
|
||||
|
||||
#include "ui_StartupWizard.h"
|
||||
|
||||
|
||||
///
|
||||
/// Startup Wizard Dialog Widget
|
||||
///
|
||||
class StartupWizard : public QDialog, public Ui_StartupWizard
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Life Cycle
|
||||
/////////////////////////////////
|
||||
public:
|
||||
StartupWizard( QWidget *parent = 0 );
|
||||
|
||||
|
||||
/////////////////////////////////
|
||||
// Slots
|
||||
/////////////////////////////////
|
||||
private slots:
|
||||
void onNewProjectButtonClicked();
|
||||
void onOpenProjectButtonClicked();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // StartupWizard_h
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#include "File.h"
|
||||
#include "libglabels/Db.h"
|
||||
#include "StartupWizard.h"
|
||||
|
||||
|
||||
int main( int argc, char **argv )
|
||||
@@ -43,7 +43,9 @@ int main( int argc, char **argv )
|
||||
#endif
|
||||
/////////////////////////////////
|
||||
|
||||
File::newLabel();
|
||||
/// @TODO open file(s) from command line if present, otherwise start wizard
|
||||
StartupWizard startupWizard;
|
||||
startupWizard.show();
|
||||
|
||||
return app.exec();
|
||||
}
|
||||
|
||||
@@ -225,11 +225,14 @@
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="changeProductButton">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Select another product for this gLabels project.</p></body></html></string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">text-align:left; padding:3px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select another product</string>
|
||||
<string>Change product</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../icons.qrc">
|
||||
@@ -268,6 +271,9 @@
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Select horizontal or vertical orientation.</string>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
<string>gLabels - Select Product</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StartupWizard</class>
|
||||
<widget class="QDialog" name="StartupWizard">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>339</width>
|
||||
<height>218</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>gLabels - Startup Wizard</string>
|
||||
</property>
|
||||
<property name="windowOpacity">
|
||||
<double>0.000000000000000</double>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>319</width>
|
||||
<height>53</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>53</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">padding:8px;</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-size:24pt; font-weight:600;">gLabels </span><span style=" font-size:16pt; color:#909090;">Label Designer</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCommandLinkButton" name="newProjectButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>319</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Project</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>Create a new blank gLabels project</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCommandLinkButton" name="openProjectButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>319</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>59</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open Project</string>
|
||||
</property>
|
||||
<property name="description">
|
||||
<string>Open an existing gLabels project</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../images.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>newProjectButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>StartupWizard</receiver>
|
||||
<slot>onNewProjectButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>291</x>
|
||||
<y>102</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>108</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>openProjectButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
<receiver>StartupWizard</receiver>
|
||||
<slot>onOpenProjectButtonClicked()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>312</x>
|
||||
<y>170</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>338</x>
|
||||
<y>169</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>onNewProjectButtonClicked()</slot>
|
||||
<slot>onOpenProjectButtonClicked()</slot>
|
||||
</slots>
|
||||
</ui>
|
||||
Reference in New Issue
Block a user