summaryrefslogtreecommitdiffstats
path: root/src/kexportdialog.cpp
blob: c636c72d49a30ac992d3a45f3df85c1a7e916961 (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
156
157
158
/***************************************************************************
 *   Copyright (C) 2005 by Mark Six                                        *
 *   marksix@xs4all.nl                                                     *
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
 ***************************************************************************/
#include "kexportdialog.h"
#include <tdefiledialog.h>

KExportDialog::KExportDialog( TQWidget *parent, const char *name ) : TQDialog(parent, name)
{
	m_templateFile = "" ;
	m_outputDir = "" ;
	
	TQLabel *label = new TQLabel( this ) ;
	label->setText( "Template file" ) ;
	label->move( 10, 10 ) ;
	
	label = new TQLabel( this ) ;
	label->setText( "Output directory" ) ;
	label->move( 10, 35 ) ;
	
	label = new TQLabel( this ) ;
	label->setText( "Entity name" ) ;
	label->move( 10, 60 ) ;
		
	m_lineTemplateFile = new KLineEdit( this ) ;
	m_lineTemplateFile->setText( "" ) ;
	m_lineTemplateFile->setFixedSize( 150, 20 ) ;
	m_lineTemplateFile->move( 110, 10 ) ;
	
	m_lineOutputDir = new KLineEdit( this ) ;
	m_lineOutputDir->setText( "" ) ;
	m_lineOutputDir->setFixedSize( 150, 20 ) ;
	m_lineOutputDir->move( 110, 35 ) ;
	
	m_lineEntityName = new KLineEdit( this ) ;
	m_lineEntityName->setText( "" ) ;
	m_lineEntityName->setFixedSize( 150, 20 ) ;
	m_lineEntityName->move( 110, 60 ) ;
		
	TQPushButton *button = new TQPushButton( this ) ;
	button->setText( "OK" ) ;
	button->setFixedSize( 60, 25 ) ;
	button->move( 100, 90 ) ;
	connect( button, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnOKClicked() ) ) ;
	
	button = new TQPushButton( this ) ;
	button->setText( "Cancel" ) ;
	button->setFixedSize( 60, 25 ) ;
	button->move( 200, 90 ) ;
	connect( button, TQ_SIGNAL( clicked() ), this, TQ_SLOT( btnCancelClicked() ) ) ;

	button = new TQPushButton( this ) ;
	button->setText( "..." ) ;
	button->setFixedSize( 25, 20 ) ;
	button->move( 270, 10 ) ;
	connect( button, TQ_SIGNAL( clicked() ), this, TQ_SLOT( showFileDialog() ) )  ;
	
	button = new TQPushButton( this ) ;
	button->setText( "..." ) ;
	button->setFixedSize( 25, 20 ) ;
	button->move( 270, 35 ) ;
	connect( button, TQ_SIGNAL( clicked() ), this, TQ_SLOT( showDirDialog() )  ) ;
		
	setFixedSize( 340, 130 ) ;
	setCaption( "Export to VHDL" ) ;
	m_bCanceled = true ;
}

KExportDialog::~KExportDialog()
{
}

void KExportDialog::modal()
{
	exec() ;
}

void KExportDialog::showFileDialog()
{
	KFileDialog dlg( TQString(), "*.vhd|vhdl template file", this, "template dlg", true ) ;
	dlg.exec() ;
	
	if ( dlg.selectedFile() != "" )
		m_lineTemplateFile->setText( dlg.selectedFile() ) ;
}

void KExportDialog::showDirDialog()
{
	TQString dir = KFileDialog::getExistingDirectory ( TQString(), this, "Export directory" ) ;
	if ( dir != "" )
		m_lineOutputDir->setText( dir ) ;
}

void KExportDialog::btnOKClicked()
{
	m_templateFile = m_lineTemplateFile->text() ;
	m_outputDir = m_lineOutputDir->text() ;
	m_entityName = m_lineEntityName->text() ;
	m_bCanceled = false ;
	close() ;
}

void KExportDialog::btnCancelClicked()
{
	m_outputDir = "" ;
	m_templateFile = "" ;
	m_entityName = "" ;
	
	close() ;
}

void KExportDialog::setTemplateFile( TQString file )
{
	m_lineTemplateFile->setText( file ) ;
}

void KExportDialog::setOutputDir( TQString dir )
{
	m_lineOutputDir->setText( dir ) ;
}

void KExportDialog::setEntityName( TQString name ) 
{
	m_lineEntityName->setText( name ) ;
}

TQString KExportDialog::getTemplateFile()
{
	return m_templateFile ;
}

TQString KExportDialog::getOutputDir()
{
	return m_outputDir ;
}

TQString KExportDialog::getEntityName()
{
	return m_entityName ;
}


#include "kexportdialog.moc"