forked from organicmaps/organicmaps
improved interface
This commit is contained in:
parent
7e683f9faf
commit
d9af20b0e3
2 changed files with 44 additions and 0 deletions
|
@ -24,6 +24,9 @@ Widget::Widget(QWidget *parent) :
|
|||
connect(&m_engine, SIGNAL(UpdateProgress(int)), this, SLOT(UpdateProgress(int)), Qt::QueuedConnection);
|
||||
connect(&m_engine, SIGNAL(EndEngine()), this, SLOT(EndEngine()), Qt::QueuedConnection);
|
||||
|
||||
connect(&m_engine, SIGNAL(ConvertStarted()), this, SLOT(ConvertStart()));
|
||||
connect(&m_engine, SIGNAL(ConvertEnded()), this, SLOT(ConvertEnd()));
|
||||
|
||||
ui->progressBar->reset();
|
||||
|
||||
QSettings s("settings.ini", QSettings::IniFormat, this);
|
||||
|
@ -32,6 +35,12 @@ Widget::Widget(QWidget *parent) :
|
|||
if (LoadUnicodeBlocksImpl(v) == false)
|
||||
s.setValue("unicode_file", "");
|
||||
|
||||
QString exportPath = s.value("export_path", "").toString();
|
||||
if (!exportPath.isEmpty())
|
||||
{
|
||||
ResolveExportPath(exportPath);
|
||||
}
|
||||
|
||||
QPixmap p(350, 350);
|
||||
p.fill(Qt::black);
|
||||
ui->preview->setPixmap(p);
|
||||
|
@ -43,6 +52,8 @@ Widget::~Widget()
|
|||
QSettings s("settings.ini", QSettings::IniFormat, this);
|
||||
if (!ui->unicodesblocks->text().isEmpty())
|
||||
s.setValue("unicode_file", ui->unicodesblocks->text());
|
||||
if (!ui->exportpath->text().isEmpty())
|
||||
s.setValue("export_path", ui->exportpath->text());
|
||||
delete ui;
|
||||
}
|
||||
|
||||
|
@ -60,6 +71,13 @@ void Widget::ResolveExportPath()
|
|||
UpdateButton();
|
||||
}
|
||||
|
||||
void Widget::ResolveExportPath(const QString & filePath)
|
||||
{
|
||||
ui->exportpath->setText(filePath);
|
||||
m_engine.SetExportPath(filePath);
|
||||
UpdateButton();
|
||||
}
|
||||
|
||||
void Widget::Export()
|
||||
{
|
||||
m_engine.RunExport();
|
||||
|
@ -92,6 +110,28 @@ void Widget::EndEngine()
|
|||
ui->progressBar->reset();
|
||||
}
|
||||
|
||||
void Widget::ConvertStart()
|
||||
{
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(0);
|
||||
ui->progressBar->setValue(0);
|
||||
|
||||
ui->runExport->setEnabled(false);
|
||||
ui->selectExportPath->setEnabled(false);
|
||||
ui->selectunicodeblocks->setEnabled(false);
|
||||
}
|
||||
|
||||
void Widget::ConvertEnd()
|
||||
{
|
||||
ui->progressBar->setMinimum(0);
|
||||
ui->progressBar->setMaximum(100);
|
||||
ui->progressBar->setValue(0);
|
||||
|
||||
ui->runExport->setEnabled(true);
|
||||
ui->selectExportPath->setEnabled(true);
|
||||
ui->selectunicodeblocks->setEnabled(true);
|
||||
}
|
||||
|
||||
void Widget::UpdateButton()
|
||||
{
|
||||
ui->runExport->setEnabled(m_engine.IsReadyToExport());
|
||||
|
|
|
@ -18,6 +18,7 @@ public:
|
|||
private:
|
||||
Q_SLOT void LoadUnicodeBlocks();
|
||||
Q_SLOT void ResolveExportPath();
|
||||
Q_SLOT void ResolveExportPath(const QString &filePath);
|
||||
Q_SLOT void Export();
|
||||
Q_SLOT void UpdatePreview(QImage);
|
||||
Q_SLOT void UpdateEngine(int);
|
||||
|
@ -26,6 +27,9 @@ private:
|
|||
Q_SLOT void UpdateProgress(int value);
|
||||
Q_SLOT void EndEngine();
|
||||
|
||||
Q_SLOT void ConvertStart();
|
||||
Q_SLOT void ConvertEnd();
|
||||
|
||||
private:
|
||||
void UpdateButton();
|
||||
bool LoadUnicodeBlocksImpl(QString const & filePath);
|
||||
|
|
Loading…
Add table
Reference in a new issue