2010-06-16 12:53:56 +00:00
|
|
|
/***************************************************************************
|
2011-12-21 11:49:33 +00:00
|
|
|
* Copyright (C) 2008 by Oliver Groß *
|
|
|
|
* z.o.gross@gmx.de *
|
2010-06-16 12:53:56 +00:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* This program is distributed in the hope that it will be useful, *
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the *
|
|
|
|
* Free Software Foundation, Inc., *
|
|
|
|
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
|
|
|
|
***************************************************************************/
|
|
|
|
#ifndef LIBQCROSS_CMONOPICTURE_H
|
|
|
|
#define LIBQCROSS_CMONOPICTURE_H
|
|
|
|
|
|
|
|
#include <QSize>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QString>
|
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
#include "nonogramproblem.h"
|
|
|
|
#include "nonogrammarker.h"
|
|
|
|
|
2010-06-16 12:53:56 +00:00
|
|
|
class QImage;
|
|
|
|
|
2011-12-21 11:49:33 +00:00
|
|
|
namespace libqnono {
|
2010-06-16 12:53:56 +00:00
|
|
|
class CNonogram {
|
|
|
|
public:
|
|
|
|
typedef QVector<quint16> NumbersVector;
|
|
|
|
|
|
|
|
CNonogram();
|
2012-04-19 15:30:54 +00:00
|
|
|
CNonogram(const NonogramProblem & problem);
|
2010-06-16 12:53:56 +00:00
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
const NonogramProblem & problem() const { return m_problem; }
|
|
|
|
QString name() const { return m_problem.name(); }
|
|
|
|
quint16 timeout() const { return m_problem.timeout(); }
|
|
|
|
const NonogramImage & solution() const { return m_problem.solution(); }
|
|
|
|
const NonogramNumbers & numbers() const { return m_problem.numbers(); }
|
2010-06-16 12:53:56 +00:00
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
const NonogramMarker & marker() const { return m_marker; }
|
2010-06-16 12:53:56 +00:00
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
QSize size() const { return m_problem.size(); }
|
|
|
|
int width() const { return size().width(); }
|
|
|
|
int height() const { return size().height(); }
|
2010-06-16 12:53:56 +00:00
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
/* returns false if set MARKED on white solution pixel (it still sets the mark) */
|
|
|
|
bool setMark(int x, int y, NonogramMarker::Mark mark);
|
2010-06-16 12:53:56 +00:00
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
bool readFromStream(QDataStream & stream);
|
|
|
|
void writeToStream(QDataStream& stream) const;
|
2010-06-16 12:53:56 +00:00
|
|
|
|
|
|
|
protected:
|
2012-04-19 15:30:54 +00:00
|
|
|
NonogramProblem m_problem;
|
|
|
|
NonogramMarker m_marker;
|
2010-06-16 12:53:56 +00:00
|
|
|
};
|
2011-12-21 11:49:33 +00:00
|
|
|
|
2012-04-19 15:30:54 +00:00
|
|
|
QDataStream & operator<<(QDataStream & stream, const CNonogram & nonogram);
|
2011-12-21 11:49:33 +00:00
|
|
|
QDataStream & operator>>(QDataStream & stream, CNonogram & nonogram);
|
2010-06-16 12:53:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|