#include <CubeDoc.h>
Collaboration diagram for CubeDoc:
Public Types | |
enum | EWarnMsg { WARN_NONE = 0, WARN_SHAPE_SIDES, WARN_SHAPE_NOT_CONNECT, WARN_SHAPE_NO_START, WARN_NOT_ENOUGH_PIECES, WARN_VERY_LITTLE_PIECES, WARN_FULL_ENUM_NO_SOLVES } |
Public Slots | |
void | OnOpenDocument (QString qname) |
void | OnNewBuild () |
void | OnFileResetsolves () |
void | OnFileOpen () |
bool | OnGenShape () |
void | OnFileSave () |
void | slvTrigger (QAction *act) |
void | slvSetIndex (int ind) |
void | solveGo () |
starts and stops the solution engine thread. | |
void | solveStop () |
stops the solve thread if its running. return only after it is stopped. | |
void | OnFullEnumNoSlv () |
void | evaluateBstatus () |
void | setShowUpToStep (int step) |
Signals | |
void | updateViews (int hint) |
void | newSolutionsLoaded (QString filename) |
void | newShapeLoaded (QString filename) |
void | fileSaved (QString filename) |
void | allReset () |
void | solveReset () |
void | solvePopUp () |
void | solveIndexChanged (int ind) |
void | solveNone () |
void | slvProgUpdated (int hint, int data) |
void | changedFromSave (bool state) |
Public Member Functions | |
CubeDoc (QWidget *parent) | |
~CubeDoc () | |
bool | InitializePics () |
void | waitInitFinish () |
BuildWorld & | getBuild () |
SlvCube * | getCurrentSolve () |
int | getCurrentSolveIndex () |
bool | solvesExist () const |
int | getSolvesNumber () const |
int | getUpToStep () const |
bool | isSlvEngineRunning () |
const RunStats * | getRunningStats () |
bool | checkUnsaved (int types=DTSolutions|DTShape) |
used by the close event in the main window | |
bool | isGoEnabled () const |
EWarnMsg | getWarning () const |
EWarnMsg | getPicsWarning () const |
Public Attributes | |
Shape * | m_shp |
Solutions * | m_slvs |
Configuration | m_conf |
Private Types | |
enum | EDataType { DTSolutions = 0x01, DTShape = 0x02 } |
used in checkUnsaved() More... | |
Private Slots | |
void | OnSolveReadyS (int slvind) |
Private Member Functions | |
void | OnNewDocument () |
bool | callGenerate (Shape *shape, bool bSilent) |
bool | checkWhileRunning (const char *msg) |
void | easter () |
bool | generalSaveFile (const char *defext, const char *filter, const char *title, QString &retname) |
void | realOpen (QString name) |
bool | realSave (int unGenSlvAnswer=-1) |
void | OnSolveNone (int bldhint=0) |
void | updateSlvCombo () |
Private Attributes | |
int | m_nCurSlv |
the index of the current solution. -1 means there are none. | |
BuildWorld * | m_build |
the current design | |
SolveThread * | m_sthread |
int | m_nUpToStep |
show solution and design up to this step. -1 mean show all. | |
bool | m_bGoEnabled |
EWarnMsg | m_curWarning |
EWarnMsg | m_curPicsWarning |
The Happy Cube Solver generally implements an MFC inspired Document-View model. All of the data which defines the current "state" of the application is stored in this class. This includes the current design from the design view which is stored in m_build, the current active solutions which are stored in m_slvs and the Shape class which corresponds to these solutions which is stored in m_shp. The only exception is the current state of the pieces selection which is stored directly in the global PicBucket singleton. CubeDoc's job is to manage this data and keep it current and in sync. it does not deal at all with display issues which are implemented in the different widgets. CubeDoc is responsible of opening and saving shape and solution files and for starting up the solution engine. There is only one instance of CubeDoc throughout the live of the application. this instance is created by MainWindow. even though solutions and shape can be loaded, saved and reset, the CubeDoc instance is never destroyed or replaced. This is a slight deviation from the Document-View model but it makes things much easyer. specifically signal and slots connection.
enum CubeDoc::EWarnMsg |
enum CubeDoc::EDataType [private] |
CubeDoc::CubeDoc | ( | QWidget * | parent | ) |
CubeDoc::~CubeDoc | ( | ) | [inline] |
bool CubeDoc::InitializePics | ( | ) |
void CubeDoc::waitInitFinish | ( | ) |
BuildWorld& CubeDoc::getBuild | ( | ) | [inline] |
SlvCube* CubeDoc::getCurrentSolve | ( | ) | [inline] |
int CubeDoc::getCurrentSolveIndex | ( | ) | [inline] |
bool CubeDoc::solvesExist | ( | ) | const [inline] |
int CubeDoc::getSolvesNumber | ( | ) | const [inline] |
int CubeDoc::getUpToStep | ( | ) | const [inline] |
bool CubeDoc::isSlvEngineRunning | ( | ) | [inline] |
const RunStats * CubeDoc::getRunningStats | ( | ) |
bool CubeDoc::checkUnsaved | ( | int | types = DTSolutions|DTShape |
) |
used by the close event in the main window
bool CubeDoc::isGoEnabled | ( | ) | const [inline] |
EWarnMsg CubeDoc::getWarning | ( | ) | const [inline] |
EWarnMsg CubeDoc::getPicsWarning | ( | ) | const [inline] |
void CubeDoc::OnNewDocument | ( | ) | [private] |
bool CubeDoc::callGenerate | ( | Shape * | shape, | |
bool | bSilent | |||
) | [private] |
bool CubeDoc::checkWhileRunning | ( | const char * | msg | ) | [private] |
void CubeDoc::easter | ( | ) | [private] |
bool CubeDoc::generalSaveFile | ( | const char * | defext, | |
const char * | filter, | |||
const char * | title, | |||
QString & | retname | |||
) | [private] |
void CubeDoc::realOpen | ( | QString | name | ) | [private] |
bool CubeDoc::realSave | ( | int | unGenSlvAnswer = -1 |
) | [private] |
void CubeDoc::OnSolveReadyS | ( | int | slvind | ) | [private, slot] |
void CubeDoc::OnOpenDocument | ( | QString | qname | ) | [slot] |
void CubeDoc::OnNewBuild | ( | ) | [slot] |
void CubeDoc::OnFileResetsolves | ( | ) | [slot] |
void CubeDoc::OnFileOpen | ( | ) | [slot] |
bool CubeDoc::OnGenShape | ( | ) | [slot] |
void CubeDoc::OnFileSave | ( | ) | [slot] |
void CubeDoc::slvTrigger | ( | QAction * | act | ) | [slot] |
void CubeDoc::slvSetIndex | ( | int | ind | ) | [slot] |
void CubeDoc::solveGo | ( | ) | [slot] |
starts and stops the solution engine thread.
void CubeDoc::solveStop | ( | ) | [slot] |
stops the solve thread if its running. return only after it is stopped.
void CubeDoc::OnFullEnumNoSlv | ( | ) | [slot] |
void CubeDoc::evaluateBstatus | ( | ) | [slot] |
void CubeDoc::setShowUpToStep | ( | int | step | ) | [inline, slot] |
void CubeDoc::updateViews | ( | int | hint | ) | [signal] |
void CubeDoc::newSolutionsLoaded | ( | QString | filename | ) | [signal] |
void CubeDoc::newShapeLoaded | ( | QString | filename | ) | [signal] |
void CubeDoc::fileSaved | ( | QString | filename | ) | [signal] |
void CubeDoc::allReset | ( | ) | [signal] |
void CubeDoc::solveReset | ( | ) | [signal] |
void CubeDoc::solvePopUp | ( | ) | [signal] |
void CubeDoc::solveIndexChanged | ( | int | ind | ) | [signal] |
void CubeDoc::solveNone | ( | ) | [signal] |
void CubeDoc::slvProgUpdated | ( | int | hint, | |
int | data | |||
) | [signal] |
void CubeDoc::changedFromSave | ( | bool | state | ) | [signal] |
void CubeDoc::OnSolveNone | ( | int | bldhint = 0 |
) | [private] |
void CubeDoc::updateSlvCombo | ( | ) | [private] |
int CubeDoc::m_nCurSlv [private] |
the index of the current solution. -1 means there are none.
BuildWorld* CubeDoc::m_build [private] |
the current design
SolveThread* CubeDoc::m_sthread [private] |
int CubeDoc::m_nUpToStep [private] |
show solution and design up to this step. -1 mean show all.
bool CubeDoc::m_bGoEnabled [private] |
EWarnMsg CubeDoc::m_curWarning [private] |
EWarnMsg CubeDoc::m_curPicsWarning [private] |