/**************************************************************************** Hyper's CD Catalog A multiplatform qt and xml based catalog program Author : Christoph Thielecke License : GPL Copyright : (C) 2003 Christoph Thielecke ****************************************************************************/ #include "importdialog.h" #include #include #include #include #include #include #include #include #include #include #include ImportDialog::ImportDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { if ( !name ) setName( "ImportDialog" ); // ImportDialogLayout = new QGridLayout( this, 1, 1, 11, 7, "ImportDialogLayout" ); setSizeGripEnabled(true); layout4 = new QGridLayout( this, 10, 6, 10, 10, "layout4" ); info_lab = new QLabel( this, "info_lab" ); info_lab->setText( "info" ); layout4->addMultiCellWidget( info_lab, 0, 0, 0, 4 ); filename_lab = new QLabel( this, "filename_lab" ); layout4->addWidget( filename_lab, 1, 1 ); filename_lineedit = new QLineEdit( this, "filename_lineedit" ); layout4->addMultiCellWidget( filename_lineedit, 1, 1, 2, 4 ); buttonGetFile = new QPushButton( this, "buttonGetFile" ); layout4->addWidget( buttonGetFile, 1,5); importButtonBox = new QButtonGroup(1,Qt::Horizontal,tr("Type"),this,"import_button_box"); importButtonBox->setRadioButtonExclusive(true); importTypeCsv = new QRadioButton( "&CSV",importButtonBox, "importTypeCsv"); importTypeGtktalogXml = new QRadioButton( "Gtktalog &XML",importButtonBox ,"importTypeGtktalogXml"); importTypeWhereisitXml = new QRadioButton("&WhereIsIt XML (classic)", importButtonBox, "importTypeWhereisitXml"); layout4->addMultiCellWidget( importButtonBox, 2, 5, 1, 4 ); newdatabase = new QCheckBox( this, "newdatabase" ); newdatabase->setText( tr( "Create new Database" ) ); layout4->addMultiCellWidget( newdatabase, 6, 6, 1, 5 ); separator_lab = new QLabel( this, "separator_lab" ); layout4->addMultiCellWidget( separator_lab, 7, 7, 1, 3 ); separator_lineedit = new QLineEdit( this, "separator_lineedit" ); separator_lineedit->setMinimumSize( QSize( 0, 0 ) ); separator_lineedit->setMaximumSize( QSize( 20, 32767 ) ); separator_lineedit->setMaxLength ( 1 ); layout4->addMultiCellWidget( separator_lineedit, 7, 7, 4, 4 ); correctbadstyle = new QCheckBox( this, "correctbadstyle" ); correctbadstyle->setText( tr( "Correct bad style from gtktalog export" ) ); layout4->addMultiCellWidget( correctbadstyle, 8, 8, 1, 5 ); buttonOK = new QPushButton( this, "buttonOK" ); buttonOK->setDefault( true ); buttonOK-> setMinimumWidth( 100 ); layout4->addWidget( buttonOK, 9, 2 ); buttonCancel = new QPushButton( this, "buttonCancel" ); buttonCancel-> setMinimumWidth( 100 ); layout4->addMultiCellWidget( buttonCancel, 9, 9, 3, 3 ); /* QSpacerItem* spacer = new QSpacerItem( 181, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout4->addMultiCell( spacer, 5, 5, 0, 2 ); QSpacerItem* spacer_2 = new QSpacerItem( 291, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); layout4->addMultiCell( spacer_2, 3, 3, 2, 5 ); */ importTypeWhereisitXml->setChecked(true); correctbadstyle->setEnabled(false); separator_lab->setEnabled(false); separator_lineedit->setEnabled(false); // ImportDialogLayout->addLayout( layout4, 0, 0 ); languageChange(); resize( QSize( 450, 350 ).expandedTo( minimumSizeHint() ) ); setMinimumSize(minimumSizeHint()); //this->sizeHint(); //setFixedSize( size() ); //clearWState( WState_Polished ); connect( buttonOK, SIGNAL( clicked() ), this, SLOT( bOk() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( bCan() ) ); connect( buttonGetFile, SIGNAL( clicked() ), this, SLOT( getFileName() ) ); connect( importTypeCsv, SIGNAL( clicked() ), this, SLOT( typeChanged() ) ); connect( importTypeGtktalogXml, SIGNAL( clicked() ), this, SLOT( typeChanged() ) ); connect( importTypeWhereisitXml, SIGNAL( clicked() ), this, SLOT( typeChanged() ) ); separator_lab->setEnabled(false); separator_lineedit->setEnabled(false); filename_lineedit->setText(""); } /* * Destroys the object and frees any allocated resources */ ImportDialog::~ImportDialog() { //no need to delete child widgets, Qt does it for us! } /* * Sets the strings of the subwidgets using the current * language. */ void ImportDialog::languageChange() { setCaption( tr( "Import CSV file" ) ); filename_lab->setText( tr( "File:" ) ); separator_lineedit->setText( ";" ); separator_lab->setText( tr( "Separator:" ) ); QToolTip::add ( separator_lineedit , tr( "This is the separator in dataline\nSEPARATORSEPARATOR