Seamly2D
Code documentation
TMainWindow Class Reference

#include <tmainwindow.h>

Inheritance diagram for TMainWindow:
Collaboration diagram for TMainWindow:

Public Slots

virtual void ShowToolTip (const QString &toolTip) Q_DECL_OVERRIDE
 
virtual void zoomToSelected () Q_DECL_OVERRIDE
 
virtual void updateGroups () Q_DECL_OVERRIDE
 
- Public Slots inherited from VAbstractMainWindow
virtual void ShowToolTip (const QString &toolTip)=0
 
virtual void updateGroups ()=0
 
virtual void zoomToSelected ()=0
 

Public Member Functions

 TMainWindow (QWidget *parent=nullptr)
 
virtual ~TMainWindow () Q_DECL_OVERRIDE
 
QString CurrentFile () const
 
void RetranslateTable ()
 
void SetBaseMHeight (int height)
 
void SetBaseMSize (int size)
 
void SetPUnit (Unit unit)
 
bool LoadFile (const QString &path)
 
- Public Member Functions inherited from VAbstractMainWindow
 VAbstractMainWindow (QWidget *parent=nullptr)
 
virtual ~VAbstractMainWindow () Q_DECL_EQ_DEFAULT
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *event) Q_DECL_OVERRIDE
 
virtual void changeEvent (QEvent *event) Q_DECL_OVERRIDE
 
virtual void showEvent (QShowEvent *event) Q_DECL_OVERRIDE
 
virtual bool eventFilter (QObject *object, QEvent *event) Q_DECL_OVERRIDE
 
virtual void exportToCSVData (const QString &fileName, const DialogExportToCSV &dialog) Q_DECL_FINAL
 
void handleExportToCSV ()
 
- Protected Member Functions inherited from VAbstractMainWindow
bool ContinueFormatRewrite (const QString &currentFormatVersion, const QString &maxFormatVersion)
 
void ToolBarStyle (QToolBar *bar)
 

Private Types

enum  { MaxRecentFiles = 5 }
 

Private Slots

void FileNew ()
 
void OpenIndividual ()
 
void OpenMultisize ()
 
void OpenTemplate ()
 
void CreateFromExisting ()
 
void Preferences ()
 
void ToolBarStyles ()
 
void print ()
 
void printPages (QPrinter *printer)
 
bool FileSave ()
 
bool FileSaveAs ()
 
void AboutToShowWindowMenu ()
 
void ShowWindow () const
 
void SaveGivenName ()
 
void SaveFamilyName ()
 
void SaveEmail ()
 
void SaveGender (int index)
 
void SaveBirthDate (const QDate &date)
 
void SaveNotes ()
 
void SavePMSystem (int index)
 
void Remove ()
 
void MoveTop ()
 
void MoveUp ()
 
void MoveDown ()
 
void MoveBottom ()
 
void Fx ()
 
void AddCustom ()
 
void AddKnown ()
 
void ImportFromPattern ()
 
void ChangedSize (int index)
 
void ChangedHeight (int index)
 
void ShowMData ()
 
void DeployFormula ()
 
void SaveMName (const QString &text)
 
void SaveMValue ()
 
void SaveMBaseValue (double value)
 
void SaveMSizeIncrease (double value)
 
void SaveMHeightIncrease (double value)
 
void SaveMDescription ()
 
void SaveMFullName ()
 
void PatternUnitChanged (int index)
 

Private Member Functions

void SetupMenu ()
 
void InitWindow ()
 
void InitTable ()
 
void SetDecimals ()
 
void InitUnits ()
 
void InitComboBoxUnits ()
 
void InitGender (QComboBox *gender)
 
void ShowNewMData (bool fresh)
 
void ShowUnits ()
 
void ShowHeaderUnits (QTableWidget *table, int column, const QString &unit)
 
void UpdateRecentFileActions ()
 
void MeasurementsWasSaved (bool saved)
 
void SetCurrentFile (const QString &fileName)
 
bool SaveMeasurements (const QString &fileName, QString &error)
 
bool MaybeSave ()
 
QTableWidgetItem * AddCell (const QString &text, int row, int column, int aligment, bool ok=true)
 
