void LogDetailWidget::setupModel()
{
	QAbstractItemModel *model = pieChart->model();

	model->setHeaderData(0, Qt::Horizontal, tr("Label"));
    model->setHeaderData(1, Qt::Horizontal, tr("Quantity"));

	QString colors[] = {"#ff0000", "#00ff00", "#0000ff","#ffff00", "#ff00ff", "#00ffff", "#000000", "#ffffff", "#777777", "#222222", "#aaaaaa"};

	int i=0;
	for(hash_map<string, double>::iterator it = logMan.process_stat.begin() ; it != logMan.process_stat.end(); it++)
	{
		string process = it->first;
		double duration = it->second;

		model->insertRow(i);
		model->setData(model->index(i, 0), QString::fromStdString(process));
		model->setData(model->index(i, 1), duration);

		model->setData(model->index(i, 0, QModelIndex()),
                           QColor(colors[i]), Qt::DecorationRole);
		i++;
	}

}
void GameAssetTreeWidget::InitFields()
{
	////////////////////////////////////////
	//Game Assets Tree Type
	AEQTUserTemplateData<AEQTObjType>* gameAssetsTreeType = new AEQTUserTemplateData<AEQTObjType>(AEQTObjType::GameAssetsTree);
	this->setUserData(AE_QT_USER_DATA_OBJ_TYPE_SLOT, gameAssetsTreeType);

	///////////////////////////////////////////
	//Set preferred indentation
	this->setIndentation(AE_QT_TREE_INDENTATION);

	///////////////////////////////////////////
	//Set Animation
	this->setAnimated(true);

	///////////////////////////////////////////
	//Set Alternating Row Colors
	this->setAlternatingRowColors(false);

	///////////////////////////////////////////
	//Set number of columns and their names
	this->setColumnCount(2);

	QAbstractItemModel* itemModel = this->model();

	itemModel->setHeaderData(0, Qt::Orientation::Horizontal, "Property", Qt::ItemDataRole::DisplayRole);
	itemModel->setHeaderData(1, Qt::Orientation::Horizontal, "Value", Qt::ItemDataRole::DisplayRole);

	///////////////////////////////////////////
	//Finish
	m_IsReady = true;
}
示例#3
0
void MainWindow::insertChild()
{
    QModelIndex index = view->selectionModel()->currentIndex();
    QAbstractItemModel *model = view->model();

    if (model->columnCount(index) == 0) {
        if (!model->insertColumn(0, index))
            return;
    }

    if (!model->insertRow(0, index))
        return;

    for (int column = 0; column < model->columnCount(index); ++column) {
        QModelIndex child = model->index(0, column, index);
        model->setData(child, QVariant("[No data]"), Qt::EditRole);
        if (!model->headerData(column, Qt::Horizontal).isValid())
            model->setHeaderData(column, Qt::Horizontal, QVariant("[No header]"),
                                 Qt::EditRole);
    }

    view->selectionModel()->setCurrentIndex(model->index(0, 0, index),
                                            QItemSelectionModel::ClearAndSelect);
    updateActions();
}
void LogDetailWidget::classifyAction()
{
	QAbstractItemModel *model = new QStandardItemModel(0, 6, this);
	ui.aaView->setModel(model);

	int k = 0;
	model->setHeaderData(k++, Qt::Horizontal, tr("Timestamp"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Application"));
	model->setHeaderData(k++, Qt::Horizontal, tr("GUI Component"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Control Name"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Control Type"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Control Value"));

	string eclipseStatus = "normal"; //normal edit; run or debug configuration; debug model; 
	int temp;
	int num = 0;
	for(int i=0; i<logMan.events.size(); i++)
	{
		LogEvent e = logMan.events[i];
		if(!e.isHasAcc) continue;

		model->insertRow(num);

		k = 0;
		model->setData(model->index(num,k++), QString::fromStdString(e.timestamp));
		model->setData(model->index(num,k++), QString::fromStdString(e.processName));
		
		if(e.acc.type == "menu item" || e.acc.type == "tab item" 
			|| e.acc.parent_name == "Desktop" || e.acc.parent_name == "%trimmedwindow.label.eclipseSDK")
		{
			model->setData(model->index(num,k++), QString::fromStdString(e.acc.name));
		}
		else
		{
			model->setData(model->index(num,k++), QString::fromStdString(e.acc.parent_name));
		}
		
		model->setData(model->index(num,k++), QString::fromStdString(e.acc.name));
		model->setData(model->index(num,k++), QString::fromStdString(e.acc.type));
		model->setData(model->index(num,k++), QString::fromStdString(e.acc.value));
		num++;

	}
}
示例#5
0
QAbstractItemModel * radDataWidget :: initComplexModel (const complex<double> * zVec, int n)
{
    if (!zVec || n==0)
        return 0;

    QAbstractItemModel * cModel = new QStandardItemModel (n, 2);
    cModel->setHeaderData (0, Qt::Horizontal, tr("Real component"), Qt::DisplayRole);
    cModel->setHeaderData (1, Qt::Horizontal, tr("Image component"), Qt::DisplayRole);
    for (int i=0; i<n; i++)
    {
        double r = real(zVec[i]);
        double im = imag(zVec[i]);
        QModelIndex cRInd = cModel->index (i, 0);
        cModel->setData (cRInd, QString::number (r, 'f', 16), Qt::DisplayRole);
        QModelIndex cImInd = cModel->index (i, 1);
        cModel->setData (cImInd, QString::number (im, 'f', 16), Qt::DisplayRole);
    }

    return cModel;
}
示例#6
0
bool MainWindow::insertColumn(const QModelIndex &parent)
{
    QAbstractItemModel *model = view->model();
    int column = view->selectionModel()->currentIndex().column();

    // Insert a column in the parent item.
    bool changed = model->insertColumn(column + 1, parent);
    if (changed)
        model->setHeaderData(column + 1, Qt::Horizontal, QVariant("[No header]"), Qt::EditRole);

    updateActions();

    return changed;
}
void LogDetailWidget::funcKeyInput()
{
	QAbstractItemModel *model = new QStandardItemModel(0, 4, this);
	ui.funcKeyView->setModel(model);

	int k = 0;
	model->setHeaderData(k++, Qt::Horizontal, tr("Timestamp"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Keys"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Window Name"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Process Name"));

	for(int i=0 ;i<logMan.keyEvents.size(); i++)
	{
		string keystr = logMan.keysToString(logMan.keyEvents[i]);

		model->insertRow(i);
		k=0;
		model->setData(model->index(i,k++), QString::fromStdString(logMan.keyEvents[i][0].timestamp));
		model->setData(model->index(i,k++), QString::fromStdString(keystr));
		model->setData(model->index(i,k++), QString::fromStdString(logMan.keyEvents[i][0].windowName));
		model->setData(model->index(i,k++), QString::fromStdString(logMan.keyEvents[i][0].processName));
	}
}
void GameObjectTreeWidget::InitFields()
{
	////////////////////////////////////////
	//Game Objects Tree Type
	AEQTUserTemplateData<AEQTObjType>* GameObjectsTreeType = new AEQTUserTemplateData<AEQTObjType>(AEQTObjType::GameObjectsTree);
	this->setUserData(AE_QT_USER_DATA_OBJ_TYPE_SLOT, GameObjectsTreeType);

	///////////////////////////////////////////
	//Set preferred indentation
	this->setIndentation(AE_QT_TREE_INDENTATION);

	///////////////////////////////////////////
	//Set Drag Mode
	this->setDragDropMode(DragDropMode::InternalMove);

	///////////////////////////////////////////
	//Set Animation
	this->setAnimated(true);

	///////////////////////////////////////////
	//Set Alternating Row Colors
	this->setAlternatingRowColors(false);

	///////////////////////////////////////////
	//Set number of columns and their names
	this->setColumnCount(1);

	QAbstractItemModel* itemModel = this->model();

	itemModel->setHeaderData(0, Qt::Orientation::Horizontal, "Game Objects", Qt::ItemDataRole::DisplayRole);

	///////////////////////////////////////////
	//Connect to Signals
	connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(GameObjectSelectionChanged()));

	///////////////////////////////////////////
	//Finish
	m_IsReady = true;
}
示例#9
0
void MetaEditor::insertChild(QString code, QString contents)
{
    QModelIndex index = view->selectionModel()->currentIndex();
    QAbstractItemModel *model = view->model();

    // restrict children to be a grandchild of the root item
    // and make sure you are in column 0 when inserting a child
    if (index.parent() != QModelIndex()) {
        index = index.parent();
    }
    int row = index.row();
    index = index.sibling(row,0);

    if (model->columnCount(index) == 0) {
        if (!model->insertColumn(0, index))
            return;
    }

    if (!model->insertRow(0, index))
        return;

    QModelIndex child = model->index(0, 0, index);
    model->setData(child, QVariant(code), Qt::EditRole);
    for (int column = 1; column < model->columnCount(index); ++column) {
        QModelIndex child = model->index(0, column, index);
        if (!contents.isEmpty()) {
            model->setData(child, QVariant(contents), Qt::EditRole);
        } else {
            model->setData(child, QVariant(tr("[Place value here]")), Qt::EditRole);
        }
        if (!model->headerData(column, Qt::Horizontal).isValid())
            model->setHeaderData(column, Qt::Horizontal, QVariant("[No header]"), Qt::EditRole);
    }

    view->selectionModel()->setCurrentIndex(model->index(0, 0, index),
                                            QItemSelectionModel::ClearAndSelect);
    updateActions();
}
示例#10
0
void
setSymbolicColumnNames(QAbstractItemModel &model,
                       QStringList const &names) {
    for (auto column = 0, numColumns = std::min(model.columnCount(), names.count()); column < numColumns; ++column)
        model.setHeaderData(column, Qt::Horizontal, names[column], Util::SymbolicNameRole);
}
void LogDetailWidget::copyPaste()
{
	QAbstractItemModel *model = new QStandardItemModel(0, 7, this);
	ui.cpView->setModel(model);

	int k = 0;
	model->setHeaderData(k++, Qt::Horizontal, tr("Timestamp"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Copy"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Window Name"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Process Name"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Paste"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Window Name"));
	model->setHeaderData(k++, Qt::Horizontal, tr("Process Name"));

	int i, j;
	i = j = 0;
	int num = 0;
	while(i<logMan.copy_events.size() || j < logMan.paste_events.size())
	{
		string type = "";
		string timestamp = "";
		string copyText = "";
		string cwindow = "";
		string cprocess = "";
		string pasteText = "";
		string pwindow = "";
		string pprocess = "";
		if(i>=logMan.copy_events.size())
		{
			timestamp = logMan.paste_events[j].timestamp;
			pasteText = logMan.paste_events[j].method;
			pwindow = logMan.paste_events[j].windowName;
			pprocess= logMan.paste_events[j].processName;
			j++;
		}
		else if(j>=logMan.paste_events.size())
		{
			timestamp = logMan.copy_events[i].timestamp;
			copyText = logMan.copy_events[i].text;
			cwindow = logMan.copy_events[i].windowName;
			cprocess= logMan.copy_events[i].processName;
			i++;
		}
		else
		{
			string t1 = logMan.copy_events[i].timestamp;
			string t2 = logMan.paste_events[j].timestamp;
			double interval = GetTimeDifference(toSystemTime(t1), toSystemTime(t2));
			if(interval<0)
			{
				timestamp = logMan.paste_events[j].timestamp;
				pasteText = logMan.paste_events[j].method;
				pwindow = logMan.paste_events[j].windowName;
				pprocess= logMan.paste_events[j].processName;
				j++;	
			}
			else
			{
				timestamp = logMan.copy_events[i].timestamp;
				copyText = logMan.copy_events[i].text;
				cwindow = logMan.copy_events[i].windowName;
				cprocess= logMan.copy_events[i].processName;
				i++;
			}
		}
		k=0;
		model->insertRow(num);
		model->setData(model->index(num,k++), QString::fromStdString(timestamp));
		model->setData(model->index(num,k++), QString::fromStdString(copyText));
		model->setData(model->index(num,k++), QString::fromStdString(cwindow));
		model->setData(model->index(num,k++), QString::fromStdString(cprocess));
		model->setData(model->index(num,k++), QString::fromStdString(pasteText));
		model->setData(model->index(num,k++), QString::fromStdString(pwindow));
		model->setData(model->index(num,k++), QString::fromStdString(pprocess));
		num++;
	}
}
示例#12
0
void RadMainWindow :: slotTest1 (void)
{
    if (fileName.isEmpty())
        return;

    QTime * fftTime = new QTime;
    fftTime->start();
    CalcOpor1 * cop = new CalcOpor1 (nd);
    complex<double> * opor = cop->calc();//new complex<double> [nd];
    qDebug () << __PRETTY_FUNCTION__ << N1;
    QFile fContData (QString ("stc4.dat"));
    fContData.open (QIODevice::WriteOnly);
    QTextStream stCont (&fContData);
    FFT_Transform fft;// = new FFT_Transform;
    radDataWidget * wOpFFT = new radDataWidget (opor, N1);
    QMdiSubWindow * subWopFFT = m_mdiArea->addSubWindow (wOpFFT);
    wOpFFT->show ();
    subWopFFT->setAttribute (Qt::WA_DeleteOnClose);
    QFile contOp ("opor_after_FFT.dat");
    contOp.open (QIODevice::WriteOnly);
    QTextStream stOp (&contOp);
    for (int i=0; i<N1; i++)
    {
        double re = real (opor[i])*nd;
        double im = imag (opor[i])*nd;
        stOp << re << " " << im << "i" << endl;
    }
    contOp.close ();

    QFile fData (fileName);
    quint8 * st = new quint8 [nd2];
    for (int i=0; i<nd2; i++)
    {
        st [i] = 0;
    }
    complex<double> * stc = new complex<double>[nd];
    complex<double> * stc1 = new complex<double>[nd];
    for (int i=0; i<nd; i++)
    {
        stc[i] = complex<double> (0.0, 0.0);
        stc1[i] = complex<double> (0.0, 0.0);
    }
    int a = 0;
    Q_UNUSED (a);

    FILE * fid5 = fopen (fileName.toAscii().constData(), "rb");
    qDebug () << __PRETTY_FUNCTION__ << fileName.toAscii().constData() << fid5;
    if (!fData.open (fid5, QIODevice::ReadOnly | QIODevice::Unbuffered))
        return;

    fileConvName = QFileDialog::getSaveFileName (this, tr("Save 1st data"), QDir::currentPath(), tr("All files (*)"));

    FILE * fid6 = fileConvName.isEmpty() ? 0 : fopen (fileConvName.toAscii().constData(), "w+");

    qDebug () << __PRETTY_FUNCTION__ << (int)na;
    QAbstractItemModel * radModel = new QStandardItemModel (nd2, 1, 0);// (nd2, na);

    int nr (0);
    QFile fContStData (QString ("stc.dat"));
    fContStData.open (QIODevice::WriteOnly);
    QTextStream stContSt (&fContStData);
    QSize imSize (nd, na/50);
    QImage * convImage = new QImage (imSize, QImage::Format_RGB32);//QImage::Format_Mono);
    if (!convImage || convImage->size().isNull())
    {
        if (convImage)
            delete convImage;
        return;
    }
    convImage->fill (0);
    double * vals = new double [50*nd];
    double maxval = 0.0;
    for (int i0=0; i0<na; i0++)
    {
        qDebug () << __PRETTY_FUNCTION__ << QString("Read new data");
        int cr = fread (st, sizeof (quint8), nd2, fid5);
        if (cr <= 0)
            return;
        for (int ii=0; ii< nd2; ii++)
        {
            if (i0<1)
            {
                QModelIndex wcIndex = radModel->index (nr, 0);
                radModel->setData (wcIndex, QString::number (st[ii]), Qt::DisplayRole);
                nr++;
            }
        }

        for (int ii=0; ii<128; ii++)
            st[ii] = 0.0;

        for (int ii=0; ii<ndn; ii++)
        {
            double re = st[2*ii+1];
            double im = st[2*ii];
            if (re > 128)
                re -= 256;
            if (im > 128)
                im -= 256;
            if (i0==0)
                stContSt << re << " " << im << endl;
            stc[ii] = complex<double> (re, im);//st[2*ii], st[2*ii+1]);
        }
        complex<double> * stc4 = 0;//new complex<double> [nd];
        qDebug () << __PRETTY_FUNCTION__ << QString ("Forward fft");
        stc4 = fft (stc, nd, nd, FFTW_FORWARD, FFTW_ESTIMATE);
        qDebug () << __PRETTY_FUNCTION__ << i0 << na;
        for (int ii=0; ii<nd; ii++)
        {
            double re = real (stc4[ii])*nd;
            double im = imag (stc4[ii])*nd;
            stc4[ii] = complex<double> (re, im);
            if (i0==0)
                stCont << re << (im >= 0 ? "+" : " ") << im << "i" << endl;
        }
        int n2 = FFT_Transform::pow2roundup(nd);//1024;
        qDebug () << __PRETTY_FUNCTION__ << n2;//QString ("Reverse fft");
        //complex<double> * xConv = new complex<double>[n2];
        for (int ii=0; ii<nd; ii++)
        {
            double rstc4 = real (stc4[ii])/nd;
            double imstc4 = imag (stc4[ii])/nd;
            double ropor = real (opor[ii]);
            double imopor = imag (opor[ii]);
            complex<double> res = complex<double> ((rstc4 * ropor - imstc4*imopor), (rstc4*imopor+imstc4*ropor));
            stc1[ii] = res;//stc4[i]*opor[i];///(nd*nd);
            //qDebug () << __PRETTY_FUNCTION__ << ii << nd;
            //if (i<10)
            //    qDebug () << __PRETTY_FUNCTION__ << real (res) << imag(res) << real (xConv[i]) << imag (xConv[i]);
        }
        delete [] stc4;

        complex<double> * xfft = 0;//new complex<double> [nd];
        qDebug () << __PRETTY_FUNCTION__ << QString ("Reverse fft");
        xfft = fft (stc1, nd, nd, FFTW_BACKWARD, FFTW_ESTIMATE );//| FFTW_MEASURE);
        //delete [] xConv;
        double * stc2 = new double [2*nd];
        double * stc2abs = new double [nd];
        for (int ii=0; ii<nd; ii++)
        {
            int ind = ii;//(ii==0 ? nd-1 : ii-1);
            stc2[2*ii] = real (xfft[ind])/nd;//stc3[i]);
            stc2[2*ii+1] = imag (xfft[ind])/nd;
//            stc2Op << stc2[2*i] << " " << stc2[2*i+1] << endl;
            stc2abs[ii] = sqrt (stc2[2*ii]*stc2[2*ii] + stc2[2*ii+1]*stc2[2*ii+1]);
            if (i0==0)
                maxval = qMax (maxval, stc2abs[ii]);
            double gray (i0==0 ? 0.0 : (stc2abs[ii]/maxval)*20000);
            vals [(i0+1)%50+ii] = gray;
            if ((i0+1)/50*50 == i0+1)
            {
                double gray_ave (0.0);
                for (int iii=0; iii<50; iii++)
                    gray_ave += vals [iii];
                uint val = (uint)(256*(gray_ave/5.0e1));

                QRgb v = qRgb (val, val, val);
                ////qDebug ()  << __PRETTY_FUNCTION__ << v;
                convImage->setPixel (ii, i0/50, v);//qRgb(val, val, val));
            }

            //qDebug () << __PRETTY_FUNCTION__ << ii << (double)stc2abs[ii];

        }
        if (i0==0)
        {
            radDataWidget * wStc2 = new radDataWidget();
            wStc2->setWindowTitle (tr("Stc2 after FFT"));
            QAbstractItemModel * radCModel = new QStandardItemModel (nd, 2, 0);// (nd2, na);
            radCModel->setHeaderData (0, Qt::Horizontal, QString("Real"), Qt::DisplayRole);
            radCModel->setHeaderData (1, Qt::Horizontal, QString("Image"), Qt::DisplayRole);
            radCModel->setHeaderData (2, Qt::Horizontal, QString("Module"), Qt::DisplayRole);
            for (int ii=0; ii<nd; ii++)
            {
                QModelIndex wIndex = radCModel->index (ii, 0);
                radCModel->setData (wIndex, (double)(stc2[2*ii]), Qt::DisplayRole);
                wIndex = radCModel->index (ii, 1);
                radCModel->setData (wIndex, (double)(stc2[2*ii+1]), Qt::DisplayRole);
//                wIndex = radCModel->index (ii, 2);
//                radCModel->setData (wIndex, (double)stc2abs[ii], Qt::DisplayRole);
            }
            wStc2->setModel (radCModel);
            QMdiSubWindow * subWStc2 = m_mdiArea->addSubWindow (wStc2);
            wStc2->show ();
            subWStc2->setAttribute (Qt::WA_DeleteOnClose);
        }
        if (fid6)
        {
            qDebug () << __PRETTY_FUNCTION__ << QString ("Write data");
            size_t h = fwrite (stc2, sizeof (double)/2, 2*nd, fid6);
            int ier = ferror (fid6);
            qDebug () << __PRETTY_FUNCTION__ << QString ("Data were written %1 bytes, error indicator =%2 ").arg (h).arg(ier);
            if (ier)
                qDebug () << __PRETTY_FUNCTION__ << tr ("Write error");
        }
        delete [] xfft;

        delete [] stc2abs;
        delete [] stc2;
    }
    delete [] vals;
    qDebug () << __PRETTY_FUNCTION__ << QString ("Data were read and processed");
    fContData.close();
//    double * stc2abs = new double [nd];
    qDebug () << __PRETTY_FUNCTION__ << convImage->size () << imSize;
/*    QFile fileStc2 ("stc2.dat");
    fileStc2.open (QIODevice::WriteOnly);
    QTextStream stc2Op (&fileStc2);
    for (int i0=0; i0<na; i0++)
    {
        for (int i=0; i<nd; i++)
        {
            int ind = (i==0 ? nd-1 : i-1);
            stc2[2*i] = real (xfft[ind])/nd;//stc3[i]);
            stc2[2*i+1] = imag (xfft[ind])/nd;
            stc2Op << stc2[2*i] << " " << stc2[2*i+1] << endl;
            stc2abs[i] = sqrt (stc2[2*i]*stc2[2*i] + stc2[2*i+1]*stc2[2*i+1]);
            double gray (stc2abs[i]);
            uint val = (uint)(256*gray);

            QRgb v = qRgb (val, val, val);
            Q_UNUSED (v);
            ////qDebug ()  << __PRETTY_FUNCTION__ << v;
            convImage->setPixel (i, i0/5, v);//qRgb(val, val, val));

    ////        qDebug () << __PRETTY_FUNCTION__ << i << (double)stc2abs[i];
        }
        delete [] xfft;

        if (i0==0)
        {
            radDataWidget * wStc2 = new radDataWidget();
            wStc2->setWindowTitle (tr("Stc2 after FFT"));
            QAbstractItemModel * radCModel = new QStandardItemModel (nd, 3, 0);// (nd2, na);
            radCModel->setHeaderData (0, Qt::Horizontal, QString("Real"), Qt::DisplayRole);
            radCModel->setHeaderData (1, Qt::Horizontal, QString("Image"), Qt::DisplayRole);
            radCModel->setHeaderData (2, Qt::Horizontal, QString("Module"), Qt::DisplayRole);
            for (int i=0; i<nd; i++)
            {
                QModelIndex wIndex = radCModel->index (i, 0);
                radCModel->setData (wIndex, (double)(stc2[2*i]), Qt::DisplayRole);
                wIndex = radCModel->index (i, 1);
                radCModel->setData (wIndex, (double)(stc2[2*i+1]), Qt::DisplayRole);
                wIndex = radCModel->index (i, 2);
                radCModel->setData (wIndex, (double)stc2abs[i], Qt::DisplayRole);
            }
            wStc2->setModel (radCModel);
            QMdiSubWindow * subWStc2 = m_mdiArea->addSubWindow (wStc2);
            wStc2->show ();
            subWStc2->setAttribute (Qt::WA_DeleteOnClose);
        }

    //    delete [] stc3;
    ////        qDebug () << __PRETTY_FUNCTION__ << h;
    }
*/
    QString fileImageName = QString ("rgg.png");
    convImage->save (fileImageName, "PNG");

    rggImageWidget * imW = new rggImageWidget;
    imW->setImage (*convImage);
    QMdiSubWindow * subImW = m_mdiArea->addSubWindow (imW);
    imW->show ();
    subImW->setAttribute (Qt::WA_DeleteOnClose);

    int msecs = fftTime->elapsed ();
    FFTTimeWidget * fftWidget = new FFTTimeWidget;
    fftWidget->setTimeElapsed (msecs);
    QMdiSubWindow * subFFTW = m_mdiArea->addSubWindow (fftWidget);
    fftWidget->show();
    subFFTW->setAttribute (Qt::WA_DeleteOnClose);
    delete fftTime;
//    delete [] stc4;
//    delete [] opor;
//    delete [] opor2;
    delete [] stc1;
//    delete [] stc;
    delete [] st;
    delete cop;
    if (fid6)
        fclose (fid6);
    actCalc2->setEnabled (true);
}
// Constructor.
qtractorTimeScaleForm::qtractorTimeScaleForm (
	QWidget *pParent, Qt::WindowFlags wflags )
	: QDialog(pParent, wflags)
{
	// Setup UI struct...
	m_ui.setupUi(this);

	// Window modality (let plugin/tool windows rave around).
	QDialog::setWindowModality(Qt::WindowModal);

	// Initialize locals.
	m_pTimeScale  = NULL;

	m_pTempoTap   = new QTime();
	m_iTempoTap   = 0;
	m_fTempoTap   = 0.0f;

	m_iDirtySetup = 0;
	m_iDirtyCount = 0;
	m_iDirtyTotal = 0;

	QHeaderView *pHeader = m_ui.TimeScaleListView->header();
	pHeader->setDefaultAlignment(Qt::AlignLeft);
#if QT_VERSION >= 0x050000
//	pHeader->setSectionResizeMode(QHeaderView::Custom);
	pHeader->setSectionResizeMode(QHeaderView::ResizeToContents);
	pHeader->setSectionsMovable(false);
#else
//	pHeader->setResizeMode(QHeaderView::Custom);
	pHeader->setResizeMode(QHeaderView::ResizeToContents);
	pHeader->setMovable(false);
#endif
	QAbstractItemModel *pHeaderModel = pHeader->model();
	pHeaderModel->setHeaderData(0, Qt::Horizontal,
		Qt::AlignCenter, Qt::TextAlignmentRole); // Bar
	pHeaderModel->setHeaderData(2, Qt::Horizontal,
		Qt::AlignCenter, Qt::TextAlignmentRole); // tempo

	m_ui.TimeScaleListView->setItemDelegate(
		new qtractorTimeScaleItemDelegate(m_ui.TimeScaleListView));
	m_ui.TimeScaleListView->setContextMenuPolicy(Qt::CustomContextMenu);

	// (Re)initial contents.
	// Default is main session time-scale of course...
	qtractorSession *pSession = qtractorSession::getInstance();
	if (pSession)
		setTimeScale(pSession->timeScale());

	// Try to restore normal window positioning.
	adjustSize();

	// UI signal/slot connections...
	QObject::connect(m_ui.TimeScaleListView,
		SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)),
		SLOT(selectItem()));
	QObject::connect(m_ui.TimeScaleListView,
		SIGNAL(customContextMenuRequested(const QPoint&)),
		SLOT(contextMenu(const QPoint&)));

	QObject::connect(m_ui.BarSpinBox,
		SIGNAL(valueChanged(int)),
		SLOT(barChanged(int)));
	QObject::connect(m_ui.TimeSpinBox,
		SIGNAL(valueChanged(unsigned long)),
		SLOT(timeChanged(unsigned long)));
	QObject::connect(m_ui.TimeSpinBox,
		SIGNAL(displayFormatChanged(int)),
		SLOT(refreshItems()));

	QObject::connect(m_ui.TempoSpinBox,
		SIGNAL(valueChanged(float, unsigned short, unsigned short)),
		SLOT(tempoChanged()));
	QObject::connect(m_ui.TempoSpinBox,
		SIGNAL(valueChanged(const QString&)),
		SLOT(tempoChanged()));
	QObject::connect(m_ui.TempoTapPushButton,
		SIGNAL(clicked()),
		SLOT(tempoTap()));
	QObject::connect(m_ui.TempoFactorPushButton,
		SIGNAL(clicked()),
		SLOT(tempoFactor()));

	QObject::connect(m_ui.MarkerTextLineEdit,
		SIGNAL(textChanged(const QString&)),
		SLOT(changed()));
	QObject::connect(m_ui.MarkerColorToolButton,
		SIGNAL(clicked()),
		SLOT(markerColor()));

	QObject::connect(m_ui.RefreshPushButton,
		SIGNAL(clicked()),
		SLOT(refresh()));
	QObject::connect(m_ui.AddPushButton,
		SIGNAL(clicked()),
		SLOT(addItem()));
	QObject::connect(m_ui.UpdatePushButton,
		SIGNAL(clicked()),
		SLOT(updateItem()));
	QObject::connect(m_ui.RemovePushButton,
		SIGNAL(clicked()),
		SLOT(removeItem()));
	QObject::connect(m_ui.ClosePushButton,
		SIGNAL(clicked()),
		SLOT(reject()));

	stabilizeForm();
}