}
+AbstractTreeItem *TreeModel::root() const
+{
+ return rootItem;
+}
+
+
QModelIndex TreeModel::index(int row, int column, const QModelIndex &parent) const
{
if (row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent))
TreeModel(const QList<QVariant> &, QObject *parent = 0);
virtual ~TreeModel();
+ AbstractTreeItem *root() const;
+
virtual QVariant data(const QModelIndex &index, int role) const;
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
qtuisettings.cpp
qtuistyle.cpp
receivefiledlg.cpp
+ resourcetreedlg.cpp
settingsdlg.cpp
settingspagedlg.cpp
simplenetworkeditor.cpp
nicklistwidget.ui
passwordchangedlg.ui
receivefiledlg.ui
+ resourcetreedlg.ui
settingsdlg.ui
settingspagedlg.ui
simplenetworkeditor.ui
#include "qtuisettings.h"
#include "qtuistyle.h"
#include "receivefiledlg.h"
+#include "resourcetreedlg.h"
#include "settingsdlg.h"
#include "settingspagedlg.h"
#include "statusnotifieritem.h"
this, SLOT(on_actionDebugHotList_triggered())));
coll->addAction("DebugLog", new Action(icon::get("tools-report-bug"), tr("Debug &Log"), coll,
this, SLOT(on_actionDebugLog_triggered())));
+ coll->addAction("ShowResourceTree", new Action(icon::get("tools-report-bug"), tr("Show &Resource Tree"), coll,
+ this, SLOT(on_actionShowResourceTree_triggered())));
coll->addAction("ReloadStyle", new Action(icon::get("view-refresh"), tr("Reload Stylesheet"), coll,
QtUi::style(), SLOT(reload()), QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_R)));
_helpDebugMenu->addAction(coll->action("DebugMessageModel"));
_helpDebugMenu->addAction(coll->action("DebugHotList"));
_helpDebugMenu->addAction(coll->action("DebugLog"));
+ _helpDebugMenu->addAction(coll->action("ShowResourceTree"));
_helpDebugMenu->addSeparator();
_helpDebugMenu->addAction(coll->action("ReloadStyle"));
void MainWin::on_actionDebugLog_triggered()
{
- auto dlg = new DebugLogDlg(this);
+ auto dlg = new DebugLogDlg(this); // will be deleted on close
dlg->show();
}
+void MainWin::on_actionShowResourceTree_triggered()
+{
+ auto dlg = new ResourceTreeDlg(this); // will be deleted on close
+ dlg->show();
+}
void MainWin::showStatusBarMessage(const QString &message)
{
void on_actionDebugMessageModel_triggered();
void on_actionDebugHotList_triggered();
void on_actionDebugLog_triggered();
+ void on_actionShowResourceTree_triggered();
void bindJumpKey();
void onJumpKey();
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2018 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#include "resourcetreedlg.h"
+
+#include <QDir>
+#include <QList>
+
+#include "treemodel.h"
+
+namespace {
+
+void addEntries(const QString &dir, AbstractTreeItem *parentItem) {
+
+ auto entries = QDir{dir}.entryInfoList(QDir::AllEntries|QDir::NoDotAndDotDot, QDir::Name|QDir::DirsFirst);
+ QList<AbstractTreeItem *> itemList;
+ for (auto &&entry : entries) {
+ auto item = new SimpleTreeItem({entry.fileName(), entry.size()}, parentItem);
+ itemList << item;
+ if (entry.isDir()) {
+ addEntries(entry.absoluteFilePath(), item);
+ }
+ }
+ parentItem->newChilds(itemList);
+}
+
+}
+
+ResourceTreeDlg::ResourceTreeDlg(QWidget *parent)
+ : QDialog(parent)
+{
+ ui.setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose, true);
+
+ // We can't use QFileSystemModel, because it doesn't support the virtual resource file system :(
+ auto model = new TreeModel({tr("File"), tr("Size")}, this);
+ addEntries(":/", model->root());
+ ui.treeView->setModel(model);
+ ui.treeView->resizeColumnToContents(0);
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2018 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
+ ***************************************************************************/
+
+#pragma once
+
+#include <QDialog>
+
+#include "ui_resourcetreedlg.h"
+
+class ResourceTreeDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ ResourceTreeDlg(QWidget *parent = nullptr);
+
+private:
+ Ui::ResourceTreeDlg ui;
+};
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ResourceTreeDlg</class>
+ <widget class="QDialog" name="ResourceTreeDlg">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>474</width>
+ <height>399</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Resource Tree</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QTreeView" name="treeView">
+ <property name="toolTip">
+ <string>Shows the contents of the compiled-in resource tree.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons">
+ <set>QDialogButtonBox::Close</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>ResourceTreeDlg</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>ResourceTreeDlg</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel">
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel">
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>