Q_REQUIRED_RESULT QComboBox * SetGradationList (QLabel *label, const QStringList &list)
 
void SetDefaultHeight (int value)
 
void SetDefaultSize (int value)
 
void RefreshData (bool freshCall=false)
 
void RefreshTable (bool freshCall=false)
 
QString GetCustomName () const
 
QString ClearCustomName (const QString &name) const
 
bool EvalFormula (const QString &formula, bool fromUser, VContainer *data, QLabel *label)
 
QString getMeasurementNumber (const QString &name)
 
void ShowMDiagram (const QString &name)
 
void Open (const QString &pathTo, const QString &filter)
 
void UpdatePadlock (bool ro)
 
void MeasurementGUI ()
 
void Controls ()
 
void MFields (bool enabled)
 
void UpdateWindowTitle ()
 
void ReadSettings ()
 
void WriteSettings ()
 
QStringList FilterMeasurements (const QStringList &mNew, const QStringList &mFilter)
 
void UpdatePatternUnit ()
 
bool LoadFromExistingFile (const QString &path)
 
void CreateWindowMenu (QMenu *menu)
 
bool IgnoreLocking (int error, const QString &path)
 
template<class T >
void HackWidget (T **widget)
 
void copyToClipboard ()
 copyToClipboard copy dialog selection to clipboard as comma separated values. More...
 

Private Attributes

Ui::TMainWindow * ui
 
VMeasurementsindividualMeasurements
 
VContainerdata
 
Unit mUnit
 
Unit pUnit
 
MeasurementsType mType
 
qreal currentSize
 
qreal currentHeight
 
QString curFile
 
QComboBox * gradationHeights
 
QComboBox * gradationSizes
 
QComboBox * comboBoxUnits
 
int formulaBaseHeight
 
std::shared_ptr< VLockGuard< char > > lock
 
QSharedPointer< VTableSearchsearch
 
QLabel * labelGradationHeights
 
QLabel * labelGradationSizes
 
QLabel * labelPatternUnit
 
QAction * actionDockDiagram
 
bool dockDiagramVisible
 
bool isInitialized
 
bool mIsReadOnly
 
QAction * recentFileActs [MaxRecentFiles]
 
QAction * separatorAct
 
QVector< QObject * > hackedWidgets
 

Additional Inherited Members

- Protected Slots inherited from VAbstractMainWindow
void WindowsLocale ()
 
void exportToCSV (QString &file)
 
- Protected Attributes inherited from VAbstractMainWindow
int m_curFileFormatVersion
 
QString m_curFileFormatVersionStr
 

Detailed Description

Definition at line 76 of file tmainwindow.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
MaxRecentFiles 

Definition at line 189 of file tmainwindow.h.

Constructor & Destructor Documentation

◆ TMainWindow()

TMainWindow::TMainWindow ( QWidget *  parent = nullptr)
explicit

◆ ~TMainWindow()

TMainWindow::~TMainWindow ( )
virtual

Definition at line 183 of file tmainwindow.cpp.

References data, individualMeasurements, and ui.

Member Function Documentation

◆ AboutToShowWindowMenu

void TMainWindow::AboutToShowWindowMenu ( )
privateslot

Definition at line 1135 of file tmainwindow.cpp.

References CreateWindowMenu(), and ui.

◆ AddCell()

QTableWidgetItem * TMainWindow::AddCell ( const QString &  text,
int  row,
int  column,
int  aligment,
bool  ok = true 
)
private

Definition at line 2525 of file tmainwindow.cpp.

References ui.

Referenced by RefreshTable().

◆ AddCustom

◆ AddKnown

◆ ChangedHeight

void TMainWindow::ChangedHeight ( int  index)
privateslot

Definition at line 1633 of file tmainwindow.cpp.

References currentHeight, gradationHeights, RefreshData(), search, and ui.

Referenced by InitWindow().

◆ ChangedSize

void TMainWindow::ChangedSize ( int  index)
privateslot

Definition at line 1623 of file tmainwindow.cpp.

References currentSize, gradationSizes, RefreshData(), search, and ui.

Referenced by InitWindow().

◆ changeEvent()

◆ ClearCustomName()

QString TMainWindow::ClearCustomName ( const QString &  name) const
private

