//definicja klasy renamer
#include "renamer.h"
#include <QPushButton>
#include <QApplication>
#include <QLabel>
#include <QRadioButton>
#include <QGroupBox>
#include <QLineEdit>
#include <QButtonGroup>
#include <QSpinBox>
#include <QRegExp>
#include <QValidator>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
setWindowTitle(tr("MTRenaMeR"));
setFixedSize(500,300);
initialization();
qWarning("initialization();");
arranging();
qWarning("arranging();");
show();
}
void RenamerWidget::initialization(void) {
chooseFiles_Button
= new QPushButton(tr
("Wybierz pliki"));
changeNames_Button
= new QPushButton(tr
("Zmien nazwy"));
changeNames_Button->setEnabled(false);
connect(exit_Button, SIGNAL(clicked()), qApp, SLOT(quit()));
connect(changeNames_Button, SIGNAL(clicked()), this, SLOT(alterNames()));
connect(chooseFiles_Button, SIGNAL(clicked()), this, SLOT(selectFiles()));
howManyFiles_L
= new QLabel(tr
("Nie wybrano zadnych plikow."));
rx
= new QRegExp("[A-Za-z0-9]{1,25}_");
chain_LE->setValidator(validator);
connect(chain_LE,
SIGNAL(textChanged
(const QString &)),
this,
SLOT(checkInput
()));
constantAmountOfDigits_RB
= new QRadioButton(tr
("Stala ilosc cyfr"));
elasticAmountOfDigits_RB
= new QRadioButton(tr
("Zmienna ilosc cyfr"));
radioGroup_BG->addButton(constantAmountOfDigits_RB,1);
radioGroup_BG->addButton(elasticAmountOfDigits_RB,2);
connect(constantAmountOfDigits_RB, SIGNAL(clicked(bool)), this, SLOT(constDigitsSpin(bool)));
howManyDigits_SB->setRange(2,4);
howManyDigits_SB->setValue(2);
howManyDigits_SB->setEnabled(false);
startingDigit_L
= new QLabel(tr
("Cyfra poczatkowa"));
startingDigit_SB->setRange(1,MAX_START_NUMBER);
startingDigit_SB->setValue(1);
elasticAmountOfDigits_RB->setChecked(true);
connect(elasticAmountOfDigits_RB, SIGNAL(clicked(bool)), this, SLOT(resetSpinRange(bool)));
connect(howManyDigits_SB, SIGNAL(valueChanged(int)), this, SLOT(changeSpinRange(int)));
}
void RenamerWidget::checkInput(void) {
changeNames_Button->setEnabled(chain_LE->hasAcceptableInput());
}
void RenamerWidget::constDigitsSpin(bool bl) {
howManyDigits_SB->setEnabled(bl);
}
void RenamerWidget::resetSpinRange(bool bl) {
if (bl==true) startingDigit_SB->setRange(1,MAX_START_NUMBER);
}
void RenamerWidget::changeSpinRange(int it) {
switch (it) {
case 2: startingDigit_SB->setRange(1,98);
break;
case 3: startingDigit_SB->setRange(1,998);
break;
case 4: startingDigit_SB->setRange(1,9998);
break;
default: startingDigit_SB->setRange(1,98);
}
startingDigit_SB->setValue(1);
}
void RenamerWidget::arranging(void) {
newName_GB
= new QGroupBox(tr
("Nowa nazwa"));
numerationStyle_GB
= new QGroupBox(tr
("Sposob numeracji"));
newName_GB->setLayout(v1L);
mainL->addLayout(h1L);
mainL->addWidget(newName_GB);
mainL->addLayout(h4L);
v1L->addLayout(h2L);
v1L->addLayout(h3L);
h1L->addWidget(chooseFiles_Button);
h1L->addWidget(howManyFiles_L);
h4L->addWidget(changeNames_Button);
h4L->addWidget(exit_Button);
/*
h2L->addWidget(lineEditDescription_L);
h2L->addWidget(chain_LE);
*/
setLayout(mainL);
}
void RenamerWidget::alterNames(void) {
}
void RenamerWidget::selectFiles(void) {
}
//definicja klasy renamer
#include "renamer.h"
#include <QPushButton>
#include <QApplication>
#include <QLabel>
#include <QRadioButton>
#include <QGroupBox>
#include <QLineEdit>
#include <QButtonGroup>
#include <QSpinBox>
#include <QRegExp>
#include <QValidator>
#include <QGridLayout>
#include <QVBoxLayout>
#include <QHBoxLayout>
RenamerWidget::RenamerWidget(QWidget *parent) : QWidget(parent) {
setWindowTitle(tr("MTRenaMeR"));
setFixedSize(500,300);
initialization();
qWarning("initialization();");
arranging();
qWarning("arranging();");
show();
}
void RenamerWidget::initialization(void) {
chooseFiles_Button = new QPushButton(tr("Wybierz pliki"));
exit_Button = new QPushButton(tr("Wyjdz"));
changeNames_Button = new QPushButton(tr("Zmien nazwy"));
changeNames_Button->setEnabled(false);
connect(exit_Button, SIGNAL(clicked()), qApp, SLOT(quit()));
connect(changeNames_Button, SIGNAL(clicked()), this, SLOT(alterNames()));
connect(chooseFiles_Button, SIGNAL(clicked()), this, SLOT(selectFiles()));
howManyFiles_L = new QLabel(tr("Nie wybrano zadnych plikow."));
chain_LE = new QLineEdit;
rx = new QRegExp("[A-Za-z0-9]{1,25}_");
validator = new QRegExpValidator(*rx,0);
chain_LE->setValidator(validator);
connect(chain_LE, SIGNAL(textChanged(const QString &)), this, SLOT(checkInput()));
constantAmountOfDigits_RB = new QRadioButton(tr("Stala ilosc cyfr"));
elasticAmountOfDigits_RB = new QRadioButton(tr("Zmienna ilosc cyfr"));
radioGroup_BG = new QButtonGroup;
radioGroup_BG->addButton(constantAmountOfDigits_RB,1);
radioGroup_BG->addButton(elasticAmountOfDigits_RB,2);
connect(constantAmountOfDigits_RB, SIGNAL(clicked(bool)), this, SLOT(constDigitsSpin(bool)));
howManyDigits_SB = new QSpinBox;
howManyDigits_SB->setRange(2,4);
howManyDigits_SB->setValue(2);
howManyDigits_SB->setEnabled(false);
startingDigit_L = new QLabel(tr("Cyfra poczatkowa"));
startingDigit_SB = new QSpinBox;
startingDigit_SB->setRange(1,MAX_START_NUMBER);
startingDigit_SB->setValue(1);
elasticAmountOfDigits_RB->setChecked(true);
connect(elasticAmountOfDigits_RB, SIGNAL(clicked(bool)), this, SLOT(resetSpinRange(bool)));
connect(howManyDigits_SB, SIGNAL(valueChanged(int)), this, SLOT(changeSpinRange(int)));
}
void RenamerWidget::checkInput(void) {
changeNames_Button->setEnabled(chain_LE->hasAcceptableInput());
}
void RenamerWidget::constDigitsSpin(bool bl) {
howManyDigits_SB->setEnabled(bl);
}
void RenamerWidget::resetSpinRange(bool bl) {
if (bl==true) startingDigit_SB->setRange(1,MAX_START_NUMBER);
}
void RenamerWidget::changeSpinRange(int it) {
switch (it) {
case 2: startingDigit_SB->setRange(1,98);
break;
case 3: startingDigit_SB->setRange(1,998);
break;
case 4: startingDigit_SB->setRange(1,9998);
break;
default: startingDigit_SB->setRange(1,98);
}
startingDigit_SB->setValue(1);
}
void RenamerWidget::arranging(void) {
newName_GB = new QGroupBox(tr("Nowa nazwa"));
numerationStyle_GB = new QGroupBox(tr("Sposob numeracji"));
QVBoxLayout *mainL = new QVBoxLayout;
QVBoxLayout *v1L = new QVBoxLayout;
QHBoxLayout *h1L = new QHBoxLayout;
QHBoxLayout *h2L = new QHBoxLayout;
QHBoxLayout *h3L = new QHBoxLayout;
QHBoxLayout *h4L = new QHBoxLayout;
newName_GB->setLayout(v1L);
mainL->addLayout(h1L);
mainL->addWidget(newName_GB);
mainL->addLayout(h4L);
v1L->addLayout(h2L);
v1L->addLayout(h3L);
h1L->addWidget(chooseFiles_Button);
h1L->addWidget(howManyFiles_L);
h4L->addWidget(changeNames_Button);
h4L->addWidget(exit_Button);
/*
h2L->addWidget(lineEditDescription_L);
h2L->addWidget(chain_LE);
*/
setLayout(mainL);
}
void RenamerWidget::alterNames(void) {
}
void RenamerWidget::selectFiles(void) {
}
To copy to clipboard, switch view to plain text mode
#include <QApplication>
#include "renamer.h"
int main(int argc, char *argv[]) {
RenamerWidget window;
return app.exec();
}
#include <QApplication>
#include "renamer.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
RenamerWidget window;
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks