Commit f64f15df authored by pixhawk's avatar pixhawk

Temporarily removed flite, fixed crash caused by tree view

parent 7b42cbd7
......@@ -116,10 +116,10 @@ linux-g++ {
LIBS += -lm \
#-lflite_cmu_us_rms \
#-lflite_cmu_us_slt \
-lflite_usenglish \
-lflite_cmulex \
-lflite_cmu_us_kal16 \
-lflite \
#-lflite_cmu_us_kal16 \
#-lflite_usenglish \
#-lflite_cmulex \
#-lflite \
-lSDL \
-lSDLmain
}
......
......@@ -91,7 +91,7 @@ GAudioOutput::GAudioOutput(QObject* parent) : QObject(parent),
voiceIndex(0),
emergency(false)
{
#ifdef Q_OS_LINUX
#ifdef Q_OS_LINUX2
flite_init();
#endif
// Initialize audio output
......
......@@ -39,7 +39,7 @@ This file is part of the PIXHAWK project
#include <Phonon>
#endif
#ifdef Q_OS_LINUX
#include <flite/flite.h>
//#include <flite/flite.h>
#include <phonon>
#endif
#ifdef Q_OS_WIN
......@@ -52,7 +52,7 @@ This file is part of the PIXHAWK project
#endif
*/
#ifdef Q_OS_LINUX
#ifdef Q_OS_LINUX2
extern "C" {
cst_voice *REGISTER_VOX(const char *voxdir);
void UNREGISTER_VOX(cst_voice *vox);
......
......@@ -17,7 +17,7 @@ ParameterInterface::ParameterInterface(QWidget *parent) :
tree = new ParamTreeModel();
treeView = new QTreeView(this);
//treeView->setModel(tree);
treeView->setModel(tree);
QStackedWidget* stack = m_ui->stackedWidget;
stack->addWidget(treeView);
......
......@@ -37,6 +37,8 @@ ParamTreeItem::ParamTreeItem(QString name, float value, ParamTreeItem* parent)
parentItem = parent;
paramName = name;
paramValue = value;
// Initialize empty itemData
itemData = QList<QVariant>();
}
ParamTreeItem::ParamTreeItem(const QList<QVariant> &data, ParamTreeItem *parent)
......@@ -82,20 +84,27 @@ float ParamTreeItem::getParamValue()
QVariant ParamTreeItem::data(int column) const
{
QVariant ret;
switch (column)
if (itemData.empty())
{
case 0:
ret.setValue(paramName);
break;
case 1:
ret.setValue(paramValue);
break;
default:
ret.setValue(QString(""));
break;
QVariant ret;
switch (column)
{
case 0:
ret.setValue(paramName);
break;
case 1:
ret.setValue(paramValue);
break;
default:
ret.setValue(QString(""));
break;
}
return ret;
}
else
{
return itemData.value(column, QVariant(QString("")));
}
//return itemData.value(column);
}
ParamTreeItem *ParamTreeItem::parent()
......
......@@ -40,8 +40,9 @@ ParamTreeModel::ParamTreeModel(QObject *parent)
QList<QVariant> rootData;
rootData << tr("Parameter") << tr("Value");
rootItem = new ParamTreeItem(rootData);
QString data = "IMU\n ROLL_K_I\t1.255\n PITCH_K_P\t0.621\n PITCH_K_I\t2.5545\n";
setupModelData(data.split(QString("\n")), rootItem);
//String data = "IMU\n ROLL_K_I\t1.255\n PITCH_K_P\t0.621\n PITCH_K_I\t2.5545\n";
//setupModelData(data.split(QString("\n")), rootItem);
}
ParamTreeModel::ParamTreeModel(const QString &data, QObject *parent)
......@@ -80,12 +81,17 @@ QVariant ParamTreeModel::data(const QModelIndex &index, int role) const
return item->data(index.column());
}
bool ParamTreeModel::setData (const QModelIndex & index, const QVariant & value, int role)
{
}
Qt::ItemFlags ParamTreeModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return 0;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
}
QVariant ParamTreeModel::headerData(int section, Qt::Orientation orientation,
......
......@@ -47,6 +47,7 @@ public:
~ParamTreeModel();
QVariant data(const QModelIndex &index, int role) const;
bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
Qt::ItemFlags flags(const QModelIndex &index) const;
QVariant headerData(int section, Qt::Orientation orientation,
int role = Qt::DisplayRole) const;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment