~ubuntu-branches/ubuntu/breezy/kdemultimedia/breezy

« back to all changes in this revision

Viewing changes to kscd/inexact.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2005-03-24 04:48:58 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge)
  • Revision ID: james.westby@ubuntu.com-20050324044858-8ff88o9jxej6ii3d
Tags: 4:3.4.0-0ubuntu3
Add kubuntu_02_hide_arts_menu_entries.diff to hide artsbuilder and artscontrol k-menu entries

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
 
3
 
/*
4
 
   Kscd - A simple cd player for the KDE Project
5
 
 
6
 
   $Id: inexact.cpp,v 1.15 2001/06/10 12:45:37 dfoerste Exp $
7
 
 
8
 
   Copyright (c) 1997 Bernd Johannes Wuebben math.cornell.edu
9
 
 
10
 
   This program is free software; you can redistribute it and/or modify
11
 
   it under the terms of the GNU General Public License as published by
12
 
   the Free Software Foundation; either version 2, or (at your option)
13
 
   any later version.
14
 
 
15
 
   This program is distributed in the hope that it will be useful,
16
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 
   GNU General Public License for more details.
19
 
 
20
 
   You should have received a copy of the GNU General Public License
21
 
   along with this program; if not, write to the Free Software
22
 
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23
 
 
24
 
 
25
 
 */
26
 
 
27
 
#include <stdio.h>
28
 
 
29
 
#include <kapp.h>
30
 
#include <klocale.h>
31
 
#include <kmessagebox.h>
32
 
 
33
 
#include "inexact.h"
34
 
 
35
 
#include <qlayout.h>
36
 
 
37
 
 
38
 
InexactDialog::InexactDialog(QWidget *parent, const char *name,bool _listbox)
39
 
  : QDialog(parent, name, TRUE)
40
 
{
41
 
 
42
 
  setCaption("Kscd");
43
 
 
44
 
  QBoxLayout * lay1 = new QVBoxLayout ( this, 10 );
45
 
  text = new QLabel(this,"textlabel");
46
 
//  text->setAlignment(WordBreak|AlignCenter);
47
 
  lay1->addWidget ( text );
48
 
 
49
 
  listbox = _listbox;
50
 
  if(listbox)
51
 
    {
52
 
      list_box = new QListBox(this,"debugwindow");
53
 
      list_box->setColumnMode(QListBox::FitToWidth);
54
 
      lay1->addWidget ( list_box );
55
 
      connect(list_box,SIGNAL(highlighted(int)),SLOT(setStatusBar(int)));
56
 
    } else {
57
 
      edit = new QMultiLineEdit(this,"debugwindow");
58
 
      lay1->addWidget ( edit );
59
 
   }
60
 
 
61
 
 
62
 
 
63
 
  text->setText(i18n("No exact match or multiple exact matches found.\nPlease select the appropriate"\
64
 
                     " CD from the list of choices presented below."));
65
 
 
66
 
  errorstring = i18n("Please select a Disk Title or press Cancel");
67
 
 
68
 
  statuslabel = new QLabel( this, "statuslabel" );
69
 
  lay1->addWidget ( statuslabel );
70
 
  statuslabel->setFrameStyle( QFrame::Panel | QFrame::Sunken );
71
 
  statuslabel->setText( "" );
72
 
  statuslabel->setAlignment( AlignCenter );
73
 
  //statusPageLabel->setFont( QFont("helvetica",12,QFont::Normal) );
74
 
 
75
 
  QBoxLayout * lay2 = new QHBoxLayout ( lay1 );
76
 
  lay2->addStretch ( 1 );
77
 
  ok_button = new QPushButton(i18n("OK"),this,"ok_button");
78
 
  lay2->addWidget ( ok_button );
79
 
  lay2->addStretch ( 1 );
80
 
  cancel_button = new QPushButton(i18n("Cancel"),this,"cancel_button");
81
 
  lay2->addWidget ( cancel_button );
82
 
  lay2->addStretch ( 1 );
83
 
  cancel_button->setFocus();
84
 
 
85
 
  connect(ok_button,SIGNAL(clicked()),SLOT(checkit()));
86
 
  connect(cancel_button,SIGNAL(clicked()),SLOT(reject()));
87
 
 
88
 
  returnstring = "";
89
 
} // InexactDialog()
90
 
 
91
 
 
92
 
InexactDialog::~InexactDialog()
93
 
{
94
 
}
95
 
 
96
 
void
97
 
InexactDialog::setTitle(const QString& t)
98
 
{
99
 
  titlestring = t;
100
 
  text->setText(t);
101
 
}
102
 
 
103
 
void
104
 
InexactDialog::setErrorString(const QString& t)
105
 
{
106
 
  errorstring = t;
107
 
}
108
 
 
109
 
void
110
 
InexactDialog::checkit()
111
 
{
112
 
  if(listbox)
113
 
    {
114
 
      if(list_box->currentItem() == -1)
115
 
        {
116
 
          KMessageBox::information(this, errorstring);
117
 
          return;
118
 
        }
119
 
      returnstring = list_box->text(list_box->currentItem());
120
 
    } else {
121
 
      returnstring = edit->text();
122
 
    }
123
 
  accept();
124
 
}
125
 
 
126
 
void
127
 
InexactDialog::getSelection(QString& string)
128
 
{
129
 
  string = returnstring;
130
 
}
131
 
 
132
 
 
133
 
void
134
 
InexactDialog::insertList(const QStringList& stringlist)
135
 
{
136
 
  if(listbox)
137
 
    {
138
 
      list_box->insertStringList(stringlist,-1);
139
 
    }
140
 
}
141
 
 
142
 
void
143
 
InexactDialog::insertText(const QString& str)
144
 
{
145
 
  if(!listbox)
146
 
    {
147
 
      edit->setAutoUpdate(FALSE);
148
 
      edit->setText(str);
149
 
      edit->setAutoUpdate(TRUE);
150
 
    }
151
 
}
152
 
 
153
 
void
154
 
InexactDialog::setStatusBar(int i)
155
 
{
156
 
  returnstring = list_box->text(i);
157
 
  statuslabel->setText(returnstring);
158
 
}
159
 
 
160
 
#include "inexact.moc"