summaryrefslogtreecommitdiffstats
path: root/kipi-plugins/printwizard/frmprintwizard.h
blob: b555afc72e19faba7a013ca80b4318bbb1621e36 (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
155
/***************************************************************************
                          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

// TQt includes.

#include <tqwidget.h>

// KDE includes.

#include <kprinter.h>

// Local includes.

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

class TQPushButton;
class KProcess;

namespace KIPIPrintWizardPlugin
{

class FrmPrintWizardBase;

typedef struct _TPhotoSize {
  TQString label;
  int dpi;
  bool autoRotate;
  TQPtrList<TQRect> 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
  };

  TQPtrList<TPhoto> m_photos;
  TQPtrList<TPhotoSize> m_photoSizes;

  PageSize     m_pageSize;
  KProcess    *m_Proc;
  TQString      m_tempPath;

  int          m_currentPreviewPage;
  TQStringList  m_gimpFiles;

  TQPushButton *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(TQPtrList<TPhoto> photos, TQPtrList<TQRect> layouts, KPrinter &printer);
  TQStringList printPhotosToFile(TQPtrList<TPhoto> photos, TQString &baseFilename, TPhotoSize *layouts);
  void loadSettings();
  void saveSettings();

  int getPageCount();

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

  bool paintOnePage(TQPainter &p, TQPtrList<TPhoto> photos, TQPtrList<TQRect> layouts,
                    int captionType, unsigned int &current, bool useThumbnails = false);

  bool paintOnePage(TQImage &p, TQPtrList<TPhoto> photos, TQPtrList<TQRect> layouts,
                    int captionType, unsigned int &current);

  void manageBtnPrintOrder();
  void manageBtnPreviewPage();

public:

  FrmPrintWizard(TQWidget *parent=0, const char *name=0);
  ~FrmPrintWizard();
  void print( KURL::List fileList, TQString tempPath);
  TQRect * getLayout(int photoIndex);

public slots:

  void BtnCropRotate_clicked();
  void BtnCropNext_clicked();
  void BtnCropPrev_clicked();
  void FrmPrintWizardBaseSelected(const TQString &);
  void ListPhotoSizes_selected( TQListBoxItem * );
  void ListPhotoSizes_highlighted ( int );
  void ListPrintOrder_selected( TQListBoxItem * );
  void ListPhotoOrder_highlighted ( int );
  void EditCopies_valueChanged( int );
  void GrpOutputSettings_clicked(int id);
  void EditOutputPath_textChanged(const TQString &);
  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