Definition at line 2855 of file tmainwindow.cpp.

References CustomMSign.

Referenced by ShowNewMData().

◆ closeEvent()

void TMainWindow::closeEvent ( QCloseEvent *  event)
protectedvirtual

Definition at line 554 of file tmainwindow.cpp.

References MaybeSave(), and WriteSettings().

◆ Controls()

void TMainWindow::Controls ( )
private

Definition at line 2720 of file tmainwindow.cpp.

References ui.

Referenced by MeasurementGUI().

◆ copyToClipboard()

void TMainWindow::copyToClipboard ( )
private

copyToClipboard copy dialog selection to clipboard as comma separated values.

Definition at line 3369 of file tmainwindow.cpp.

References ui.

Referenced by InitWindow().

◆ CreateFromExisting

void TMainWindow::CreateFromExisting ( )
privateslot

Definition at line 492 of file tmainwindow.cpp.

References individualMeasurements, LoadFromExistingFile(), and qApp.

Referenced by SetupMenu().

◆ CreateWindowMenu()

void TMainWindow::CreateWindowMenu ( QMenu *  menu)
private

Definition at line 3168 of file tmainwindow.cpp.

References qApp, SCASSERT, and ShowWindow().

Referenced by AboutToShowWindowMenu().

◆ CurrentFile()

QString TMainWindow::CurrentFile ( ) const

Definition at line 191 of file tmainwindow.cpp.

References curFile.

Referenced by FileSaveAs(), and printPages().

◆ DeployFormula

void TMainWindow::DeployFormula ( )
privateslot

Definition at line 1775 of file tmainwindow.cpp.

References DIALOG_MAX_FORMULA_HEIGHT, formulaBaseHeight, SCASSERT, and ui.

Referenced by InitWindow().

◆ EvalFormula()

bool TMainWindow::EvalFormula ( const QString &  formula,
bool  fromUser,
VContainer data,
QLabel *  label 
)
private

◆ eventFilter()

bool TMainWindow::eventFilter ( QObject *  object,
QEvent *  event 
)
protectedvirtual

Definition at line 651 of file tmainwindow.cpp.

References qApp.

◆ exportToCSVData()

◆ FileNew

◆ FileSave

◆ FileSaveAs

◆ FilterMeasurements()

QStringList TMainWindow::FilterMeasurements ( const QStringList &  mNew,
const QStringList &  mFilter 
)
private

Definition at line 2994 of file tmainwindow.cpp.

References convertToList().

Referenced by ImportFromPattern().

◆ Fx

◆ GetCustomName()

QString TMainWindow::GetCustomName ( ) const
private

Definition at line 2706 of file tmainwindow.cpp.

References CustomMSign, data, VContainer::IsUnique(), measurement_, and qApp.

Referenced by AddCustom(), and SaveMName().

◆ getMeasurementNumber()

QString TMainWindow::getMeasurementNumber ( const QString &  name)
private

Definition at line 1745 of file tmainwindow.cpp.

References qApp.

Referenced by RefreshTable().

◆ HackWidget()

template<class T >
void TMainWindow::HackWidget ( T **  widget)
private

Definition at line 3352 of file tmainwindow.cpp.

References hackedWidgets.

Referenced by InitWindow().

◆ handleExportToCSV()

void TMainWindow::handleExportToCSV ( )
protected

Definition at line 761 of file tmainwindow.cpp.

References curFile, and VAbstractMainWindow::exportToCSV().

Referenced by SetupMenu().

◆ IgnoreLocking()

bool TMainWindow::IgnoreLocking ( int  error,
const QString &  path 
)
private

Definition at line 3205 of file tmainwindow.cpp.

References qApp, and V_EX_NOINPUT.

Referenced by LoadFile(), and LoadFromExistingFile().

◆ ImportFromPattern

◆ InitComboBoxUnits()

void TMainWindow::InitComboBoxUnits ( )
private

Definition at line 3333 of file tmainwindow.cpp.

References Cm, comboBoxUnits, Inch, Mm, SCASSERT, and UnitsToStr().

Referenced by changeEvent(), and InitUnits().

◆ InitGender()

void TMainWindow::InitGender ( QComboBox *  gender)
private

