#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSocketNotifier>
#include "imageringlist.h"
#include "imagescrollarea.h"
#include "database.h"
#include "imageinfo.h"
#include "imagescrollareagl.h"
#include "filesystemwidget.h"
#include "stretchpanel.h"
#include "databaseview.h"

class MainWindow : public QMainWindow
{
    Q_OBJECT
    ImageScrollArea *m_image;
    ImageScrollAreaGL *m_imageGL;
    ImageRingList *m_ringList;
    StretchPanel *m_stretchPanel;
    Database *m_database;
    ImageInfo *m_info;
    FilesystemWidget *m_filesystem;
    DataBaseView *m_databaseView;
    static int socketPair[2];
    QSocketNotifier *socketNotifier;
    QString _lastDir;
    bool _maximized;
public:
    MainWindow(QWidget *parent = 0);
    ~MainWindow();
protected:
    void keyPressEvent(QKeyEvent *event);
    void keyReleaseEvent(QKeyEvent *event);
    void setupSigterm();
    static void signalHandler(int);
    void closeEvent(QCloseEvent *event);
protected slots:
    void socketNotify();
    void updateWindowTitle();
    void pixmapLoaded(Image *image);
    void loadFile();
    void loadFile(const QString path);
    void loadFile(int row);
    void indexDir();
    void saveAs();
    void markImage();
    void unmarkImage();
    void markAndNext();
    void unmarkAndNext();
    void copyMarked();
    void toggleFullScreen();
    void liveMode(bool active);
    void imageStats(bool imageStats);
    void peakFinder(bool findPeaks);
    void starFinder(bool findStars);
};

#endif // MAINWINDOW_H
