00001 #include "ImageInterface.h" 00002 #include "SpreadsheetDialog.h" 00003 #include "PixelProfile.h" 00004 #include "PixelArray.h" 00005 00006 SpreadsheetDialog::SpreadsheetDialog( GLIMSProject *proj ) : 00007 QDialog( NULL, "", true ){ 00008 mProj = proj; 00009 gtos = new GtoSConverter(mProj); 00010 buildDialog(); 00011 } 00012 00013 SpreadsheetDialog::~SpreadsheetDialog(){ 00014 delete gtos; 00015 } 00016 00017 void SpreadsheetDialog::buildDialog(){ 00018 00019 setCaption("GLIMS to Spreadsheet"); 00020 00021 //layout stuff 00022 QGrid *grid = new QGrid( 1, this ); 00023 00024 00025 00026 QVBoxLayout *vbox = new QVBoxLayout( this ); 00027 00028 00029 00030 vbox->setAutoAdd( true ); 00031 vbox->setMargin( 10 ); 00032 00033 QHBox *hbox = new QHBox( grid); 00034 00035 grid->setSpacing( 7 ); 00036 grid->setMargin( 5 ); 00037 00038 new QLabel( "File: ", hbox ); 00039 00040 filePath = new QLineEdit( hbox ); 00041 filePath->setMinimumWidth( 225 ); 00042 00043 hbox->setSpacing( 5 ); 00044 00045 browse = new QPushButton( "Browse", hbox );//browse button 00046 QObject::connect( browse, SIGNAL( clicked() ), this, SLOT( setSavePath() ) ); 00047 00048 00049 QHBox * delimbox = new QHBox(grid); 00050 delimbox->setSpacing(5); 00051 00052 new QLabel("Delimiter: ", delimbox ); 00053 00054 delim = new QComboBox( delimbox, "Delimiter"); 00055 delim->insertItem("; (semi-colon)"); 00056 delim->insertItem(", (comma)"); 00057 delim->insertItem("\t (tab)"); 00058 //QObject::connect(delim, signal(activated(const QString & str)), this, slot(setDelim(const QString & str))); 00059 00060 QHBox *buttonBox = new QHBox(grid ); 00061 00062 go = new QPushButton("Convert", buttonBox);//button to do processing 00063 QObject::connect(go, SIGNAL(clicked()), this, SLOT(doConvert())); 00064 00065 cancel = new QPushButton("Cancel", buttonBox);//cancel 00066 QObject::connect(cancel, SIGNAL(clicked()), this, SLOT(close())); 00067 00068 00069 } 00070 00071 void SpreadsheetDialog::setSavePath() { 00072 00073 QString img = QFileDialog::getSaveFileName(QString::null, QString::null, this); 00074 if ( img.isNull() ) 00075 return; 00076 filePath->setText( (const char*)img ); 00077 } 00078 00079 void SpreadsheetDialog::doConvert(){ 00080 std::string delimStr; 00081 const char* temp = (delim->currentText()).ascii(); 00082 delimStr = temp[0]; 00083 gtos->convert( std::string((filePath->text()).ascii()), delimStr); 00084 accept(); 00085 } 00086 00087
Home |
Search |
Disclaimers & Privacy |
Contact Us GLIMSView Maintainer: dsoltesz@usgs.gov |