Added initial File boilerplate.

This commit is contained in:
Jim Evins
2014-09-01 23:26:20 -04:00
parent 06ff813618
commit b318efd68e
7 changed files with 260 additions and 35 deletions
+28 -1
View File
@@ -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.
///