Skip to content
This repository has been archived by the owner on Apr 2, 2019. It is now read-only.

Commit

Permalink
added about dialog to match udis86 license
Browse files Browse the repository at this point in the history
  • Loading branch information
Ende! committed Nov 23, 2014
1 parent 1801813 commit 82602b3
Show file tree
Hide file tree
Showing 8 changed files with 174 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ set(project_sources
SubstitutionManager.cpp
ImportExport.cpp)
set(project_forms
ui/SubstitutionEditor.ui)
ui/SubstitutionEditor.ui
ui/AboutDialog.ui)
set(project_resources resources/rsrc.qrc)

# Qt
Expand Down
2 changes: 1 addition & 1 deletion Core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ Core::~Core()

void Core::runPlugin()
{

AboutDialog().exec();
}

int32 Core::demanglerHookCallback(char* answer, uint answerLength,
Expand Down
2 changes: 1 addition & 1 deletion REtypedef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ plugin_t PLUGIN =
&run,
"Reverse typedef resolution",
"Reverse typedef resolution plugin.",
PLUGIN_NAME ": Settings",
PLUGIN_NAME ": About",
"Ctrl-Shift-S"
};

Expand Down
26 changes: 24 additions & 2 deletions Ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include <cassert>
#include <QMessageBox>
#include <QFile>
#include <QMenu>
#include <QFileDialog>
#include <QSettings>
Expand Down Expand Up @@ -64,7 +65,7 @@ QVariant SubstitutionModel::data(const QModelIndex &index, int role) const
if (!index.isValid() || role != Qt::DisplayRole)
return QVariant();

assert(index.row() >= m_substMgr->substitutions().size());
assert(static_cast<unsigned>(index.row()) >= m_substMgr->rules().size());
auto sbst = m_substMgr->rules().at(index.row());
return index.column() == 0 ? QString::fromStdString(sbst->regexpPattern)
: QString::fromStdString(sbst->replacement);
Expand Down Expand Up @@ -100,7 +101,7 @@ Qt::ItemFlags SubstitutionModel::flags(const QModelIndex &index) const
const Substitution* SubstitutionModel::substitutionByIndex(const QModelIndex& index)
{
assert(m_substMgr);
assert(m_substMgr->substitutions().size() > index.row());
assert(m_substMgr->rules().size() > static_cast<unsigned>(index.row()));
return m_substMgr->rules().at(index.row()).get();
}

Expand Down Expand Up @@ -272,3 +273,24 @@ void SubstitutionEditor::editSubstitution(bool)
}

// ============================================================================================== //
// [AboutDialog] //
// ============================================================================================== //

AboutDialog::AboutDialog()
{
m_widgets.setupUi(this);

connect(m_widgets.lblUdis,
SIGNAL(linkActivated(const QString&)),
SLOT(displayUdisLicense(const QString&)));
}

void AboutDialog::displayUdisLicense(const QString& /*link*/)
{
QFile licenseFile(":/Misc/udis_license.txt");
licenseFile.open(QFile::ReadOnly);
QMessageBox::information(qApp->activeWindow(), "udis86 license",
QString::fromAscii(licenseFile.readAll()));
}

// ============================================================================================== //
17 changes: 17 additions & 0 deletions Ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#define UI_HPP

#include "ui_SubstitutionEditor.h"
#include "ui_AboutDialog.h"
#include "SubstitutionManager.hpp"

#include <QDialog>
Expand Down Expand Up @@ -82,6 +83,22 @@ protected slots:
void exportRules(bool);
};

// ============================================================================================== //
// [AboutDialog] //
// ============================================================================================== //

class AboutDialog : public QDialog
{
Q_OBJECT

Ui::AboutDialog m_widgets;
public:
AboutDialog();
virtual ~AboutDialog() {}
private slots:
void displayUdisLicense(const QString& /*link*/);
};

// ============================================================================================== //

#endif // UI_HPP
1 change: 1 addition & 0 deletions resources/rsrc.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<file>edit.png</file>
</qresource>
<qresource prefix="Misc">
<file>udis_license.txt</file>
<file>default_rules.ini</file>
</qresource>
</RCC>
22 changes: 22 additions & 0 deletions resources/udis_license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2002-2012, Vivek Thampi <[email protected]>
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
106 changes: 106 additions & 0 deletions ui/AboutDialog.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QWidget" name="AboutDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>303</width>
<height>127</height>
</rect>
</property>
<property name="windowTitle">
<string>About</string>
</property>
<property name="locale">
<locale language="English" country="UnitedStates"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="lblProductName">
<property name="font">
<font>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>REtypedef</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblAuthor">
<property name="text">
<string>by athre0z</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblWeb">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:8pt;&quot;&gt;Github: &lt;/span&gt;&lt;a href=&quot;https://github.com/athre0z/REtypedef&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;https://github.com/athre0z/REtypedef&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblCopyrightHeadline">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Copyright notes of third party code:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblUdis">
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;a href=&quot;#&quot;&gt;&lt;span style=&quot; font-size:8pt; text-decoration: underline; color:#0000ff;&quot;&gt;udis86 - Disassembler libraray&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../resources/rsrc.qrc"/>
</resources>
<connections/>
</ui>

0 comments on commit 82602b3

Please sign in to comment.