Definition at line 3342 of file tmainwindow.cpp.

References Female, Male, SCASSERT, and Unknown.

Referenced by changeEvent(), and InitWindow().

◆ InitTable()

void TMainWindow::InitTable ( )
private

◆ InitUnits()

void TMainWindow::InitUnits ( )
private

Definition at line 3311 of file tmainwindow.cpp.

References comboBoxUnits, InitComboBoxUnits(), labelPatternUnit, PatternUnitChanged(), pUnit, and ui.

Referenced by InitWindow().

◆ InitWindow()

◆ LoadFile()

◆ LoadFromExistingFile()

◆ MaybeSave()

bool TMainWindow::MaybeSave ( )
private

Definition at line 2478 of file tmainwindow.cpp.

References curFile, FileSave(), FileSaveAs(), mIsReadOnly, and ui.

Referenced by closeEvent().

◆ MeasurementGUI()

void TMainWindow::MeasurementGUI ( )
private

Definition at line 2951 of file tmainwindow.cpp.

References ColumnName, Controls(), CustomMSign, and ui.

Referenced by FileNew(), LoadFile(), LoadFromExistingFile(), and ShowNewMData().

◆ MeasurementsWasSaved()

◆ MFields()

void TMainWindow::MFields ( bool  enabled)
private

Definition at line 2765 of file tmainwindow.cpp.

References mType, Multisize, and ui.

Referenced by Remove(), and ShowNewMData().

◆ MoveBottom

void TMainWindow::MoveBottom ( )
privateslot

◆ MoveDown

void TMainWindow::MoveDown ( )
privateslot

◆ MoveTop

void TMainWindow::MoveTop ( )
privateslot

◆ MoveUp

void TMainWindow::MoveUp ( )
privateslot

◆ Open()

void TMainWindow::Open ( const QString &  pathTo,
const QString &  filter 
)
private

Definition at line 2917 of file tmainwindow.cpp.

References individualMeasurements, LoadFile(), and qApp.

Referenced by OpenIndividual(), OpenMultisize(), and OpenTemplate().

◆ OpenIndividual

void TMainWindow::OpenIndividual ( )
privateslot

Definition at line 439 of file tmainwindow.cpp.

References Open(), and qApp.

Referenced by SetupMenu().

◆ OpenMultisize

void TMainWindow::OpenMultisize ( )
privateslot

Definition at line 463 of file tmainwindow.cpp.

References Open(), VCommonSettings::PrepareMultisizeTables(), and qApp.

Referenced by SetupMenu().

◆ OpenTemplate

void TMainWindow::OpenTemplate ( )
privateslot

◆ PatternUnitChanged

void TMainWindow::PatternUnitChanged ( int  index)
privateslot

Definition at line 2091 of file tmainwindow.cpp.

References comboBoxUnits, pUnit, and UpdatePatternUnit().

Referenced by InitUnits().

◆ Preferences

void TMainWindow::Preferences ( )
privateslot

◆ print

void TMainWindow::print ( )
privateslot

Definition at line 772 of file tmainwindow.cpp.

References mType, Multisize, printPages(), and ui.

Referenced by SetupMenu().

◆ printPages

void TMainWindow::printPages ( QPrinter *  printer)
privateslot

Definition at line 803 of file tmainwindow.cpp.

References CurrentFile(), mType, Multisize, mUnit, PrintDPI, ui, and UnitsToStr().

Referenced by print().

◆ ReadSettings()

void TMainWindow::ReadSettings ( )
private

◆ RefreshData()

◆ RefreshTable()

◆ Remove

void TMainWindow::Remove ( )
privateslot

◆ RetranslateTable()

void TMainWindow::RetranslateTable ( )

Definition at line 197 of file tmainwindow.cpp.

References individualMeasurements, RefreshTable(), search, and ui.

◆ SaveBirthDate

void TMainWindow::SaveBirthDate ( const QDate &  date)
privateslot

◆ SaveEmail

void TMainWindow::SaveEmail ( )
privateslot

◆ SaveFamilyName

void TMainWindow::SaveFamilyName ( )
privateslot

◆ SaveGender

void TMainWindow::SaveGender ( int  index)
privateslot

◆ SaveGivenName

