ParamPage
::ParamPage(QWidget *parent
) {
desktopGeometry
= QApplication::desktop()->availableGeometry
(0);
configGroup->setLayout(gridLayout);
parButton->setText("new_par");
modButton->setText("add par");
pathLabel
= new QLabel(configGroup
);
pathLabel->setText("File");
// QLabel *serverLabel = new QLabel(tr("Server:"));
//QComboBox *serverCombo = new QComboBox;
//serverCombo->addItem(tr("Trolltech (Australia)"));
//serverCombo->addItem(tr("Trolltech (Germany)"));
//serverCombo->addItem(tr("Trolltech (Norway)"));
//serverCombo->addItem(tr("Trolltech (People's Republic of China)"));
//serverCombo->addItem(tr("Trolltech (USA)"));
gridLayout->addWidget( parButton);
gridLayout->addWidget(modButton);
gridLayout->addWidget(pathLabel);
gridLayout->addWidget(fileNameEdit);
scrollArea->setWidget(configGroup);
layout->addWidget(scrollArea);
setLayout(layout);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
//serverLayout->addWidget(serverCombo);
connect(parButton, SIGNAL (clicked()), this, SLOT( paramClicked()));
connect(modButton, SIGNAL (clicked()), this, SLOT( modifClicked()));
connect(QApplication::desktop(),
SIGNAL(workAreaResized
(int)),
this, SLOT(desktopResized(int)));
}
void ParamPage::desktopResized(int screen)
{
if (screen != 0)
return;
reactToSIP();
}
void ParamPage::reactToSIP()
{
if (desktopGeometry != availableGeometry) {
if (windowState() | Qt::WindowMaximized)
setWindowState(windowState() & ~Qt::WindowMaximized);
setGeometry(availableGeometry);
}
desktopGeometry = availableGeometry;
}
void ParamPage::paramClicked(){
bool ok;
text
= QInputDialog::getText(scrollArea, tr
("Nuovo parametro"),
&ok);
num
= QInputDialog::getInteger(scrollArea, tr
("Numero colonne"),tr
("Percentage:"),
25,
0,
100,
1,
&ok
);
// QVBoxLayout *mainLayout = new QVBoxLayout;
// QLabel* l = new QLabel("new label", this);
// mainLayout->addWidget(l,1,0);
if(ok){
label
= new QLabel(scrollArea
);
//label->adjustSize();
//label->setIndent(15);
//this->layout()->set
this->layout()->addWidget(label);
label->setText(text);
for(int i;i<num;i++){
this->layout()->addWidget(edit[i]);
}
// mainLayout->addWidget(label,1,0);
// mainLayout->addWidget(label,3,0);
// setLayout(mainLayout);
//lineEdit = new QLineEdit(this);
//lineEdit->set
// this->layout()->addWidget(lineEdit);
//layout()->addWidget(lineEdit);
}
}
void ParamPage::modifClicked(){
QFileDialog::getOpenFileName(this, tr
("Open CFG File"),
tr("CFG Files ( *.cfg)"));
fileNameEdit->setText(fileInfo.absoluteFilePath());
//pathValueLabel = new QLabel(fileInfo.fileName());
// pathValueLabel->setFrameStyle(QFrame::Panel | QFrame::Sunken);
return ;
prev="";
lineNumber=0;
while (!file.atEnd()) {
listFileData.append(line);
if(line.startsWith("Fine File")){
//line=prev;
list
= line.
split(QRegExp("\\s+"));
str.append("Exec ");
str.append("/CODE/ScriptFiles/BatchModeRunning/");
str.append("\n");
str.append("Fine File");
str.append(list[1]);
listFileData.replace(lineNumber,str);
}
// else{
// prev= line;
// }
lineNumber ++;
}
writeToFile();
}
void ParamPage::writeToFile(){
QFile file("Config_new.cfg");
return;
for(int i = 0; i<listFileData.size(); i++)
out << listFileData.at(i) << "\n";
}