cppcheck-verify: added 'open' menu

This commit is contained in:
Daniel Marjamäki 2010-09-14 19:57:37 +02:00
parent 42d0ad8262
commit 2387ed49f3
3 changed files with 33 additions and 6 deletions

View File

@ -28,6 +28,8 @@
#include <string>
#include <set>
#include <QFileDialog>
static void arrayIndex(const Tokenizer &tokenizer, std::set<unsigned int> &errorlines);
static unsigned char readChar(std::istream &istr)
@ -49,8 +51,22 @@ MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(open()));
}
const std::string fileName("../lib/tokenize.cpp");
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::open()
{
const std::string fileName = QFileDialog::getOpenFileName(this,
tr("Open File"),
"",
"cpp files (*.cpp)").toStdString();
if (fileName.empty())
return;
setWindowTitle(fileName.c_str());
@ -99,11 +115,7 @@ MainWindow::MainWindow(QWidget *parent)
}
ui->plainTextEdit->setPlainText(QString::fromStdString(report.str()));
}
}
MainWindow::~MainWindow()
{
delete ui;
}

View File

@ -23,7 +23,7 @@
namespace Ui
{
class MainWindow;
class MainWindow;
}
class MainWindow : public QMainWindow
@ -34,6 +34,9 @@ public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void open();
private:
Ui::MainWindow *ui;
};

View File

@ -33,6 +33,13 @@
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
<property name="title">
<string>File</string>
</property>
<addaction name="actionOpen"/>
</widget>
<addaction name="menuFile"/>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
@ -43,6 +50,11 @@
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
<action name="actionOpen">
<property name="text">
<string>Open..</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>