|
Jeremy Bullock |
0ff1b6 |
#include "commandbarpopup.h"
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
// Tnz includes
|
|
Jeremy Bullock |
0ff1b6 |
#include "tapp.h"
|
|
Jeremy Bullock |
0ff1b6 |
#include "menubar.h"
|
|
Jeremy Bullock |
0ff1b6 |
#include "shortcutpopup.h"
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
// TnzQt includes
|
|
Jeremy Bullock |
0ff1b6 |
#include "toonzqt/gutil.h"
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
// TnzLib includes
|
|
Jeremy Bullock |
0ff1b6 |
#include "toonz/toonzfolders.h"
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
// TnzCore includes
|
|
Jeremy Bullock |
0ff1b6 |
#include "tsystem.h"
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
// Qt includes
|
|
Jeremy Bullock |
0ff1b6 |
#include <qmainwindow></qmainwindow>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qpushbutton></qpushbutton>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qvboxlayout></qvboxlayout>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qhboxlayout></qhboxlayout>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qgridlayout></qgridlayout>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qheaderview></qheaderview>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qtdebug></qtdebug>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qxmlstreamreader></qxmlstreamreader>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qxmlstreamwriter></qxmlstreamwriter>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qdatastream></qdatastream>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qmimedata></qmimedata>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qdrag></qdrag>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qmouseevent></qmouseevent>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qpainter></qpainter>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qapplication></qapplication>
|
|
Jeremy Bullock |
0ff1b6 |
#include <qlabel></qlabel>
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//=============================================================================
|
|
shun-iwasawa |
563e65 |
// CommandItem
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
shun-iwasawa |
563e65 |
CommandItem::CommandItem(QTreeWidgetItem* parent, QAction* action)
|
|
shun-iwasawa |
563e65 |
: QTreeWidgetItem(parent, UserType), m_action(action) {
|
|
shun-iwasawa |
563e65 |
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled |
|
|
shun-iwasawa |
563e65 |
Qt::ItemNeverHasChildren);
|
|
shun-iwasawa |
563e65 |
QString tempText = m_action->text();
|
|
shun-iwasawa |
563e65 |
// removing accelerator key indicator
|
|
shun-iwasawa |
563e65 |
tempText = tempText.replace(QRegExp("&([^& ])"), "\\1");
|
|
shun-iwasawa |
563e65 |
// removing doubled &s
|
|
shun-iwasawa |
563e65 |
tempText = tempText.replace("&&", "&");
|
|
shun-iwasawa |
563e65 |
setText(0, tempText);
|
|
shun-iwasawa |
563e65 |
setToolTip(0, QObject::tr("[Drag] to move position"));
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
//=============================================================================
|
|
shun-iwasawa |
563e65 |
// SeparatorItem
|
|
shun-iwasawa |
563e65 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
SeparatorItem::SeparatorItem(QTreeWidgetItem* parent)
|
|
shun-iwasawa |
563e65 |
: QTreeWidgetItem(parent, UserType) {
|
|
shun-iwasawa |
563e65 |
setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled |
|
|
shun-iwasawa |
563e65 |
Qt::ItemNeverHasChildren);
|
|
shun-iwasawa |
563e65 |
setText(0, QObject::tr("----Separator----"));
|
|
shun-iwasawa |
563e65 |
setToolTip(0, QObject::tr("[Drag] to move position"));
|
|
shun-iwasawa |
563e65 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//=============================================================================
|
|
shun-iwasawa |
563e65 |
// CommandListTree
|
|
shun-iwasawa |
563e65 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
CommandListTree::CommandListTree(const QString& dropTargetString,
|
|
shun-iwasawa |
563e65 |
QWidget* parent, bool withSeparator)
|
|
shun-iwasawa |
563e65 |
: m_dropTargetString(dropTargetString), QTreeWidget(parent) {
|
|
shun-iwasawa |
563e65 |
setObjectName("SolidLineFrame");
|
|
shun-iwasawa |
563e65 |
setAlternatingRowColors(true);
|
|
shun-iwasawa |
563e65 |
setDragEnabled(true);
|
|
shun-iwasawa |
563e65 |
setDragDropMode(QAbstractItemView::DragOnly);
|
|
shun-iwasawa |
563e65 |
setColumnCount(1);
|
|
shun-iwasawa |
563e65 |
setIconSize(QSize(21, 18));
|
|
shun-iwasawa |
563e65 |
header()->close();
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QIcon menuFolderIcon(createQIcon("folder_project", true));
|
|
shun-iwasawa |
563e65 |
invisibleRootItem()->setIcon(0, menuFolderIcon);
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* menuCommandFolder = new QTreeWidgetItem(this);
|
|
shun-iwasawa |
563e65 |
menuCommandFolder->setFlags(Qt::ItemIsEnabled);
|
|
shun-iwasawa |
563e65 |
menuCommandFolder->setText(
|
|
shun-iwasawa |
563e65 |
0, "1"); // set tentative name for "Menu Commands" folder
|
|
shun-iwasawa |
563e65 |
menuCommandFolder->setExpanded(true);
|
|
shun-iwasawa |
563e65 |
menuCommandFolder->setIcon(0, invisibleRootItem()->icon(0));
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("File"), MenuFileCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Edit"), MenuEditCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Scan & Cleanup"), MenuScanCleanupCommandType,
|
|
shun-iwasawa |
563e65 |
menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Level"), MenuLevelCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Xsheet"), MenuXsheetCommandType,
|
|
shun-iwasawa |
563e65 |
menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Cells"), MenuCellsCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Play"), MenuPlayCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Render"), MenuRenderCommandType,
|
|
shun-iwasawa |
563e65 |
menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("View"), MenuViewCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Windows"), MenuWindowsCommandType,
|
|
shun-iwasawa |
563e65 |
menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Help"), MenuHelpCommandType, menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("SubMenu Commands"), MenuCommandType,
|
|
shun-iwasawa |
563e65 |
menuCommandFolder);
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
// set tentative name for "Tools" folder
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* toolsFolder = addFolder("2", ToolCommandType);
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* advancedFolder = new QTreeWidgetItem(this);
|
|
shun-iwasawa |
563e65 |
advancedFolder->setFlags(Qt::ItemIsEnabled);
|
|
shun-iwasawa |
563e65 |
advancedFolder->setText(0, "3"); // set tentative name for "Advanced" folder
|
|
shun-iwasawa |
563e65 |
advancedFolder->setIcon(0, invisibleRootItem()->icon(0));
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Fill"), FillCommandType, advancedFolder);
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* rcmSubFolder =
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Right-click Menu Commands"),
|
|
shun-iwasawa |
563e65 |
RightClickMenuCommandType, advancedFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Cell Mark"), CellMarkCommandType, rcmSubFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Tool Modifiers"), ToolModifierCommandType,
|
|
shun-iwasawa |
563e65 |
advancedFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Visualization"), VisualizationButtonCommandType,
|
|
shun-iwasawa |
563e65 |
advancedFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("Misc"), MiscCommandType, advancedFolder);
|
|
shun-iwasawa |
563e65 |
addFolder(ShortcutTree::tr("RGBA Channels"), RGBACommandType, advancedFolder);
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
sortItems(0, Qt::AscendingOrder);
|
|
shun-iwasawa |
563e65 |
// set the actual names after sorting items
|
|
shun-iwasawa |
563e65 |
menuCommandFolder->setText(0, ShortcutTree::tr("Menu Commands"));
|
|
shun-iwasawa |
563e65 |
toolsFolder->setText(0, ShortcutTree::tr("Tools"));
|
|
shun-iwasawa |
563e65 |
advancedFolder->setText(0, ShortcutTree::tr("Advanced"));
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
if (withSeparator) {
|
|
shun-iwasawa |
563e65 |
SeparatorItem* sep = new SeparatorItem(0);
|
|
shun-iwasawa |
563e65 |
sep->setToolTip(0, QObject::tr("[Drag&Drop] to copy separator to %1")
|
|
shun-iwasawa |
563e65 |
.arg(m_dropTargetString));
|
|
shun-iwasawa |
563e65 |
addTopLevelItem(sep);
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* CommandListTree::addFolder(const QString& title,
|
|
shun-iwasawa |
563e65 |
int commandType,
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* parentFolder) {
|
|
shun-iwasawa |
563e65 |
QTreeWidgetItem* folder;
|
|
shun-iwasawa |
563e65 |
if (!parentFolder)
|
|
shun-iwasawa |
563e65 |
folder = new QTreeWidgetItem(this);
|
|
shun-iwasawa |
563e65 |
else
|
|
shun-iwasawa |
563e65 |
folder = new QTreeWidgetItem(parentFolder);
|
|
shun-iwasawa |
563e65 |
assert(folder);
|
|
shun-iwasawa |
563e65 |
folder->setText(0, title);
|
|
shun-iwasawa |
563e65 |
folder->setIcon(0, invisibleRootItem()->icon(0));
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
std::vector<qaction*> actions;</qaction*>
|
|
shun-iwasawa |
563e65 |
CommandManager::instance()->getActions((CommandType)commandType, actions);
|
|
shun-iwasawa |
563e65 |
for (int i = 0; i < (int)actions.size(); i++) {
|
|
shun-iwasawa |
563e65 |
CommandItem* item = new CommandItem(folder, actions[i]);
|
|
shun-iwasawa |
563e65 |
item->setToolTip(0, QObject::tr("[Drag&Drop] to copy command to %1")
|
|
shun-iwasawa |
563e65 |
.arg(m_dropTargetString));
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
shun-iwasawa |
563e65 |
return folder;
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
void CommandListTree::mousePressEvent(QMouseEvent* event) {
|
|
shun-iwasawa |
563e65 |
setCurrentItem(itemAt(event->pos()));
|
|
shun-iwasawa |
563e65 |
CommandItem* commandItem = dynamic_cast<commanditem*>(itemAt(event->pos()));</commanditem*>
|
|
shun-iwasawa |
563e65 |
SeparatorItem* separatorItem =
|
|
shun-iwasawa |
563e65 |
dynamic_cast<separatoritem*>(itemAt(event->pos()));</separatoritem*>
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
if (commandItem || separatorItem) {
|
|
shun-iwasawa |
563e65 |
std::string dragStr;
|
|
shun-iwasawa |
563e65 |
QString dragPixmapTxt;
|
|
shun-iwasawa |
563e65 |
if (commandItem) {
|
|
shun-iwasawa |
563e65 |
dragStr =
|
|
shun-iwasawa |
563e65 |
CommandManager::instance()->getIdFromAction(commandItem->getAction());
|
|
shun-iwasawa |
563e65 |
dragPixmapTxt = commandItem->getAction()->text();
|
|
shun-iwasawa |
563e65 |
dragPixmapTxt.remove("&");
|
|
shun-iwasawa |
563e65 |
} else {
|
|
shun-iwasawa |
563e65 |
dragStr = "separator";
|
|
shun-iwasawa |
563e65 |
dragPixmapTxt = tr("----Separator----");
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QMimeData* mimeData = new QMimeData;
|
|
shun-iwasawa |
563e65 |
mimeData->setText(QString::fromStdString(dragStr));
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QFontMetrics fm(QApplication::font());
|
|
shun-iwasawa |
563e65 |
QPixmap pix(fm.boundingRect(dragPixmapTxt).adjusted(-2, -2, 2, 2).size());
|
|
shun-iwasawa |
563e65 |
QPainter painter(&pix);
|
|
shun-iwasawa |
563e65 |
painter.fillRect(pix.rect(), Qt::white);
|
|
shun-iwasawa |
563e65 |
painter.setPen(Qt::black);
|
|
shun-iwasawa |
563e65 |
painter.drawText(pix.rect(), Qt::AlignCenter, dragPixmapTxt);
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QDrag* drag = new QDrag(this);
|
|
shun-iwasawa |
563e65 |
drag->setMimeData(mimeData);
|
|
shun-iwasawa |
563e65 |
drag->setPixmap(pix);
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
drag->exec(Qt::CopyAction);
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QTreeWidget::mousePressEvent(event);
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
void CommandListTree::displayAll(QTreeWidgetItem* item) {
|
|
shun-iwasawa |
563e65 |
int childCount = item->childCount();
|
|
shun-iwasawa |
563e65 |
for (int i = 0; i < childCount; ++i) {
|
|
shun-iwasawa |
563e65 |
displayAll(item->child(i));
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
item->setHidden(false);
|
|
shun-iwasawa |
563e65 |
item->setExpanded(false);
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
//-------------------------------------------------------------------
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
void CommandListTree::hideAll(QTreeWidgetItem* item) {
|
|
shun-iwasawa |
563e65 |
int childCount = item->childCount();
|
|
shun-iwasawa |
563e65 |
for (int i = 0; i < childCount; ++i) {
|
|
shun-iwasawa |
563e65 |
hideAll(item->child(i));
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
item->setHidden(true);
|
|
shun-iwasawa |
563e65 |
item->setExpanded(false);
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
//-----------------------------------------------------------------------------
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
void CommandListTree::searchItems(const QString& searchWord) {
|
|
shun-iwasawa |
563e65 |
// if search word is empty, show all items
|
|
shun-iwasawa |
563e65 |
if (searchWord.isEmpty()) {
|
|
shun-iwasawa |
563e65 |
int itemCount = topLevelItemCount();
|
|
shun-iwasawa |
563e65 |
for (int i = 0; i < itemCount; ++i) {
|
|
shun-iwasawa |
563e65 |
displayAll(topLevelItem(i));
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
// revert to the initial state - expanding "Menu Commands" tree
|
|
shun-iwasawa |
563e65 |
findItems(ShortcutTree::tr("Menu Commands"), Qt::MatchExactly)[0]
|
|
shun-iwasawa |
563e65 |
->setExpanded(true);
|
|
shun-iwasawa |
563e65 |
update();
|
|
shun-iwasawa |
563e65 |
return;
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
// hide all items first
|
|
shun-iwasawa |
563e65 |
int itemCount = topLevelItemCount();
|
|
shun-iwasawa |
563e65 |
for (int i = 0; i < itemCount; ++i) {
|
|
shun-iwasawa |
563e65 |
hideAll(topLevelItem(i));
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
QList<qtreewidgetitem*> foundItems =</qtreewidgetitem*>
|
|
shun-iwasawa |
563e65 |
findItems(searchWord, Qt::MatchContains | Qt::MatchRecursive, 0);
|
|
shun-iwasawa |
563e65 |
if (foundItems.isEmpty()) { // if nothing is found, do nothing but update
|
|
shun-iwasawa |
563e65 |
update();
|
|
shun-iwasawa |
563e65 |
return;
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
// for each item found, show it and show its parent
|
|
shun-iwasawa |
563e65 |
for (auto item : foundItems) {
|
|
shun-iwasawa |
563e65 |
while (item) {
|
|
shun-iwasawa |
563e65 |
item->setHidden(false);
|
|
shun-iwasawa |
563e65 |
item->setExpanded(true);
|
|
shun-iwasawa |
563e65 |
item = item->parent();
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
}
|
|
shun-iwasawa |
563e65 |
|
|
shun-iwasawa |
563e65 |
update();
|
|
shun-iwasawa |
563e65 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//=============================================================================
|
|
Jeremy Bullock |
0ff1b6 |
// CommandBarTree
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
CommandBarTree::CommandBarTree(TFilePath& path, QWidget* parent)
|
|
Jeremy Bullock |
0ff1b6 |
: QTreeWidget(parent) {
|
|
Jeremy Bullock |
0ff1b6 |
setObjectName("SolidLineFrame");
|
|
Jeremy Bullock |
0ff1b6 |
setAlternatingRowColors(true);
|
|
Jeremy Bullock |
0ff1b6 |
setDragEnabled(true);
|
|
Jeremy Bullock |
0ff1b6 |
setDropIndicatorShown(true);
|
|
Jeremy Bullock |
0ff1b6 |
setDefaultDropAction(Qt::MoveAction);
|
|
Jeremy Bullock |
0ff1b6 |
setDragDropMode(QAbstractItemView::DragDrop);
|
|
Jeremy Bullock |
0ff1b6 |
setIconSize(QSize(21, 17));
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
setColumnCount(1);
|
|
Jeremy Bullock |
0ff1b6 |
header()->close();
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
/*- Load path if it does exist. If not, then load from the template. -*/
|
|
Jeremy Bullock |
0ff1b6 |
TFilePath fp;
|
|
Jeremy Bullock |
0ff1b6 |
if (TFileStatus(path).isWritable())
|
|
Jeremy Bullock |
0ff1b6 |
fp = path;
|
|
Jeremy Bullock |
0ff1b6 |
else {
|
|
Jeremy Bullock |
0ff1b6 |
if (path.getName() == "xsheettoolbar") {
|
|
Jeremy Bullock |
0ff1b6 |
fp = ToonzFolder::getTemplateModuleDir() + TFilePath("xsheettoolbar.xml");
|
|
Jeremy Bullock |
0ff1b6 |
} else {
|
|
Jeremy Bullock |
0ff1b6 |
fp = ToonzFolder::getTemplateModuleDir() + TFilePath("commandbar.xml");
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
loadMenuTree(fp);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarTree::loadMenuTree(const TFilePath& fp) {
|
|
Jeremy Bullock |
0ff1b6 |
QFile file(toQString(fp));
|
|
Jeremy Bullock |
0ff1b6 |
if (!file.open(QFile::ReadOnly | QFile::Text)) {
|
|
Jeremy Bullock |
0ff1b6 |
qDebug() << "Cannot read file" << file.errorString();
|
|
Jeremy Bullock |
0ff1b6 |
return;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QXmlStreamReader reader(&file);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
if (reader.readNextStartElement()) {
|
|
Jeremy Bullock |
0ff1b6 |
if (reader.name() == "commandbar") {
|
|
Jeremy Bullock |
0ff1b6 |
while (reader.readNextStartElement()) {
|
|
Jeremy Bullock |
0ff1b6 |
if (reader.name() == "command") {
|
|
Jeremy Bullock |
0ff1b6 |
QString cmdName = reader.readElementText();
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QAction* action = CommandManager::instance()->getAction(
|
|
Jeremy Bullock |
0ff1b6 |
cmdName.toStdString().c_str());
|
|
Jeremy Bullock |
0ff1b6 |
if (action) {
|
|
shun-iwasawa |
563e65 |
CommandItem* item = new CommandItem(0, action);
|
|
Jeremy Bullock |
0ff1b6 |
addTopLevelItem(item);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
} else if (reader.name() == "separator") {
|
|
shun-iwasawa |
563e65 |
SeparatorItem* sep = new SeparatorItem(0);
|
|
Jeremy Bullock |
0ff1b6 |
addTopLevelItem(sep);
|
|
Jeremy Bullock |
0ff1b6 |
reader.skipCurrentElement();
|
|
Jeremy Bullock |
0ff1b6 |
} else
|
|
Jeremy Bullock |
0ff1b6 |
reader.skipCurrentElement();
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
} else
|
|
Jeremy Bullock |
0ff1b6 |
reader.raiseError(QObject::tr("Incorrect file"));
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
if (reader.hasError()) {
|
|
Jeremy Bullock |
0ff1b6 |
qDebug() << "Cannot read menubar xml";
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarTree::loadMenuRecursive(QXmlStreamReader& reader,
|
|
Jeremy Bullock |
0ff1b6 |
QTreeWidgetItem* parentItem) {
|
|
Jeremy Bullock |
0ff1b6 |
while (reader.readNextStartElement()) {
|
|
Jeremy Bullock |
0ff1b6 |
if (reader.name() == "command") {
|
|
Jeremy Bullock |
0ff1b6 |
QString cmdName = reader.readElementText();
|
|
Jeremy Bullock |
0ff1b6 |
QAction* action =
|
|
Jeremy Bullock |
0ff1b6 |
CommandManager::instance()->getAction(cmdName.toStdString().c_str());
|
|
shun-iwasawa |
563e65 |
if (action) CommandItem* item = new CommandItem(parentItem, action);
|
|
Jeremy Bullock |
0ff1b6 |
} else if (reader.name() == "command_debug") {
|
|
Jeremy Bullock |
0ff1b6 |
#ifndef NDEBUG
|
|
Jeremy Bullock |
0ff1b6 |
QString cmdName = reader.readElementText();
|
|
Jeremy Bullock |
0ff1b6 |
QAction* action =
|
|
Jeremy Bullock |
0ff1b6 |
CommandManager::instance()->getAction(cmdName.toStdString().c_str());
|
|
shun-iwasawa |
563e65 |
if (action) CommandItem* item = new CommandItem(parentItem, action);
|
|
Jeremy Bullock |
0ff1b6 |
#else
|
|
Jeremy Bullock |
0ff1b6 |
reader.skipCurrentElement();
|
|
Jeremy Bullock |
0ff1b6 |
#endif
|
|
Jeremy Bullock |
0ff1b6 |
} else if (reader.name() == "separator") {
|
|
shun-iwasawa |
563e65 |
SeparatorItem* sep = new SeparatorItem(parentItem);
|
|
Jeremy Bullock |
0ff1b6 |
reader.skipCurrentElement();
|
|
Jeremy Bullock |
0ff1b6 |
} else
|
|
Jeremy Bullock |
0ff1b6 |
reader.skipCurrentElement();
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarTree::saveMenuTree(TFilePath& path) {
|
|
Jeremy Bullock |
0ff1b6 |
QFile file(toQString(path));
|
|
Jeremy Bullock |
0ff1b6 |
if (!file.open(QFile::WriteOnly | QFile::Text)) {
|
|
Jeremy Bullock |
0ff1b6 |
qDebug() << "Cannot read file" << file.errorString();
|
|
Jeremy Bullock |
0ff1b6 |
return;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QXmlStreamWriter writer(&file);
|
|
Jeremy Bullock |
0ff1b6 |
writer.setAutoFormatting(true);
|
|
Jeremy Bullock |
0ff1b6 |
writer.writeStartDocument();
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
writer.writeStartElement("commandbar");
|
|
Jeremy Bullock |
0ff1b6 |
{ saveMenuRecursive(writer, invisibleRootItem()); }
|
|
Jeremy Bullock |
0ff1b6 |
writer.writeEndElement();
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
writer.writeEndDocument();
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarTree::saveMenuRecursive(QXmlStreamWriter& writer,
|
|
Jeremy Bullock |
0ff1b6 |
QTreeWidgetItem* parentItem) {
|
|
Jeremy Bullock |
0ff1b6 |
for (int c = 0; c < parentItem->childCount(); c++) {
|
|
shun-iwasawa |
563e65 |
CommandItem* command = dynamic_cast<commanditem*>(parentItem->child(c));</commanditem*>
|
|
shun-iwasawa |
563e65 |
SeparatorItem* sep = dynamic_cast<separatoritem*>(parentItem->child(c));</separatoritem*>
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
if (command)
|
|
Jeremy Bullock |
0ff1b6 |
writer.writeTextElement(
|
|
Jeremy Bullock |
0ff1b6 |
"command",
|
|
Jeremy Bullock |
0ff1b6 |
QString::fromStdString(CommandManager::instance()->getIdFromAction(
|
|
Jeremy Bullock |
0ff1b6 |
command->getAction())));
|
|
Jeremy Bullock |
0ff1b6 |
else if (sep)
|
|
Jeremy Bullock |
0ff1b6 |
writer.writeEmptyElement("separator");
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
bool CommandBarTree::dropMimeData(QTreeWidgetItem* parent, int index,
|
|
Jeremy Bullock |
0ff1b6 |
const QMimeData* data,
|
|
Jeremy Bullock |
0ff1b6 |
Qt::DropAction action) {
|
|
Jeremy Bullock |
0ff1b6 |
if (data->hasText()) {
|
|
Jeremy Bullock |
0ff1b6 |
QString txt = data->text();
|
|
Jeremy Bullock |
0ff1b6 |
QTreeWidgetItem* item;
|
|
Jeremy Bullock |
0ff1b6 |
if (txt == "separator")
|
|
shun-iwasawa |
563e65 |
item = new SeparatorItem(0);
|
|
Jeremy Bullock |
0ff1b6 |
else {
|
|
Jeremy Bullock |
0ff1b6 |
QAction* act =
|
|
Jeremy Bullock |
0ff1b6 |
CommandManager::instance()->getAction(txt.toStdString().c_str());
|
|
Jeremy Bullock |
0ff1b6 |
if (!act) return false;
|
|
shun-iwasawa |
563e65 |
item = new CommandItem(0, act);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
if (parent)
|
|
Jeremy Bullock |
0ff1b6 |
parent->insertChild(index, item);
|
|
Jeremy Bullock |
0ff1b6 |
else
|
|
Jeremy Bullock |
0ff1b6 |
insertTopLevelItem(index, item);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
return true;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
return false;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QStringList CommandBarTree::mimeTypes() const {
|
|
Jeremy Bullock |
0ff1b6 |
QStringList qstrList;
|
|
Jeremy Bullock |
0ff1b6 |
qstrList.append("text/plain");
|
|
Jeremy Bullock |
0ff1b6 |
return qstrList;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarTree::contextMenuEvent(QContextMenuEvent* event) {
|
|
Jeremy Bullock |
0ff1b6 |
QTreeWidgetItem* item = itemAt(event->pos());
|
|
Jeremy Bullock |
0ff1b6 |
if (item != currentItem()) setCurrentItem(item);
|
|
Jeremy Bullock |
0ff1b6 |
QMenu* menu = new QMenu(this);
|
|
Jeremy Bullock |
0ff1b6 |
QAction* action;
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
if (item) {
|
|
Jeremy Bullock |
0ff1b6 |
action = menu->addAction(tr("Remove \"%1\"").arg(item->text(0)));
|
|
Jeremy Bullock |
0ff1b6 |
connect(action, SIGNAL(triggered()), this, SLOT(removeItem()));
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
menu->exec(event->globalPos());
|
|
Jeremy Bullock |
0ff1b6 |
delete menu;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarTree::removeItem() {
|
|
Jeremy Bullock |
0ff1b6 |
QTreeWidgetItem* item = currentItem();
|
|
Jeremy Bullock |
0ff1b6 |
if (!item) return;
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
if (indexOfTopLevelItem(item) >= 0)
|
|
Jeremy Bullock |
0ff1b6 |
takeTopLevelItem(indexOfTopLevelItem(item));
|
|
Jeremy Bullock |
0ff1b6 |
else
|
|
Jeremy Bullock |
0ff1b6 |
item->parent()->removeChild(item);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
delete item;
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//=============================================================================
|
|
Jeremy Bullock |
0ff1b6 |
// CommandBarPopup
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
CommandBarPopup::CommandBarPopup(bool isXsheetToolbar)
|
|
Jeremy Bullock |
0ff1b6 |
: Dialog(TApp::instance()->getMainWindow(), true, false,
|
|
Jeremy Bullock |
0ff1b6 |
"CustomizeCommandBar") {
|
|
Jeremy Bullock |
0ff1b6 |
QLabel* commandBarLabel;
|
|
Jeremy Bullock |
0ff1b6 |
if (isXsheetToolbar) {
|
|
Jeremy Bullock |
0ff1b6 |
m_path = ToonzFolder::getMyModuleDir() + TFilePath("xsheettoolbar.xml");
|
|
Jeremy Bullock |
0ff1b6 |
commandBarLabel = new QLabel(tr("XSheet Toolbar"));
|
|
Jeremy Bullock |
0ff1b6 |
setWindowTitle(tr("Customize XSheet Toolbar"));
|
|
Jeremy Bullock |
0ff1b6 |
} else {
|
|
Jeremy Bullock |
0ff1b6 |
m_path = ToonzFolder::getMyModuleDir() + TFilePath("commandbar.xml");
|
|
Jeremy Bullock |
0ff1b6 |
commandBarLabel = new QLabel(tr("Command Bar"));
|
|
Jeremy Bullock |
0ff1b6 |
setWindowTitle(tr("Customize Command Bar"));
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
shun-iwasawa |
563e65 |
m_commandListTree = new CommandListTree(commandBarLabel->text(), this);
|
|
Jeremy Bullock |
0ff1b6 |
m_menuBarTree = new CommandBarTree(m_path, this);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QPushButton* okBtn = new QPushButton(tr("OK"), this);
|
|
Jeremy Bullock |
0ff1b6 |
QPushButton* cancelBtn = new QPushButton(tr("Cancel"), this);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
okBtn->setFocusPolicy(Qt::NoFocus);
|
|
Jeremy Bullock |
0ff1b6 |
cancelBtn->setFocusPolicy(Qt::NoFocus);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QLabel* commandItemListLabel = new QLabel(tr("Toolbar Items"), this);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QFont f("Arial", 15, QFont::Bold);
|
|
Jeremy Bullock |
0ff1b6 |
commandBarLabel->setFont(f);
|
|
Jeremy Bullock |
0ff1b6 |
commandItemListLabel->setFont(f);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
QLabel* noticeLabel =
|
|
Jeremy Bullock |
0ff1b6 |
new QLabel(tr("Duplicated commands will be ignored. Only "
|
|
Jeremy Bullock |
0ff1b6 |
"the last one will appear in the menu bar."),
|
|
Jeremy Bullock |
0ff1b6 |
this);
|
|
Jeremy Bullock |
0ff1b6 |
QFont nf("Arial", 9, QFont::Normal);
|
|
Jeremy Bullock |
0ff1b6 |
nf.setItalic(true);
|
|
Jeremy Bullock |
0ff1b6 |
noticeLabel->setFont(nf);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
manongjohn |
048d93 |
QLineEdit* searchEdit = new QLineEdit(this);
|
|
manongjohn |
048d93 |
|
|
Jeremy Bullock |
0ff1b6 |
//--- layout
|
|
Jeremy Bullock |
0ff1b6 |
m_topLayout->setMargin(0);
|
|
Jeremy Bullock |
0ff1b6 |
m_topLayout->setSpacing(0);
|
|
Jeremy Bullock |
0ff1b6 |
{
|
|
Jeremy Bullock |
0ff1b6 |
QGridLayout* mainUILay = new QGridLayout();
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setMargin(5);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setHorizontalSpacing(8);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setVerticalSpacing(5);
|
|
Jeremy Bullock |
0ff1b6 |
{
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->addWidget(commandBarLabel, 0, 0);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->addWidget(commandItemListLabel, 0, 1);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
manongjohn |
048d93 |
mainUILay->addWidget(m_menuBarTree, 1, 0, 2, 1);
|
|
manongjohn |
048d93 |
|
|
manongjohn |
048d93 |
QHBoxLayout* searchLay = new QHBoxLayout();
|
|
manongjohn |
048d93 |
searchLay->setMargin(0);
|
|
manongjohn |
048d93 |
searchLay->setSpacing(5);
|
|
manongjohn |
048d93 |
{
|
|
manongjohn |
048d93 |
searchLay->addWidget(new QLabel(tr("Search:"), this), 0);
|
|
manongjohn |
048d93 |
searchLay->addWidget(searchEdit);
|
|
manongjohn |
048d93 |
}
|
|
manongjohn |
048d93 |
mainUILay->addLayout(searchLay, 1, 1);
|
|
manongjohn |
048d93 |
mainUILay->addWidget(m_commandListTree, 2, 1);
|
|
manongjohn |
048d93 |
|
|
manongjohn |
048d93 |
mainUILay->addWidget(noticeLabel, 3, 0, 1, 2);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setRowStretch(0, 0);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setRowStretch(1, 1);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setRowStretch(2, 0);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setColumnStretch(0, 1);
|
|
Jeremy Bullock |
0ff1b6 |
mainUILay->setColumnStretch(1, 1);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
m_topLayout->addLayout(mainUILay, 1);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
m_buttonLayout->setMargin(0);
|
|
Jeremy Bullock |
0ff1b6 |
m_buttonLayout->setSpacing(30);
|
|
Jeremy Bullock |
0ff1b6 |
{
|
|
Jeremy Bullock |
0ff1b6 |
m_buttonLayout->addStretch(1);
|
|
Jeremy Bullock |
0ff1b6 |
m_buttonLayout->addWidget(okBtn, 0);
|
|
Jeremy Bullock |
0ff1b6 |
m_buttonLayout->addWidget(cancelBtn, 0);
|
|
Jeremy Bullock |
0ff1b6 |
m_buttonLayout->addStretch(1);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//--- signal/slot connections
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
bool ret = connect(okBtn, SIGNAL(clicked()), this, SLOT(onOkPressed()));
|
|
Jeremy Bullock |
0ff1b6 |
ret = ret && connect(cancelBtn, SIGNAL(clicked()), this, SLOT(reject()));
|
|
manongjohn |
048d93 |
ret = ret && connect(searchEdit, SIGNAL(textChanged(const QString&)), this,
|
|
manongjohn |
048d93 |
SLOT(onSearchTextChanged(const QString&)));
|
|
manongjohn |
048d93 |
|
|
Jeremy Bullock |
0ff1b6 |
assert(ret);
|
|
Jeremy Bullock |
0ff1b6 |
}
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
//-----------------------------------------------------------------------------
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
void CommandBarPopup::onOkPressed() {
|
|
Jeremy Bullock |
0ff1b6 |
m_menuBarTree->saveMenuTree(m_path);
|
|
Jeremy Bullock |
0ff1b6 |
|
|
Jeremy Bullock |
0ff1b6 |
accept();
|
|
manongjohn |
048d93 |
}
|
|
manongjohn |
048d93 |
|
|
manongjohn |
048d93 |
void CommandBarPopup::onSearchTextChanged(const QString& text) {
|
|
manongjohn |
048d93 |
static bool busy = false;
|
|
manongjohn |
048d93 |
if (busy) return;
|
|
manongjohn |
048d93 |
busy = true;
|
|
manongjohn |
048d93 |
m_commandListTree->searchItems(text);
|
|
manongjohn |
048d93 |
busy = false;
|
|
manongjohn |
048d93 |
}
|