void TMainWindow::SaveGivenName ( )
privateslot

◆ SaveMBaseValue

void TMainWindow::SaveMBaseValue ( double  value)
privateslot

◆ SaveMDescription

void TMainWindow::SaveMDescription ( )
privateslot

◆ SaveMeasurements()

bool TMainWindow::SaveMeasurements ( const QString &  fileName,
QString &  error 
)
private

◆ SaveMFullName

◆ SaveMHeightIncrease

void TMainWindow::SaveMHeightIncrease ( double  value)
privateslot

◆ SaveMName

◆ SaveMSizeIncrease

void TMainWindow::SaveMSizeIncrease ( double  value)
privateslot

◆ SaveMValue

◆ SaveNotes

void TMainWindow::SaveNotes ( )
privateslot

◆ SavePMSystem

void TMainWindow::SavePMSystem ( int  index)
privateslot

◆ SetBaseMHeight()

void TMainWindow::SetBaseMHeight ( int  height)

◆ SetBaseMSize()

void TMainWindow::SetBaseMSize ( int  size)

◆ SetCurrentFile()

void TMainWindow::SetCurrentFile ( const QString &  fileName)
private

◆ SetDecimals()

void TMainWindow::SetDecimals ( )
private

Definition at line 3271 of file tmainwindow.cpp.

References Cm, Inch, Mm, mUnit, and ui.

Referenced by InitWindow().

◆ SetDefaultHeight()

void TMainWindow::SetDefaultHeight ( int  value)
private

Definition at line 2561 of file tmainwindow.cpp.

References currentHeight, and gradationHeights.

Referenced by InitWindow().

◆ SetDefaultSize()

void TMainWindow::SetDefaultSize ( int  value)
private

Definition at line 2575 of file tmainwindow.cpp.

References currentSize, and gradationSizes.

Referenced by InitWindow().

◆ SetGradationList()

QComboBox * TMainWindow::SetGradationList ( QLabel *  label,
const QStringList &  list 
)
private

Definition at line 2549 of file tmainwindow.cpp.

References ui.

Referenced by InitWindow().

◆ SetPUnit()

void TMainWindow::SetPUnit ( Unit  unit)

Definition at line 239 of file tmainwindow.cpp.

References pUnit, and UpdatePatternUnit().

Referenced by MApplication::ParseCommandLine().

◆ SetupMenu()

void TMainWindow::SetupMenu ( )
private

◆ showEvent()

void TMainWindow::showEvent ( QShowEvent *  event)
protectedvirtual

Definition at line 630 of file tmainwindow.cpp.

References dockDiagramVisible, isInitialized, and ui.

◆ ShowHeaderUnits()

void TMainWindow::ShowHeaderUnits ( QTableWidget *  table,
int  column,
const QString &  unit 
)
private

Definition at line 2412 of file tmainwindow.cpp.

References SCASSERT.

Referenced by ShowUnits().

◆ ShowMData

void TMainWindow::ShowMData ( )
privateslot

Definition at line 1643 of file tmainwindow.cpp.

References ShowNewMData().

Referenced by InitTable().

◆ ShowMDiagram()

void TMainWindow::ShowMDiagram ( const QString &  name)
private

◆ ShowNewMData()

◆ ShowToolTip

void TMainWindow::ShowToolTip ( const QString &  toolTip)
virtualslot

Definition at line 375 of file tmainwindow.cpp.

◆ ShowUnits()

void TMainWindow::ShowUnits ( )
private

◆ ShowWindow

void TMainWindow::ShowWindow ( ) const
privateslot

Definition at line 1142 of file tmainwindow.cpp.

References qApp.

Referenced by CreateWindowMenu().

◆ ToolBarStyles

void TMainWindow::ToolBarStyles ( )
privateslot

Definition at line 547 of file tmainwindow.cpp.

References VAbstractMainWindow::ToolBarStyle(), and ui.

Referenced by Preferences(), and ReadSettings().

◆ updateGroups

void TMainWindow::updateGroups ( )
virtualslot

Definition at line 382 of file tmainwindow.cpp.

◆ UpdatePadlock()

void TMainWindow::UpdatePadlock ( bool  ro)
private

Definition at line 2935 of file tmainwindow.cpp.

