summaryrefslogtreecommitdiffstats
path: root/src/fetchdialog.h
blob: c28e3fdf14964ef6761bed6a09f41a5b35dd98bc (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
/***************************************************************************
    copyright            : (C) 2003-2006 by Robby Stephenson
    email                : robby@periapsis.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of version 2 of the GNU General Public License as  *
 *   published by the Free Software Foundation;                            *
 *                                                                         *
 ***************************************************************************/

#ifndef FETCHDIALOG_H
#define FETCHDIALOG_H

#include "datavectors.h"

#include <kdialogbase.h>

#include <tqguardedptr.h>

namespace Tellico {
  class EntryView;
  namespace Fetch {
    class Fetcher;
    class SearchResult;
  }
  namespace GUI {
    class ComboBox;
    class ListView;
  }
}

namespace barcodeRecognition {
  class barcodeRecognitionThread;
}

class KComboBox;
class KLineEdit;
class KPushButton;
class KStatusBar;
class KTextEdit;
class TQProgressBar;
class TQTimer;
class TQCheckBox;


namespace Tellico {

/**
 * @author Robby Stephenson
 */
class FetchDialog : public KDialogBase {
Q_OBJECT
  

public:
  /**
   * Constructor
   */
  FetchDialog(TQWidget* parent, const char* name = 0);
  ~FetchDialog();

public slots:
  void slotResetCollection();

protected:
  bool eventFilter(TQObject* obj, TQEvent* ev);

private slots:
  void slotSearchClicked();
  void slotClearClicked();
  void slotAddEntry();
  void slotMoreClicked();
  void slotShowEntry();
  void slotMoveProgress();

  void slotStatus(const TQString& status);
  void slotUpdateStatus();

  void slotFetchDone(bool checkISBN = true);
  void slotResultFound(Tellico::Fetch::SearchResult* result);
  void slotKeyChanged(int);
  void slotSourceChanged(const TQString& source);
  void slotMultipleISBN(bool toggle);
  void slotEditMultipleISBN();
  void slotInit();
  void slotLoadISBNList();
  void slotUPC2ISBN();

  void slotBarcodeRecognized(TQString);
  void slotBarcodeGotImage(TQImage&);
private:
  void startProgress();
  void stopProgress();
  void setStatus(const TQString& text);
  void adjustColumnWidth();

  void customEvent( TQCustomEvent *e );

  class SearchResultItem;

  KComboBox* m_sourceCombo;
  GUI::ComboBox* m_keyCombo;
  KLineEdit* m_valueLineEdit;
  KPushButton* m_searchButton;
  TQCheckBox* m_multipleISBN;
  KPushButton* m_editISBN;
  GUI::ListView* m_listView;
  EntryView* m_entryView;
  KPushButton* m_addButton;
  KPushButton* m_moreButton;
  KStatusBar* m_statusBar;
  TQProgressBar* m_progress;
  TQTimer* m_timer;
  TQGuardedPtr<KTextEdit> m_isbnTextEdit;
  TQLabel *m_barcodePreview;

  bool m_started;
  int m_resultCount;
  TQString m_oldSearch;
  TQStringList m_isbnList;
  TQStringList m_statusMessages;
  TQMap<int, Data::EntryPtr> m_entries;
  TQPtrList<Fetch::SearchResult> m_results;
  int m_collType;

  barcodeRecognition::barcodeRecognitionThread *m_barcodeRecognitionThread;
};

} //end namespace

#endif