Added initial File boilerplate.
This commit is contained in:
+28
-1
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "LabelModel.h"
|
||||
|
||||
#include <QFileInfo>
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
@@ -33,11 +34,37 @@ namespace glabels
|
||||
///
|
||||
/// Default constructor.
|
||||
///
|
||||
LabelModel::LabelModel() : mModified(true), mTmplate(0), mRotate(false)
|
||||
LabelModel::LabelModel() : mUntitledInstance(0), mModified(true), mTmplate(0), mRotate(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Short name.
|
||||
///
|
||||
QString LabelModel::shortName()
|
||||
{
|
||||
static int untitledCount = 0;
|
||||
|
||||
if ( mFilename.isEmpty() )
|
||||
{
|
||||
if ( mUntitledInstance == 0 )
|
||||
{
|
||||
mUntitledInstance = ++untitledCount;
|
||||
}
|
||||
QString numString;
|
||||
numString.setNum(mUntitledInstance);;
|
||||
|
||||
return tr("Untitled") + numString;
|
||||
}
|
||||
else
|
||||
{
|
||||
QFileInfo fileInfo( mFilename );
|
||||
return fileInfo.baseName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Add object.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user