mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-08 08:54:41 -04:00
1. Use a ComboBox for palette selection.
2. Minor adjustments to position of WideGraph controls. 3. Include the palette files. The whole directory "Palettes" should be copied into the install directory. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@3529 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
+20
-21
@@ -54,9 +54,22 @@ WideGraph::WideGraph(QWidget *parent) :
|
||||
ui->widePlot->setStartFreq(settings.value("StartFreq",0).toInt());
|
||||
ui->fStartSpinBox->setValue(ui->widePlot->startFreq());
|
||||
m_waterfallPalette=settings.value("WaterfallPalette","default").toString();
|
||||
ui->labPalette->setText(m_waterfallPalette.mid(0,1).toUpper() +
|
||||
m_waterfallPalette.mid(1));
|
||||
settings.endGroup();
|
||||
|
||||
QDir recoredDir("Palettes");
|
||||
QStringList allFiles = recoredDir.entryList(QDir::NoDotAndDotDot |
|
||||
QDir::System | QDir::Hidden | QDir::AllDirs | QDir::Files,
|
||||
QDir::DirsFirst);
|
||||
int index=0;
|
||||
foreach(QString file, allFiles) {
|
||||
QString t=file.mid(0,file.length()-4);
|
||||
ui->paletteComboBox->addItem(t);
|
||||
if(t==m_waterfallPalette) {
|
||||
ui->paletteComboBox->setCurrentIndex(index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
// ui->paletteComboBox->lineEdit()->setAlignment(Qt::AlignHCenter);
|
||||
readPalette("Palettes/" + m_waterfallPalette + ".pal");
|
||||
}
|
||||
|
||||
@@ -320,19 +333,6 @@ void WideGraph::on_fStartSpinBox_valueChanged(int n)
|
||||
ui->widePlot->setStartFreq(n);
|
||||
}
|
||||
|
||||
void WideGraph::on_pbPalette_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, tr("Select Palette"),
|
||||
"./Palettes", tr("Files (*.pal)"));
|
||||
if(fileName!="") readPalette(fileName);
|
||||
/*
|
||||
QColor color = QColorDialog::getColor(Qt::yellow, this );
|
||||
if(color.isValid()) {
|
||||
qDebug( "ok" );
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void WideGraph::readPalette(QString fileName)
|
||||
{
|
||||
QFile f;
|
||||
@@ -357,12 +357,6 @@ void WideGraph::readPalette(QString fileName)
|
||||
int bb=b[j0] + int((k*(b[j1]-b[j0]))/31 + 0.5);
|
||||
ui->widePlot->m_ColorTbl[i].setRgb(rr,gg,bb);
|
||||
}
|
||||
QFileInfo fileInfo(f);
|
||||
t=fileInfo.fileName();
|
||||
int n=t.length();
|
||||
m_waterfallPalette=t.mid(0,n-4);
|
||||
ui->labPalette->setText(m_waterfallPalette.mid(0,1).toUpper() +
|
||||
m_waterfallPalette.mid(1));
|
||||
} else {
|
||||
QMessageBox msgBox0;
|
||||
QString t="Error: Cannot find requested palette file " + fileName;
|
||||
@@ -370,3 +364,8 @@ void WideGraph::readPalette(QString fileName)
|
||||
msgBox0.exec();
|
||||
}
|
||||
}
|
||||
|
||||
void WideGraph::on_paletteComboBox_activated(const QString &palette)
|
||||
{
|
||||
readPalette("Palettes/" + palette + ".pal");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user