#include "qmessagebox.h"
#include "qfiledialog.h"
#include <QtGui>
+#include <qfile.h>
#include "mdichild.h"
+#include "string.h"
+#define WIDGET(t,f) ((t*)findChild<t *>(#f))
+bool loadAttrs(const QString fileName,QComboBox* cbNameG,QComboBox* cbNameN,QComboBox* cbNameE)
+{
+ QStringList lines;
+ QFile file(fileName);
+ if ( file.open(QIODevice::ReadOnly ) ) {
+ QTextStream stream( &file );
+ QString line;
+ int i = 1;
+ while ( !stream.atEnd() ) {
+ line = stream.readLine(); // line of text excluding '\n'
+ if(line.left(1)==":")
+ {
+ QString attrName;
+ QStringList sl= line.split(":");
+ for (int id=0;id < sl.count(); id ++)
+ {
+ if(id==1)
+ attrName=sl[id];
+ if(id==2)
+ {
+ if(sl[id].contains("G"))
+ cbNameG->addItem(attrName);
+ if(sl[id].contains("N"))
+ cbNameN->addItem(attrName);
+ if(sl[id].contains("E"))
+ cbNameE->addItem(attrName);
+ }
+ printf ("%s\n",sl[id].constData());
+ };
+ }
+ }
+ file.close();
+ }
+ return false;
+
+
+
+
+}
QString stripFileExtension(QString fileName)
{
int idx;
connect(WIDGET(QPushButton,pbSave),SIGNAL(clicked()),this,SLOT(saveSlot()));
connect(WIDGET(QPushButton,btnOK),SIGNAL(clicked()),this,SLOT(okSlot()));
connect(WIDGET(QPushButton,pbOut),SIGNAL(clicked()),this,SLOT(outputSlot()));
+ connect(WIDGET(QComboBox,cbScope),SIGNAL(currentIndexChanged(int)),this,SLOT(scopeChangedSlot(int)));
+
+
+ loadAttrs("c:/graphviz-ms/bin/attrs.txt",WIDGET(QComboBox,cbNameG),WIDGET(QComboBox,cbNameN),WIDGET(QComboBox,cbNameE));
}
void CFrmSettings::outputSlot()
if (!fileName.isEmpty())
WIDGET(QLineEdit,leOutput)->setText(fileName);
}
+void CFrmSettings::scopeChangedSlot(int id)
+{
+ WIDGET(QComboBox,cbNameG)->setVisible(id==0);
+ WIDGET(QComboBox,cbNameN)->setVisible(id==1);
+ WIDGET(QComboBox,cbNameE)->setVisible(id==2);
+}
void CFrmSettings::addSlot()
{
QString _scope=WIDGET (QComboBox,cbScope)->currentText();
- QString _name=WIDGET (QComboBox,cbName)->currentText();
+ QString _name;
+ switch (WIDGET (QComboBox,cbScope)->currentIndex())
+ {
+ case 0:
+ _name=WIDGET (QComboBox,cbNameG)->currentText();
+ break;
+ case 1:
+ _name=WIDGET (QComboBox,cbNameN)->currentText();
+ break;
+ case 2:
+ _name=WIDGET (QComboBox,cbNameE)->currentText();
+ break;
+ }
QString _value=WIDGET(QLineEdit,leValue)->text();
if (_value.trimmed().length() == 0)
WIDGET(QLineEdit,leOutput)->setText(stripFileExtension(activeWindow->currentFile())+ "."+WIDGET(QComboBox,cbExtension)->currentText());
WIDGET(QTextEdit,teAttributes)->setText(activeWindow->attributes);
- WIDGET(QCheckBox,chbPreview)->setChecked(activeWindow->preview);
- WIDGET(QCheckBox,chbCairo)->setChecked(activeWindow->applyCairo);
WIDGET(QLineEdit,leValue)->setText("");
{
activeWindow->layoutIdx=WIDGET(QComboBox,cbLayout)->currentIndex();
activeWindow->renderIdx=WIDGET(QComboBox,cbExtension)->currentIndex();
-
activeWindow->outputFile=WIDGET(QLineEdit,leOutput)->text();
activeWindow->attributes=WIDGET(QTextEdit,teAttributes)->toPlainText();
- activeWindow->preview= WIDGET(QCheckBox,chbPreview)->isChecked();
- activeWindow->applyCairo= WIDGET(QCheckBox,chbCairo)->isChecked();
}
int CFrmSettings::drawGraph()
{
/********************************************************************************
** Form generated from reading UI file 'settings.ui'
**
-** Created: Thu Feb 24 12:31:24 2011
+** Created: Fri Feb 25 14:25:48 2011
** by: Qt User Interface Compiler version 4.7.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
-#include <QtGui/QCheckBox>
#include <QtGui/QComboBox>
#include <QtGui/QDialog>
#include <QtGui/QFrame>
QLabel *label_2;
QLineEdit *leOutput;
QPushButton *pbOut;
- QHBoxLayout *horizontalLayout_4;
- QHBoxLayout *horizontalLayout_11;
- QSpacerItem *horizontalSpacer_4;
- QCheckBox *chbPreview;
- QSpacerItem *horizontalSpacer_6;
- QCheckBox *chbCairo;
- QSpacerItem *horizontalSpacer_5;
QFrame *frame_2;
- QWidget *layoutWidget1;
+ QWidget *widget;
QHBoxLayout *horizontalLayout_7;
QVBoxLayout *verticalLayout_2;
QHBoxLayout *horizontalLayout_5;
QLabel *label_5;
QComboBox *cbScope;
QLabel *label_6;
- QComboBox *cbName;
+ QComboBox *cbNameG;
+ QComboBox *cbNameN;
+ QComboBox *cbNameE;
QHBoxLayout *horizontalLayout_6;
QLabel *label_7;
QLineEdit *leValue;
QSpacerItem *verticalSpacer;
QPushButton *pushButton_4;
QFrame *frame_3;
- QWidget *layoutWidget2;
+ QWidget *layoutWidget1;
QVBoxLayout *verticalLayout_4;
QTextEdit *teAttributes;
QHBoxLayout *horizontalLayout_10;
{
if (Dialog->objectName().isEmpty())
Dialog->setObjectName(QString::fromUtf8("Dialog"));
- Dialog->resize(405, 512);
+ Dialog->resize(403, 512);
actionCSettingsOK = new QAction(Dialog);
actionCSettingsOK->setObjectName(QString::fromUtf8("actionCSettingsOK"));
frame = new QFrame(Dialog);
frame->setObjectName(QString::fromUtf8("frame"));
- frame->setGeometry(QRect(0, 0, 401, 181));
+ frame->setGeometry(QRect(0, 0, 401, 151));
frame->setFrameShape(QFrame::StyledPanel);
frame->setFrameShadow(QFrame::Sunken);
frame->setLineWidth(2);
layoutWidget = new QWidget(frame);
layoutWidget->setObjectName(QString::fromUtf8("layoutWidget"));
- layoutWidget->setGeometry(QRect(10, 10, 381, 161));
+ layoutWidget->setGeometry(QRect(10, 10, 381, 131));
verticalLayout_5 = new QVBoxLayout(layoutWidget);
verticalLayout_5->setObjectName(QString::fromUtf8("verticalLayout_5"));
verticalLayout_5->setContentsMargins(0, 0, 0, 0);
verticalLayout->addLayout(horizontalLayout_2);
- horizontalLayout_4 = new QHBoxLayout();
- horizontalLayout_4->setObjectName(QString::fromUtf8("horizontalLayout_4"));
-
- verticalLayout->addLayout(horizontalLayout_4);
-
verticalLayout_5->addLayout(verticalLayout);
- horizontalLayout_11 = new QHBoxLayout();
- horizontalLayout_11->setObjectName(QString::fromUtf8("horizontalLayout_11"));
- horizontalSpacer_4 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
- horizontalLayout_11->addItem(horizontalSpacer_4);
-
- chbPreview = new QCheckBox(layoutWidget);
- chbPreview->setObjectName(QString::fromUtf8("chbPreview"));
-
- horizontalLayout_11->addWidget(chbPreview);
-
- horizontalSpacer_6 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
- horizontalLayout_11->addItem(horizontalSpacer_6);
-
- chbCairo = new QCheckBox(layoutWidget);
- chbCairo->setObjectName(QString::fromUtf8("chbCairo"));
-
- horizontalLayout_11->addWidget(chbCairo);
-
- horizontalSpacer_5 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
- horizontalLayout_11->addItem(horizontalSpacer_5);
-
-
- verticalLayout_5->addLayout(horizontalLayout_11);
-
frame_2 = new QFrame(Dialog);
frame_2->setObjectName(QString::fromUtf8("frame_2"));
- frame_2->setGeometry(QRect(0, 180, 401, 71));
+ frame_2->setGeometry(QRect(0, 150, 401, 61));
frame_2->setFrameShape(QFrame::StyledPanel);
frame_2->setFrameShadow(QFrame::Raised);
- layoutWidget1 = new QWidget(frame_2);
- layoutWidget1->setObjectName(QString::fromUtf8("layoutWidget1"));
- layoutWidget1->setGeometry(QRect(10, 0, 381, 62));
- horizontalLayout_7 = new QHBoxLayout(layoutWidget1);
+ widget = new QWidget(frame_2);
+ widget->setObjectName(QString::fromUtf8("widget"));
+ widget->setGeometry(QRect(2, 0, 391, 61));
+ horizontalLayout_7 = new QHBoxLayout(widget);
horizontalLayout_7->setObjectName(QString::fromUtf8("horizontalLayout_7"));
horizontalLayout_7->setContentsMargins(0, 0, 0, 0);
verticalLayout_2 = new QVBoxLayout();
verticalLayout_2->setObjectName(QString::fromUtf8("verticalLayout_2"));
horizontalLayout_5 = new QHBoxLayout();
horizontalLayout_5->setObjectName(QString::fromUtf8("horizontalLayout_5"));
- label_5 = new QLabel(layoutWidget1);
+ label_5 = new QLabel(widget);
label_5->setObjectName(QString::fromUtf8("label_5"));
horizontalLayout_5->addWidget(label_5);
- cbScope = new QComboBox(layoutWidget1);
+ cbScope = new QComboBox(widget);
cbScope->setObjectName(QString::fromUtf8("cbScope"));
horizontalLayout_5->addWidget(cbScope);
- label_6 = new QLabel(layoutWidget1);
+ label_6 = new QLabel(widget);
label_6->setObjectName(QString::fromUtf8("label_6"));
horizontalLayout_5->addWidget(label_6);
- cbName = new QComboBox(layoutWidget1);
- cbName->setObjectName(QString::fromUtf8("cbName"));
+ cbNameG = new QComboBox(widget);
+ cbNameG->setObjectName(QString::fromUtf8("cbNameG"));
+
+ horizontalLayout_5->addWidget(cbNameG);
- horizontalLayout_5->addWidget(cbName);
+ cbNameN = new QComboBox(widget);
+ cbNameN->setObjectName(QString::fromUtf8("cbNameN"));
+
+ horizontalLayout_5->addWidget(cbNameN);
+
+ cbNameE = new QComboBox(widget);
+ cbNameE->setObjectName(QString::fromUtf8("cbNameE"));
+
+ horizontalLayout_5->addWidget(cbNameE);
- horizontalLayout_5->setStretch(0, 1);
- horizontalLayout_5->setStretch(1, 2);
- horizontalLayout_5->setStretch(2, 1);
- horizontalLayout_5->setStretch(3, 2);
verticalLayout_2->addLayout(horizontalLayout_5);
horizontalLayout_6 = new QHBoxLayout();
horizontalLayout_6->setObjectName(QString::fromUtf8("horizontalLayout_6"));
- label_7 = new QLabel(layoutWidget1);
+ label_7 = new QLabel(widget);
label_7->setObjectName(QString::fromUtf8("label_7"));
label_7->setMinimumSize(QSize(40, 0));
label_7->setMaximumSize(QSize(47, 16777215));
horizontalLayout_6->addWidget(label_7);
- leValue = new QLineEdit(layoutWidget1);
+ leValue = new QLineEdit(widget);
leValue->setObjectName(QString::fromUtf8("leValue"));
horizontalLayout_6->addWidget(leValue);
verticalLayout_3 = new QVBoxLayout();
verticalLayout_3->setObjectName(QString::fromUtf8("verticalLayout_3"));
- pbAdd = new QPushButton(layoutWidget1);
+ pbAdd = new QPushButton(widget);
pbAdd->setObjectName(QString::fromUtf8("pbAdd"));
pbAdd->setMinimumSize(QSize(75, 0));
verticalLayout_3->addItem(verticalSpacer);
- pushButton_4 = new QPushButton(layoutWidget1);
+ pushButton_4 = new QPushButton(widget);
pushButton_4->setObjectName(QString::fromUtf8("pushButton_4"));
pushButton_4->setMinimumSize(QSize(75, 0));
frame_3 = new QFrame(Dialog);
frame_3->setObjectName(QString::fromUtf8("frame_3"));
- frame_3->setGeometry(QRect(0, 250, 401, 261));
+ frame_3->setGeometry(QRect(0, 210, 401, 301));
frame_3->setFrameShape(QFrame::StyledPanel);
frame_3->setFrameShadow(QFrame::Raised);
- layoutWidget2 = new QWidget(frame_3);
- layoutWidget2->setObjectName(QString::fromUtf8("layoutWidget2"));
- layoutWidget2->setGeometry(QRect(7, 6, 391, 251));
- verticalLayout_4 = new QVBoxLayout(layoutWidget2);
+ layoutWidget1 = new QWidget(frame_3);
+ layoutWidget1->setObjectName(QString::fromUtf8("layoutWidget1"));
+ layoutWidget1->setGeometry(QRect(7, 6, 391, 291));
+ verticalLayout_4 = new QVBoxLayout(layoutWidget1);
verticalLayout_4->setObjectName(QString::fromUtf8("verticalLayout_4"));
verticalLayout_4->setContentsMargins(0, 0, 0, 0);
- teAttributes = new QTextEdit(layoutWidget2);
+ teAttributes = new QTextEdit(layoutWidget1);
teAttributes->setObjectName(QString::fromUtf8("teAttributes"));
verticalLayout_4->addWidget(teAttributes);
horizontalLayout_10->setObjectName(QString::fromUtf8("horizontalLayout_10"));
horizontalLayout_8 = new QHBoxLayout();
horizontalLayout_8->setObjectName(QString::fromUtf8("horizontalLayout_8"));
- pbNew = new QPushButton(layoutWidget2);
+ pbNew = new QPushButton(layoutWidget1);
pbNew->setObjectName(QString::fromUtf8("pbNew"));
pbNew->setMinimumSize(QSize(40, 0));
pbNew->setMaximumSize(QSize(40, 16777215));
horizontalLayout_8->addWidget(pbNew);
- pbOpen = new QPushButton(layoutWidget2);
+ pbOpen = new QPushButton(layoutWidget1);
pbOpen->setObjectName(QString::fromUtf8("pbOpen"));
pbOpen->setMinimumSize(QSize(40, 0));
pbOpen->setMaximumSize(QSize(40, 16777215));
horizontalLayout_8->addWidget(pbOpen);
- pbSave = new QPushButton(layoutWidget2);
+ pbSave = new QPushButton(layoutWidget1);
pbSave->setObjectName(QString::fromUtf8("pbSave"));
pbSave->setMinimumSize(QSize(40, 0));
pbSave->setMaximumSize(QSize(40, 16777215));
horizontalLayout_9 = new QHBoxLayout();
horizontalLayout_9->setObjectName(QString::fromUtf8("horizontalLayout_9"));
- pbCancel = new QPushButton(layoutWidget2);
+ pbCancel = new QPushButton(layoutWidget1);
pbCancel->setObjectName(QString::fromUtf8("pbCancel"));
horizontalLayout_9->addWidget(pbCancel);
- btnOK = new QPushButton(layoutWidget2);
+ btnOK = new QPushButton(layoutWidget1);
btnOK->setObjectName(QString::fromUtf8("btnOK"));
horizontalLayout_9->addWidget(btnOK);
);
label_2->setText(QApplication::translate("Dialog", "Output File Name", 0, QApplication::UnicodeUTF8));
pbOut->setText(QApplication::translate("Dialog", "...", 0, QApplication::UnicodeUTF8));
- chbPreview->setText(QApplication::translate("Dialog", "Preview Output File", 0, QApplication::UnicodeUTF8));
- chbCairo->setText(QApplication::translate("Dialog", "Apply Cairo Filters", 0, QApplication::UnicodeUTF8));
label_5->setText(QApplication::translate("Dialog", "Scope", 0, QApplication::UnicodeUTF8));
cbScope->clear();
cbScope->insertItems(0, QStringList()
<< QApplication::translate("Dialog", "edge", 0, QApplication::UnicodeUTF8)
);
label_6->setText(QApplication::translate("Dialog", "Name", 0, QApplication::UnicodeUTF8));
- cbName->clear();
- cbName->insertItems(0, QStringList()
- << QApplication::translate("Dialog", "color", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("Dialog", "Font", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("Dialog", "fontname", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("Dialog", "fontcolor", 0, QApplication::UnicodeUTF8)
- << QApplication::translate("Dialog", "bgcolor", 0, QApplication::UnicodeUTF8)
- );
label_7->setText(QApplication::translate("Dialog", "Value", 0, QApplication::UnicodeUTF8));
pbAdd->setText(QApplication::translate("Dialog", "Add", 0, QApplication::UnicodeUTF8));
pushButton_4->setText(QApplication::translate("Dialog", "Help", 0, QApplication::UnicodeUTF8));