Position and size of search-windows are stored now.
OK-button of search windows are disabled until valid values are available.
This commit is contained in:
@@ -859,12 +859,28 @@ bool cMainWindow::runMovieEdit(cMovie *lpMovie)
|
||||
void cMainWindow::onActionAdd()
|
||||
{
|
||||
cSearch* lpSearch = new cSearch(this);
|
||||
|
||||
QSettings settings;
|
||||
qint16 iX = settings.value("search/x", QVariant::fromValue(-1)).toInt();
|
||||
qint16 iY = settings.value("search/y", QVariant::fromValue(-1)).toInt();
|
||||
qint16 iWidth = settings.value("search/width", QVariant::fromValue(-1)).toInt();
|
||||
qint16 iHeight = settings.value("search/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iX != -1 && iY != -1)
|
||||
lpSearch->move(iX, iY);
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
lpSearch->resize(iWidth, iHeight);
|
||||
|
||||
if(lpSearch->exec() == QDialog::Rejected)
|
||||
{
|
||||
delete lpSearch;
|
||||
return;
|
||||
}
|
||||
|
||||
settings.setValue("search/width", QVariant::fromValue(lpSearch->size().width()));
|
||||
settings.setValue("search/height", QVariant::fromValue(lpSearch->size().height()));
|
||||
settings.setValue("search/x", QVariant::fromValue(lpSearch->x()));
|
||||
settings.setValue("search/y", QVariant::fromValue(lpSearch->y()));
|
||||
|
||||
qint32 id = lpSearch->id();
|
||||
QString szPlaceholder = lpSearch->placeholderName();
|
||||
@@ -937,12 +953,28 @@ void cMainWindow::onActionAdd()
|
||||
void cMainWindow::onActionMovieAdd()
|
||||
{
|
||||
cMovieSearch* lpSearch = new cMovieSearch(this);
|
||||
|
||||
QSettings settings;
|
||||
qint16 iX = settings.value("movieSearch/x", QVariant::fromValue(-1)).toInt();
|
||||
qint16 iY = settings.value("movieSearch/y", QVariant::fromValue(-1)).toInt();
|
||||
qint16 iWidth = settings.value("movieSearch/width", QVariant::fromValue(-1)).toInt();
|
||||
qint16 iHeight = settings.value("movieSearch/height", QVariant::fromValue(-1)).toInt();
|
||||
|
||||
if(iX != -1 && iY != -1)
|
||||
lpSearch->move(iX, iY);
|
||||
if(iWidth != -1 && iHeight != -1)
|
||||
lpSearch->resize(iWidth, iHeight);
|
||||
|
||||
if(lpSearch->exec() == QDialog::Rejected)
|
||||
{
|
||||
delete lpSearch;
|
||||
return;
|
||||
}
|
||||
|
||||
settings.setValue("movieSearch/width", QVariant::fromValue(lpSearch->size().width()));
|
||||
settings.setValue("movieSearch/height", QVariant::fromValue(lpSearch->size().height()));
|
||||
settings.setValue("movieSearch/x", QVariant::fromValue(lpSearch->x()));
|
||||
settings.setValue("movieSearch/y", QVariant::fromValue(lpSearch->y()));
|
||||
|
||||
qint32 id = lpSearch->id();
|
||||
QString szPlaceholder = lpSearch->placeholderName();
|
||||
|
||||
@@ -17,6 +17,8 @@ cMovieSearch::cMovieSearch(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
ui->m_lpSearchButton->setEnabled(false);
|
||||
ui->m_lpTabWidget->setCurrentIndex(0);
|
||||
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
cMovieSearch::~cMovieSearch()
|
||||
@@ -102,3 +104,44 @@ qint16 cMovieSearch::year()
|
||||
{
|
||||
return(ui->m_lpYear->value());
|
||||
}
|
||||
|
||||
void cMovieSearch::on_m_lpResults_clicked(const QModelIndex &index)
|
||||
{
|
||||
setButtonBox();
|
||||
}
|
||||
|
||||
void cMovieSearch::on_m_lpPlaceholderName_textChanged(const QString &arg1)
|
||||
{
|
||||
setButtonBox();
|
||||
}
|
||||
|
||||
void cMovieSearch::on_m_lpYear_valueChanged(int arg1)
|
||||
{
|
||||
setButtonBox();
|
||||
}
|
||||
|
||||
void cMovieSearch::setButtonBox()
|
||||
{
|
||||
if(ui->m_lpTabWidget->currentIndex() == 0)
|
||||
{
|
||||
if(ui->m_lpResults->selectedItems().count())
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
else
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(ui->m_lpPlaceholderName->text().isEmpty())
|
||||
{
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(ui->m_lpYear->value() == 0)
|
||||
{
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
}
|
||||
|
||||
+8
-2
@@ -22,12 +22,18 @@ public:
|
||||
qint16 year();
|
||||
|
||||
private slots:
|
||||
void on_m_lpSearchButton_clicked();
|
||||
void on_m_lpSearchButton_clicked();
|
||||
|
||||
void on_m_lpSearch_textChanged(const QString &arg1);
|
||||
void on_m_lpSearch_textChanged(const QString &arg1);
|
||||
void on_m_lpPlaceholderName_textChanged(const QString &arg1);
|
||||
void on_m_lpYear_valueChanged(int arg1);
|
||||
|
||||
void on_m_lpResults_clicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::cMovieSearch *ui;
|
||||
|
||||
void setButtonBox();
|
||||
};
|
||||
|
||||
#endif // CMOVIESEARCH_H
|
||||
|
||||
+9
-1
@@ -27,7 +27,7 @@
|
||||
<item row="0" column="0">
|
||||
<widget class="QTabWidget" name="m_lpTabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Search">
|
||||
<attribute name="title">
|
||||
@@ -142,6 +142,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>m_lpSearch</tabstop>
|
||||
<tabstop>m_lpSearchButton</tabstop>
|
||||
<tabstop>m_lpResults</tabstop>
|
||||
<tabstop>m_lpTabWidget</tabstop>
|
||||
<tabstop>m_lpPlaceholderName</tabstop>
|
||||
<tabstop>m_lpYear</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
+43
@@ -16,6 +16,8 @@ cSearch::cSearch(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
ui->m_lpSearchButton->setEnabled(false);
|
||||
ui->m_lpTabWidget->setCurrentIndex(0);
|
||||
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
}
|
||||
|
||||
cSearch::~cSearch()
|
||||
@@ -86,3 +88,44 @@ qint16 cSearch::year()
|
||||
{
|
||||
return(ui->m_lpYear->value());
|
||||
}
|
||||
|
||||
void cSearch::on_m_lpResults_clicked(const QModelIndex &index)
|
||||
{
|
||||
setButtonBox();
|
||||
}
|
||||
|
||||
void cSearch::on_m_lpPlaceholderName_textChanged(const QString& /*arg1*/)
|
||||
{
|
||||
setButtonBox();
|
||||
}
|
||||
|
||||
void cSearch::on_m_lpYear_valueChanged(int /*arg1*/)
|
||||
{
|
||||
setButtonBox();
|
||||
}
|
||||
|
||||
void cSearch::setButtonBox()
|
||||
{
|
||||
if(ui->m_lpTabWidget->currentIndex() == 0)
|
||||
{
|
||||
if(ui->m_lpResults->selectedItems().count())
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
else
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(ui->m_lpPlaceholderName->text().isEmpty())
|
||||
{
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if(ui->m_lpYear->value() == 0)
|
||||
{
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
ui->m_lpButtonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
|
||||
}
|
||||
|
||||
@@ -22,11 +22,17 @@ public:
|
||||
qint16 year();
|
||||
|
||||
private slots:
|
||||
void on_m_lpSearchButton_clicked();
|
||||
void on_m_lpSearch_textChanged(const QString &arg1);
|
||||
void on_m_lpSearchButton_clicked();
|
||||
void on_m_lpSearch_textChanged(const QString &arg1);
|
||||
|
||||
void on_m_lpResults_clicked(const QModelIndex &index);
|
||||
void on_m_lpPlaceholderName_textChanged(const QString &arg1);
|
||||
void on_m_lpYear_valueChanged(int arg1);
|
||||
|
||||
private:
|
||||
Ui::cSearch *ui;
|
||||
|
||||
void setButtonBox();
|
||||
};
|
||||
|
||||
#endif // CSEARCH_H
|
||||
|
||||
@@ -142,6 +142,14 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>m_lpSearch</tabstop>
|
||||
<tabstop>m_lpSearchButton</tabstop>
|
||||
<tabstop>m_lpResults</tabstop>
|
||||
<tabstop>m_lpTabWidget</tabstop>
|
||||
<tabstop>m_lpPlaceholderName</tabstop>
|
||||
<tabstop>m_lpYear</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
|
||||
Reference in New Issue
Block a user