References mIsReadOnly, and ui.

Referenced by FileNew(), FileSaveAs(), LoadFile(), and LoadFromExistingFile().

◆ UpdatePatternUnit()

void TMainWindow::UpdatePatternUnit ( )
private

Definition at line 3000 of file tmainwindow.cpp.

References RefreshTable(), search, and ui.

Referenced by PatternUnitChanged(), and SetPUnit().

◆ UpdateRecentFileActions()

void TMainWindow::UpdateRecentFileActions ( )
private

Definition at line 3143 of file tmainwindow.cpp.

References MaxRecentFiles, qApp, recentFileActs, separatorAct, and strippedName().

Referenced by SetCurrentFile().

◆ UpdateWindowTitle()

void TMainWindow::UpdateWindowTitle ( )
private

◆ WriteSettings()

void TMainWindow::WriteSettings ( )
private

◆ zoomToSelected

void TMainWindow::zoomToSelected ( )
virtualslot

Definition at line 3360 of file tmainwindow.cpp.

Member Data Documentation

◆ actionDockDiagram

QAction* TMainWindow::actionDockDiagram
private

Definition at line 185 of file tmainwindow.h.

Referenced by InitWindow().

◆ comboBoxUnits

QComboBox* TMainWindow::comboBoxUnits
private

Definition at line 178 of file tmainwindow.h.

Referenced by changeEvent(), InitComboBoxUnits(), InitUnits(), and PatternUnitChanged().

◆ curFile

QString TMainWindow::curFile
private

◆ currentHeight

qreal TMainWindow::currentHeight
private

◆ currentSize

qreal TMainWindow::currentSize
private

◆ data

◆ dockDiagramVisible

bool TMainWindow::dockDiagramVisible
private

Definition at line 186 of file tmainwindow.h.

Referenced by InitWindow(), and showEvent().

◆ formulaBaseHeight

int TMainWindow::formulaBaseHeight
private

Definition at line 179 of file tmainwindow.h.

Referenced by DeployFormula(), and InitWindow().

◆ gradationHeights

QComboBox* TMainWindow::gradationHeights
private

Definition at line 176 of file tmainwindow.h.

Referenced by ChangedHeight(), InitWindow(), and SetDefaultHeight().

◆ gradationSizes

QComboBox* TMainWindow::gradationSizes
private

Definition at line 177 of file tmainwindow.h.

Referenced by ChangedSize(), InitWindow(), and SetDefaultSize().

◆ hackedWidgets

QVector<QObject *> TMainWindow::hackedWidgets
private

Definition at line 192 of file tmainwindow.h.

Referenced by HackWidget().

◆ individualMeasurements

◆ isInitialized

bool TMainWindow::isInitialized
private

Definition at line 187 of file tmainwindow.h.

Referenced by showEvent().

◆ labelGradationHeights

QLabel* TMainWindow::labelGradationHeights
private

Definition at line 182 of file tmainwindow.h.

Referenced by changeEvent(), and InitWindow().

◆ labelGradationSizes

QLabel* TMainWindow::labelGradationSizes
private

Definition at line 183 of file tmainwindow.h.

Referenced by changeEvent(), and InitWindow().

◆ labelPatternUnit

QLabel* TMainWindow::labelPatternUnit
private

Definition at line 184 of file tmainwindow.h.

Referenced by changeEvent(), and InitUnits().

◆ lock

std::shared_ptr<VLockGuard<char> > TMainWindow::lock
private

Definition at line 180 of file tmainwindow.h.

Referenced by FileSaveAs(), LoadFile(), LoadFromExistingFile(), and OpenTemplate().

◆ mIsReadOnly

bool TMainWindow::mIsReadOnly
private

◆ mType

◆ mUnit

◆ pUnit

◆ recentFileActs

QAction* TMainWindow::recentFileActs[MaxRecentFiles]
private

Definition at line 190 of file tmainwindow.h.

Referenced by TMainWindow(), and UpdateRecentFileActions().

◆ search

◆ separatorAct

QAction* TMainWindow::separatorAct
private

Definition at line 191 of file tmainwindow.h.

Referenced by UpdateRecentFileActions().

◆ ui


The documentation for this class was generated from the following files: