Skip to content

Commit

Permalink
Merge pull request #1691 from 1445643474/master
Browse files Browse the repository at this point in the history
delete useless lexer files
  • Loading branch information
legobadman authored Jan 4, 2024
2 parents 65c10b0 + ba4c445 commit 1a6e65e
Show file tree
Hide file tree
Showing 204 changed files with 90 additions and 73,481 deletions.
12 changes: 11 additions & 1 deletion ui/zenoedit/dock/ztabdockwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "../panel/zenospreadsheet.h"
#include "../panel/zlogpanel.h"
#include "../panel/zenocommandparamspanel.h"
#include "../panel/zenoopenpathpanel.h"
#include "viewport/viewportwidget.h"
#include "viewport/displaywidget.h"
#include "nodesview/zenographseditor.h"
Expand Down Expand Up @@ -228,6 +229,10 @@ QWidget* ZTabDockWidget::createTabWidget(PANEL_TYPE type)
{
return new ZenoCommandParamsPanel;
}
case PANEL_OPEN_PATH:
{
return new ZenoOpenPathPanel;
}
}
return nullptr;
}
Expand All @@ -245,6 +250,7 @@ QString ZTabDockWidget::type2Title(PANEL_TYPE type)
case PANEL_OPTIX_VIEW: return tr("Optix");
case PANEL_IMAGE: return tr("Image");
case PANEL_COMMAND_PARAMS: return tr("Command Params");
case PANEL_OPEN_PATH: return tr("Open Path");
default:
return "";
}
Expand Down Expand Up @@ -280,6 +286,9 @@ PANEL_TYPE ZTabDockWidget::title2Type(const QString& title)
else if (title == tr("Command Params") || title == "Command Params") {
type = PANEL_COMMAND_PARAMS;
}
else if (title == tr("Open Path") || title == "Open Path") {
type = PANEL_OPEN_PATH;
}
return type;
}

Expand Down Expand Up @@ -532,7 +541,7 @@ void ZTabDockWidget::onAddTabClicked()
font.setBold(false);
menu->setFont(font);

static QList<QString> panels = { tr("Parameter"), tr("Scene Viewport"), tr("Node Editor"), tr("Spreadsheet"), tr("Log"), tr("Image"), tr("Optix"), tr("Command Params") };
static QList<QString> panels = { tr("Parameter"), tr("Scene Viewport"), tr("Node Editor"), tr("Spreadsheet"), tr("Log"), tr("Image"), tr("Optix"), tr("Command Params"), tr("Open Path") };
for (QString name : panels)
{
QAction* pAction = new QAction(name);
Expand Down Expand Up @@ -560,6 +569,7 @@ void ZTabDockWidget::onAddTabClicked()
case 6: m_debugPanel = PANEL_IMAGE; break;
case 7: m_debugPanel = PANEL_OPTIX_VIEW; break;
case 8: m_debugPanel = PANEL_COMMAND_PARAMS; break;
case 9: m_debugPanel = PANEL_OPEN_PATH; break;
}
m_tabWidget->setCurrentIndex(idx);
}
Expand Down
3 changes: 2 additions & 1 deletion ui/zenoedit/dock/ztabdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ enum PANEL_TYPE
PANEL_LIGHT,
PANEL_IMAGE,
PANEL_OPTIX_VIEW,
PANEL_COMMAND_PARAMS
PANEL_COMMAND_PARAMS,
PANEL_OPEN_PATH
};

class ZTabDockWidget : public QDockWidget
Expand Down
55 changes: 55 additions & 0 deletions ui/zenoedit/panel/zenoopenpathpanel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#include "zenoopenpathpanel.h"
#include <zenoui/style/zenostyle.h>

ZenoOpenPathPanel::ZenoOpenPathPanel(QWidget* parent)
: QWidget(parent)
{
initUI();
}

void ZenoOpenPathPanel::initUI()
{
m_pLayout = new QVBoxLayout(this);
m_pFileDialog = new QFileDialog(this, "Open path", "", "All Files(*);; ");
m_pFileDialog->setWindowFlags(Qt::Widget);
m_pLayout->addWidget(m_pFileDialog);
m_pFileDialog->installEventFilter(this);
}

bool ZenoOpenPathPanel::eventFilter(QObject* obj, QEvent* evt)
{
if (obj == m_pFileDialog)
{
if (evt->type() == QEvent::ShortcutOverride)
{
QKeyEvent* keyEvt = dynamic_cast<QKeyEvent*>(evt);
if (keyEvt == QKeySequence::Copy) {
m_pFileDialog->setFocus();
evt->accept();
return true;
}
}
else if (evt->type() == QEvent::KeyPress)
{
QKeyEvent* keyEvt = dynamic_cast<QKeyEvent*>(evt);
if (keyEvt == QKeySequence::Copy) {
QMimeData* pMimeData = new QMimeData;
const QUrl& url = m_pFileDialog->selectedUrls().value(0);
QString text;
if (url.isLocalFile() || url.isEmpty())
text = url.toLocalFile();
else
text = url.toString();
pMimeData->setText(text);
QApplication::clipboard()->setMimeData(pMimeData);
evt->accept();
return true;
}
}
else if (evt->type() == QEvent::HideToParent)
{
m_pFileDialog->show();
}
}
return QWidget::eventFilter(obj, evt);
}
21 changes: 21 additions & 0 deletions ui/zenoedit/panel/zenoopenpathpanel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef __ZENO_OPENPATHPANEL_H__
#define __ZENO_OPENPATHPANEL_H__

#include <QtWidgets>

class ZenoOpenPathPanel : public QWidget
{
Q_OBJECT
public:
ZenoOpenPathPanel(QWidget *parent = nullptr);
protected:
bool eventFilter(QObject* obj, QEvent* evt) override;
private:
void initUI();
private:
QFileDialog* m_pFileDialog;
QVBoxLayout* m_pLayout;
};

#endif

4 changes: 1 addition & 3 deletions ui/zenoedit/panel/zenospreadsheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,7 @@ bool ZenoSpreadsheet::eventFilter(QObject* watched, QEvent* event)
if (watched == prim_attr_view && event->type() == QEvent::KeyPress)
{
QKeyEvent* keyEvt = dynamic_cast<QKeyEvent*>(event);
int uKey = keyEvt->key();
Qt::KeyboardModifiers modifiers = keyEvt->modifiers();
if (uKey == Qt::Key_C && (modifiers & Qt::ControlModifier)) {
if (keyEvt == QKeySequence::Copy) {
if (QItemSelectionModel* pSelectionModel = prim_attr_view->selectionModel())
{
int cols = dataModel->columnCount(QModelIndex());
Expand Down
Loading

0 comments on commit 1a6e65e

Please sign in to comment.