aboutsummaryrefslogtreecommitdiffstats
path: root/examples/X11/qt/simplefrontend/SimpleFrontEndProject.cpp
blob: 691a02673d8dfcc34f136bd13e13add8e8868743 (plain) (blame)
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
/***********************************************
** Source Dump From QtEZ http://qtez.zax.net/qtez
** ---------------------------------------------
** Dumped: Mon Sep 21 01:22:44 1998
**     To: /usr/src/sword/examples/X11/qt/simplefrontend/SimpleFrontEndProject.cpp
**     By: root
***********************************************/

#include "/usr/src/sword/examples/X11/qt/simplefrontend/SimpleFrontEndProject.h"
#include <string>
#include <swmgr.h>

SimpleFrontEndProject::SimpleFrontEndProject(QWidget *parent, char *name) 
	: QDialog(parent,name,FALSE,WStyle_Customize | WStyle_NormalBorder)
{
	resize(420,320);
	
	label2 = new QLabel(this, "label2");
	label2->setText("Module Name");
	label2->setAlignment(AlignLeft | AlignTop);
	label2->setGeometry(21,6,115,28);
	
	label1 = new QLabel(this, "label1");
	label1->setText("KeyText");
	label1->setAlignment(AlignLeft | AlignTop);
	label1->setGeometry(21,51,115,28);
	
	label3 = new QLabel(this, "label3");
	label3->setText("[ none ]");
	label3->setAlignment(AlignLeft | AlignTop);
	label3->setGeometry(21,96,115,28);
	
	combo1 = new QComboBox((bool)0,this,"combo1");
	combo1->setGeometry(143,6,270,28);
	
	mlined1 = new QMultiLineEdit(this, "mlined1");
	mlined1->setGeometry(21,141,390,160);
	mlined1->setReadOnly(TRUE);
	
	text1 = new QLineEdit(this, "text1");
	text1->setGeometry(143,50,270,28);
	
	QObject::connect(text1,SIGNAL(textChanged(const char *)),
		this,SLOT(lookup(const char *)));
	
	QObject::connect(combo1,SIGNAL(activated(const char *)),
		this,SLOT(lookup(const char *)));
	
// use SWMgr to traverse installed modules and insert into QComboBox

	ModMap::iterator modIterator;

	for (modIterator = manager.Modules.begin(); modIterator != manager.Modules.end(); modIterator++)
		combo1->insertItem(modIterator->first.c_str());
}

void
SimpleFrontEndProject::lookup(const char *)
{
	string keyText;
	string modName;
	ModMap::iterator it;

	keyText = text1->text();
	modName = combo1->currentText();

	it = manager.Modules.find(modName.c_str());
	if (it != manager.Modules.end()) {
		it->second->setKey(keyText.c_str());
		mlined1->setText(*it->second);
		label3->setText(it->second->KeyText());
	}
		
}