summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/printwizard/frmprintwizard.h
blob: 2eb25e16b0ad8abc306b8b34909f6542aaf31ae2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
/***************************************************************************
                          frmprintwizard.h  -  description
                             -------------------
    begin                : Mon Sep 30 2002
    copyright            : (C) 2002 by Todd Shoemaker
    email                : jtshoe11@yahoo.com
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef FRMPRINTWIZARD_H
#define FRMPRINTWIZARD_H

// Qt includes.

#include <qwidget.h>

// KDE includes.

#include <kprinter.h>

// Local includes.

#include "kpaboutdata.h"
#include "tphoto.h"
#include "frmprintwizardbase.h"

class QPushButton;
class KProcess;

namespace KIPIPrintWizardPlugin
{

class FrmPrintWizardBase;

typedef struct _TPhotoSize {
  QString label;
  int dpi;
  bool autoRotate;
  QPtrList<QRect> layouts;  // first element is page size
} TPhotoSize;

class FrmPrintWizard : public FrmPrintWizardBase  
{
   Q_OBJECT

private:

  enum PageSize {
   Unknown = -1,
   Letter  = 0,
   A4,
   A6,
   P10X15,
   P13X18
  };

  enum AvailableCaptions {
    NoCaptions = 0,
    FileNames,
    ExifDateTime,
    Comment,
    Free
  };

  QPtrList<TPhoto> m_photos;
  QPtrList<TPhotoSize> m_photoSizes;

  PageSize     m_pageSize;
  KProcess    *m_Proc;
  QString      m_tempPath;

  int          m_currentPreviewPage;
  QStringList  m_gimpFiles;

  QPushButton *m_helpButton;

  bool         m_cancelPrinting;

  KIPIPlugins::KPAboutData *m_about;

  void updateCropFrame(TPhoto *, int);
  void setBtnCropEnabled();
  void removeGimpFiles();
  void initPhotoSizes(PageSize pageSize);
  void previewPhotos();
  void printPhotos(QPtrList<TPhoto> photos, QPtrList<QRect> layouts, KPrinter &printer);
  QStringList printPhotosToFile(QPtrList<TPhoto> photos, QString &baseFilename, TPhotoSize *layouts);
  void loadSettings();
  void saveSettings();

  int getPageCount();

  QString captionFormatter(TPhoto *photo, const QString& format);
  void printCaption(QPainter &p, TPhoto*photo, int captionW, int captionH, QString caption);

  bool paintOnePage(QPainter &p, QPtrList<TPhoto> photos, QPtrList<QRect> layouts,
                    int captionType, unsigned int &current, bool useThumbnails = false);

  bool paintOnePage(QImage &p, QPtrList<TPhoto> photos, QPtrList<QRect> layouts,
                    int captionType, unsigned int &current);

  void manageBtnPrintOrder();
  void manageBtnPreviewPage();

public:

  FrmPrintWizard(QWidget *parent=0, const char *name=0);
  ~FrmPrintWizard();
  void print( KURL::List fileList, QString tempPath);
  QRect * getLayout(int photoIndex);

public slots:

  void BtnCropRotate_clicked();
  void BtnCropNext_clicked();
  void BtnCropPrev_clicked();
  void FrmPrintWizardBaseSelected(const QString &);
  void ListPhotoSizes_selected( QListBoxItem * );
  void ListPhotoSizes_highlighted ( int );
  void ListPrintOrder_selected( QListBoxItem * );
  void ListPhotoOrder_highlighted ( int );
  void EditCopies_valueChanged( int );
  void GrpOutputSettings_clicked(int id);
  void EditOutputPath_textChanged(const QString &);
  void CaptionChanged( int );
  void BtnBrowseOutputPath_clicked();
  void CmbPaperSize_activated( int );

  void BtnPrintOrderUp_clicked();
  void BtnPrintOrderDown_clicked();

  void BtnPreviewPageDown_clicked();
  void BtnPreviewPageUp_clicked();

protected slots:

  void accept();
  void reject();
  void slotHelp();
};

}  // NameSpace KIPIPrintWizardPlugin


#endif // FRMPRINTWIZARD_H