

// $Id: moncalcontrol.h,v 1.22 2008/02/19 21:02:49 hvengel Exp $
//  Little cms Profiler
// Copyright (C) 2007 Hal Engel
//
// THIS SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
// EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
// WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
//
// IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
// INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
// OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
// WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
// LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
// OF THIS SOFTWARE.
//
// 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 3 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, see <http://www.gnu.org/licenses/>.
//
// Version 1.11

#ifndef MONCALCONTROL_H
#define MONCALCONTROL_H

#include "ui_moncalcontrolbase.h"
#include "monitorcal.h"
#include "main.h"

#include <qthread.h>
#include <q3wizard.h>

#ifdef __cplusplus
extern "C" {
#endif
    
#include "xspect.h"
#include "inst.h"
 
#ifdef __cplusplus
}
#endif

extern inst *it;

enum operation
{
    opCalReport,
    opSetWhitePoint,
    opSetBlackPoint,
    opSetBlackLevel,
    opSetWhiteLevel,
    opCalibrate,
    opUncalReport,
    opBigCalReport,
    opMeasure,
    opAmbient,
    noOp
};

extern operation reportOP;

enum displayType
{
    CRT=1,
    LCD=2
};

enum sampleSize
{
  smallest,
  medium,
  large,
  huge
};

enum gamma_type
{
   gtGeneric,
   gtsRGB,
   gtLstar
};

struct dataPackage
{
    operation op;
    double wp;
    double displayBr;
    sampleSize size;
    displayType disp;
    char measureFile[256];
    char calibFile[256];
    bool OK;
    double gamma;
    gamma_type gammaType;
    instData selectedInst;
};

class controlData
{
    public:
       dataPackage data;
       void get(controlData* out);
       void put(controlData in);
};

extern bool measureing;

class flashLEDsThread : public QThread {

    public:

        virtual void run();

};

// void flashLEDs(inst *it);

// void fillListedInsts(instData data[]);

class MonitorCalControl : public Q3Wizard, private Ui::MonCalControlBase
{
  Q_OBJECT

public:

    MonitorCalControl(QWidget *parent = 0 );
    virtual ~MonitorCalControl();

private slots:
    void slotGo();
    void slotOK();
    void slotCancel();
    void slotHelpButton();
    void slotUserGamma();
    void slotUserTemp();
    void slotCheckDevices();
    void slotUserLuminosity();
    void help();
    void accept();
    void reject();
    void next();
    void back();
    void slotMeasure();
    void slotCalibrate();
    void slotReport();
    void slotControls();
    void slotDisplayType();
    void slotSettingsChanged();

private:
    void controlsToValues();
    void fillComboBoxInstrument();
    void takeAmbientReading();
    bool initInstrumentAmbient();
    void checkSpyd2Firmware();
};

#endif
