mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 04:54:29 -04:00
Corregida la validaci?n a los di?logos de crear y a?adir
This commit is contained in:
@ -17,10 +17,12 @@ void AddLibraryDialog::setupUI()
|
|||||||
textLabel = new QLabel(tr("Comics folder : "));
|
textLabel = new QLabel(tr("Comics folder : "));
|
||||||
path = new QLineEdit;
|
path = new QLineEdit;
|
||||||
textLabel->setBuddy(path);
|
textLabel->setBuddy(path);
|
||||||
|
connect(path,SIGNAL(textChanged(QString)),this,SLOT(pathSetted(QString)));
|
||||||
|
|
||||||
nameLabel = new QLabel(tr("Library Name : "));
|
nameLabel = new QLabel(tr("Library Name : "));
|
||||||
nameEdit = new QLineEdit;
|
nameEdit = new QLineEdit;
|
||||||
nameLabel->setBuddy(nameEdit);
|
nameLabel->setBuddy(nameEdit);
|
||||||
|
connect(nameEdit,SIGNAL(textChanged(QString)),this,SLOT(nameSetted(QString)));
|
||||||
|
|
||||||
accept = new QPushButton(tr("Add"));
|
accept = new QPushButton(tr("Add"));
|
||||||
accept->setDisabled(true);
|
accept->setDisabled(true);
|
||||||
@ -72,14 +74,46 @@ void AddLibraryDialog::add()
|
|||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddLibraryDialog::nameSetted(const QString & text)
|
||||||
|
{
|
||||||
|
if(!text.isEmpty())
|
||||||
|
{
|
||||||
|
if(!path->text().isEmpty())
|
||||||
|
{
|
||||||
|
QFileInfo fi(path->text());
|
||||||
|
if(fi.isDir())
|
||||||
|
accept->setEnabled(true);
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddLibraryDialog::pathSetted(const QString & text)
|
||||||
|
{
|
||||||
|
QFileInfo fi(text);
|
||||||
|
if(fi.isDir())
|
||||||
|
{
|
||||||
|
if(!nameEdit->text().isEmpty())
|
||||||
|
accept->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
void AddLibraryDialog::findPath()
|
void AddLibraryDialog::findPath()
|
||||||
{
|
{
|
||||||
QString s = QFileDialog::getExistingDirectory(0,"Comics directory",".");
|
QString s = QFileDialog::getExistingDirectory(0,"Comics directory",".");
|
||||||
if(!s.isEmpty())
|
if(!s.isEmpty())
|
||||||
{
|
{
|
||||||
path->setText(s);
|
path->setText(s);
|
||||||
accept->setEnabled(true);
|
if(!nameEdit->text().isEmpty())
|
||||||
|
accept->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddLibraryDialog::close()
|
void AddLibraryDialog::close()
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
void add();
|
void add();
|
||||||
void findPath();
|
void findPath();
|
||||||
void close();
|
void close();
|
||||||
|
void nameSetted(const QString & text);
|
||||||
|
void pathSetted(const QString & text);
|
||||||
signals:
|
signals:
|
||||||
void addLibrary(QString target, QString name);
|
void addLibrary(QString target, QString name);
|
||||||
};
|
};
|
||||||
|
@ -17,10 +17,12 @@ void CreateLibraryDialog::setupUI()
|
|||||||
textLabel = new QLabel(tr("Comics folder : "));
|
textLabel = new QLabel(tr("Comics folder : "));
|
||||||
path = new QLineEdit;
|
path = new QLineEdit;
|
||||||
textLabel->setBuddy(path);
|
textLabel->setBuddy(path);
|
||||||
|
connect(path,SIGNAL(textChanged(QString)),this,SLOT(pathSetted(QString)));
|
||||||
|
|
||||||
nameLabel = new QLabel(tr("Library Name : "));
|
nameLabel = new QLabel(tr("Library Name : "));
|
||||||
nameEdit = new QLineEdit;
|
nameEdit = new QLineEdit;
|
||||||
nameLabel->setBuddy(nameEdit);
|
nameLabel->setBuddy(nameEdit);
|
||||||
|
connect(nameEdit,SIGNAL(textChanged(QString)),this,SLOT(nameSetted(QString)));
|
||||||
|
|
||||||
accept = new QPushButton(tr("Create"));
|
accept = new QPushButton(tr("Create"));
|
||||||
accept->setDisabled(true);
|
accept->setDisabled(true);
|
||||||
@ -108,16 +110,6 @@ void CreateLibraryDialog::create()
|
|||||||
QMessageBox::critical(NULL,tr("Path not found"),tr("The selected path does not exist or is not a valid path. Be sure that you have write access to this folder"));
|
QMessageBox::critical(NULL,tr("Path not found"),tr("The selected path does not exist or is not a valid path. Be sure that you have write access to this folder"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateLibraryDialog::findPath()
|
|
||||||
{
|
|
||||||
QString s = QFileDialog::getExistingDirectory(0,"Comics directory",".");
|
|
||||||
if(!s.isEmpty())
|
|
||||||
{
|
|
||||||
path->setText(s);
|
|
||||||
accept->setEnabled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CreateLibraryDialog::showCurrentFile(QString file)
|
void CreateLibraryDialog::showCurrentFile(QString file)
|
||||||
{
|
{
|
||||||
currentFileLabel->setText(tr("Importing : \n") + file);
|
currentFileLabel->setText(tr("Importing : \n") + file);
|
||||||
@ -125,6 +117,49 @@ void CreateLibraryDialog::showCurrentFile(QString file)
|
|||||||
//this->adjustSize();
|
//this->adjustSize();
|
||||||
//is->update();
|
//is->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateLibraryDialog::nameSetted(const QString & text)
|
||||||
|
{
|
||||||
|
if(!text.isEmpty())
|
||||||
|
{
|
||||||
|
if(!path->text().isEmpty())
|
||||||
|
{
|
||||||
|
QFileInfo fi(path->text());
|
||||||
|
if(fi.isDir())
|
||||||
|
accept->setEnabled(true);
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateLibraryDialog::pathSetted(const QString & text)
|
||||||
|
{
|
||||||
|
QFileInfo fi(text);
|
||||||
|
if(fi.isDir())
|
||||||
|
{
|
||||||
|
if(!nameEdit->text().isEmpty())
|
||||||
|
accept->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CreateLibraryDialog::findPath()
|
||||||
|
{
|
||||||
|
QString s = QFileDialog::getExistingDirectory(0,"Comics directory",".");
|
||||||
|
if(!s.isEmpty())
|
||||||
|
{
|
||||||
|
path->setText(s);
|
||||||
|
if(!nameEdit->text().isEmpty())
|
||||||
|
accept->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
accept->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
void CreateLibraryDialog::close()
|
void CreateLibraryDialog::close()
|
||||||
{
|
{
|
||||||
progressBar->hide();
|
progressBar->hide();
|
||||||
|
@ -31,6 +31,8 @@
|
|||||||
void showCurrentFile(QString file);
|
void showCurrentFile(QString file);
|
||||||
void close();
|
void close();
|
||||||
void setDataAndStart(QString name, QString paht);
|
void setDataAndStart(QString name, QString paht);
|
||||||
|
void nameSetted(const QString & text);
|
||||||
|
void pathSetted(const QString & text);
|
||||||
signals:
|
signals:
|
||||||
void createLibrary(QString source, QString target, QString name);
|
void createLibrary(QString source, QString target, QString name);
|
||||||
void cancelCreate();
|
void cancelCreate();
|
||||||
|
Reference in New Issue
Block a user