summaryrefslogtreecommitdiffstats
path: root/krusader/Konfigurator/krresulttable.h
blob: 8cdfbfdf99ebb94bea4b0c853bed19bc1841bcb1 (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
/***************************************************************************
                             krresulttable.h
                             -------------------
    copyright            : (C) 2005 by Dirk Eschler & Krusader Krew
    e-mail               : krusader@users.sourceforge.net
    web site             : http://krusader.sourceforge.net
 ---------------------------------------------------------------------------
  Description
 ***************************************************************************

  A

     db   dD d8888b. db    db .d8888.  .d8b.  d8888b. d88888b d8888b.
     88 ,8P' 88  `8D 88    88 88'  YP d8' `8b 88  `8D 88'     88  `8D
     88,8P   88oobY' 88    88 `8bo.   88ooo88 88   88 88ooooo 88oobY'
     88`8b   88`8b   88    88   `Y8b. 88~~~88 88   88 88~~~~~ 88`8b
     88 `88. 88 `88. 88b  d88 db   8D 88   88 88  .8D 88.     88 `88.
     YP   YD 88   YD ~Y8888P' `8888Y' YP   YP Y8888D' Y88888P 88   YD

                                                     S o u r c e    F i l e

 ***************************************************************************
 *                                                                         *
 *   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 KRRESULTTABLE_H
#define KRRESULTTABLE_H

#include <qstring.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qhbox.h>
#include <qvbox.h>
#include <qgrid.h>
#include <qstringlist.h>
#include <qvaluevector.h>

#include <kiconloader.h>
#include <kglobalsettings.h>
#include <klocale.h>
#include <klocale.h>
#include <krun.h>
#include <kseparator.h>
#include <kurllabel.h>

#include "searchobject.h"
#include "../krusader.h"
#include "../krservices.h"
#include "../VFS/krarchandler.h"

/**
@author Dirk Eschler <deschler@users.sourceforge.net>
*/
class KrResultTable : public QWidget
{
public:
  KrResultTable(QWidget* parent);
  virtual ~KrResultTable();

  /**
  * Adds a row of search results to the end of a QGridLayout
  * Each KrResultTable has to implement it
  *
  * @param const SearchObject* search  Name of the SearchObject
  * @param const QGridLayout*  grid    The GridLayout where the row is inserted
  *
  * @return bool  True if row was added successfully to rows, else false
  */
  virtual bool addRow(SearchObject* search, QGridLayout* grid) = 0;

protected:
  QStringList _supported;
  QStringList _tableHeaders;
  int _numColumns;
  int _numRows;

  QGridLayout* _grid;
  QHBox* _iconBox;
  QLabel* _label; // generic label

  /**
  * Creates the main grid layout and attaches the table header
  *
  * @return bool  Pointer to the main grid layout
  */
  QGridLayout* initTable();

  /**
  * Applies settings to each cell of the grid layout
  * Supposed to be run after a row was added
  *
  * @param const QGridLayout* grid  The GridLayout
  */
  void adjustRow(QGridLayout* grid);
};

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

class KrArchiverResultTable : public KrResultTable
{
  Q_OBJECT
public:
  KrArchiverResultTable(QWidget* parent);
  virtual ~KrArchiverResultTable();

  bool addRow(SearchObject* search, QGridLayout* grid);

protected:
  KURLLabel* _nameLabel;

protected slots:
  void website(const QString&);
};

// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------

class KrToolResultTable : public KrResultTable
{
  Q_OBJECT
public:
  KrToolResultTable(QWidget* parent);
  virtual ~KrToolResultTable();

  bool addRow(SearchObject* search, QGridLayout* grid);

protected:
  QValueVector<Application*> _apps;

protected slots:
  void website(const QString&);
};

#endif