Hook up File::open to StartupWizard.
This commit is contained in:
+12
-15
@@ -36,9 +36,9 @@
|
|||||||
///
|
///
|
||||||
/// New Label Dialog
|
/// New Label Dialog
|
||||||
///
|
///
|
||||||
bool File::newLabel( MainWindow *window )
|
bool File::newLabel( QWidget *parent )
|
||||||
{
|
{
|
||||||
SelectProductDialog dialog( window );
|
SelectProductDialog dialog( parent );
|
||||||
dialog.exec();
|
dialog.exec();
|
||||||
|
|
||||||
const glabels::Template* tmplate = dialog.tmplate();
|
const glabels::Template* tmplate = dialog.tmplate();
|
||||||
@@ -67,13 +67,13 @@ bool File::newLabel( MainWindow *window )
|
|||||||
///
|
///
|
||||||
/// Open File Dialog
|
/// Open File Dialog
|
||||||
///
|
///
|
||||||
void File::open( MainWindow *window )
|
bool File::open( QWidget *parent )
|
||||||
{
|
{
|
||||||
QString fileName =
|
QString fileName =
|
||||||
QFileDialog::getOpenFileName( window,
|
QFileDialog::getOpenFileName( parent,
|
||||||
tr("Open label"),
|
tr("Open label"),
|
||||||
".",
|
".",
|
||||||
tr("glabels files (*.glabels);;All files (*)")
|
tr("glabels project files (*.glabels);;All files (*)")
|
||||||
);
|
);
|
||||||
if ( !fileName.isEmpty() )
|
if ( !fileName.isEmpty() )
|
||||||
{
|
{
|
||||||
@@ -82,16 +82,11 @@ void File::open( MainWindow *window )
|
|||||||
{
|
{
|
||||||
label->setFileName( fileName );
|
label->setFileName( fileName );
|
||||||
|
|
||||||
if ( window->isEmpty() )
|
MainWindow *newWindow = new MainWindow();
|
||||||
{
|
newWindow->setModel( label );
|
||||||
window->setModel( label );
|
newWindow->show();
|
||||||
}
|
|
||||||
else
|
return true;
|
||||||
{
|
|
||||||
MainWindow *newWindow = new MainWindow();
|
|
||||||
newWindow->setModel( label );
|
|
||||||
newWindow->show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -102,6 +97,8 @@ void File::open( MainWindow *window )
|
|||||||
msgBox.exec();
|
msgBox.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -36,8 +36,8 @@ class File : public QObject
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static bool newLabel( MainWindow *window = 0 );
|
static bool newLabel( QWidget *parent = 0 );
|
||||||
static void open( MainWindow *window );
|
static bool open( QWidget *parent = 0 );
|
||||||
static bool save( MainWindow *window );
|
static bool save( MainWindow *window );
|
||||||
static bool saveAs( MainWindow *window );
|
static bool saveAs( MainWindow *window );
|
||||||
static void print( MainWindow *window );
|
static void print( MainWindow *window );
|
||||||
|
|||||||
@@ -57,5 +57,14 @@ void StartupWizard::onNewProjectButtonClicked()
|
|||||||
///
|
///
|
||||||
void StartupWizard::onOpenProjectButtonClicked()
|
void StartupWizard::onOpenProjectButtonClicked()
|
||||||
{
|
{
|
||||||
qDebug() << "OPEN PROJECT";
|
hide();
|
||||||
|
|
||||||
|
if ( File::open() )
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user