From 06ee5364316c747c6da066b172022c7df8e0891f Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 21 May 2022 10:44:39 +0800 Subject: [PATCH] - fix: tab icon not correct restore when hide and show a panel - fix: the hiding state of the tools output panel is not correctly saved --- NEWS.md | 2 + RedPandaIDE/RedPandaIDE.pro | 2 + RedPandaIDE/compiler/compilermanager.cpp | 2 +- RedPandaIDE/customfileiconprovider.cpp | 16 ++++ RedPandaIDE/customfileiconprovider.h | 16 ++++ RedPandaIDE/mainwindow.cpp | 36 +++++++-- RedPandaIDE/mainwindow.h | 2 +- RedPandaIDE/mainwindow.ui | 28 +++++-- RedPandaIDE/settings.cpp | 67 ++++------------ RedPandaIDE/settings.h | 14 +--- .../executorproblemsetwidget.ui | 9 ++- RedPandaIDE/widgets/choosethemedialog.cpp | 16 ++++ RedPandaIDE/widgets/choosethemedialog.h | 16 ++++ .../widgets/compileargumentswidget.cpp | 16 ++++ RedPandaIDE/widgets/compileargumentswidget.h | 16 ++++ .../widgets/customdisablediconengine.cpp | 24 +++++- .../widgets/customdisablediconengine.h | 16 ++++ RedPandaIDE/widgets/customfilesystemmodel.cpp | 16 ++++ RedPandaIDE/widgets/customfilesystemmodel.h | 16 ++++ RedPandaIDE/widgets/infomessagebox.cpp | 16 ++++ RedPandaIDE/widgets/infomessagebox.h | 16 ++++ RedPandaIDE/widgets/linenumbertexteditor.cpp | 16 ++++ RedPandaIDE/widgets/linenumbertexteditor.h | 16 ++++ RedPandaIDE/widgets/newclassdialog.cpp | 16 ++++ RedPandaIDE/widgets/newclassdialog.h | 16 ++++ RedPandaIDE/widgets/newheaderdialog.cpp | 16 ++++ RedPandaIDE/widgets/newheaderdialog.h | 16 ++++ RedPandaIDE/widgets/newprojectunitdialog.cpp | 16 ++++ RedPandaIDE/widgets/newprojectunitdialog.h | 16 ++++ RedPandaIDE/widgets/ojproblemsetmodel.cpp | 4 +- RedPandaIDE/widgets/shortcutinputedit.cpp | 16 ++++ RedPandaIDE/widgets/shortcutinputedit.h | 16 ++++ RedPandaIDE/widgets/shrinkabletabwidget.cpp | 77 +++++++++++++++++++ RedPandaIDE/widgets/shrinkabletabwidget.h | 40 ++++++++++ 34 files changed, 556 insertions(+), 87 deletions(-) create mode 100644 RedPandaIDE/widgets/shrinkabletabwidget.cpp create mode 100644 RedPandaIDE/widgets/shrinkabletabwidget.h diff --git a/NEWS.md b/NEWS.md index e0a41343..dba5aa5d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,8 @@ Red Panda C++ Version 1.0.9 - fix: copy & paste in column mode not correctly handled - fix: crash when project name is selected in the project view and try create new project file - change: panels can be relocated + - fix: tab icon not correct restore when hide and show a panel + - fix: the hiding state of the tools output panel is not correctly saved Red Panda C++ Version 1.0.8 - enhancement: auto complete '#undef' diff --git a/RedPandaIDE/RedPandaIDE.pro b/RedPandaIDE/RedPandaIDE.pro index 581fe9da..df4cc165 100644 --- a/RedPandaIDE/RedPandaIDE.pro +++ b/RedPandaIDE/RedPandaIDE.pro @@ -185,6 +185,7 @@ SOURCES += \ widgets/searchdialog.cpp \ widgets/searchresultview.cpp \ widgets/shortcutinputedit.cpp \ + widgets/shrinkabletabwidget.cpp \ widgets/signalmessagedialog.cpp HEADERS += \ @@ -334,6 +335,7 @@ HEADERS += \ widgets/searchdialog.h \ widgets/searchresultview.h \ widgets/shortcutinputedit.h \ + widgets/shrinkabletabwidget.h \ widgets/signalmessagedialog.h FORMS += \ diff --git a/RedPandaIDE/compiler/compilermanager.cpp b/RedPandaIDE/compiler/compilermanager.cpp index 465f0169..ce680768 100644 --- a/RedPandaIDE/compiler/compilermanager.cpp +++ b/RedPandaIDE/compiler/compilermanager.cpp @@ -316,7 +316,7 @@ void CompilerManager::runProblem(const QString &filename, const QString &argumen OJProblemCasesRunner * execRunner = new OJProblemCasesRunner(filename,arguments,workDir,problemCases); mRunner = execRunner; if (pSettings->executor().enableCaseTimeout()) - execRunner->setExecTimeout(pSettings->executor().caseTimeout()*1000); + execRunner->setExecTimeout(pSettings->executor().caseTimeout()); connect(mRunner, &Runner::finished, this ,&CompilerManager::onRunnerTerminated); connect(mRunner, &Runner::finished, pMainWindow ,&MainWindow::onRunProblemFinished); connect(mRunner, &Runner::runErrorOccurred, pMainWindow ,&MainWindow::onRunErrorOccured); diff --git a/RedPandaIDE/customfileiconprovider.cpp b/RedPandaIDE/customfileiconprovider.cpp index d6879c92..c45f5c82 100644 --- a/RedPandaIDE/customfileiconprovider.cpp +++ b/RedPandaIDE/customfileiconprovider.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "customfileiconprovider.h" #include "iconsmanager.h" #include "vcs/gitrepository.h" diff --git a/RedPandaIDE/customfileiconprovider.h b/RedPandaIDE/customfileiconprovider.h index aac770d5..308d09d2 100644 --- a/RedPandaIDE/customfileiconprovider.h +++ b/RedPandaIDE/customfileiconprovider.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef CUSTOMFILEICONPROVIDER_H #define CUSTOMFILEICONPROVIDER_H diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 174431ae..5fee3d26 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -1899,12 +1899,13 @@ void MainWindow::openCloseBottomPanel(bool open) // } // mBottomPanelOpenned = open; // QSplitterHandle* handle = ui->splitterMessages->handle(1); -// handle->setEnabled(mBottomPanelOpenned); + // handle->setEnabled(mBottomPanelOpenned); } + void MainWindow::openCloseLeftPanel(bool open) { - ui->dockFiles->setVisible(open); + ui->dockInfos->setVisible(open); // if (mOpenClosingLeftPanel) // return; // mOpenClosingLeftPanel = true; @@ -2712,7 +2713,7 @@ void MainWindow::buildEncodingMenu() void MainWindow::maximizeEditor() { - if (ui->dockFiles->isVisible() || ui->dockMessages->isVisible()) { + if (ui->dockInfos->isVisible() || ui->dockMessages->isVisible()) { openCloseBottomPanel(false); openCloseLeftPanel(false); } else { @@ -4319,6 +4320,7 @@ void MainWindow::closeEvent(QCloseEvent *event) { settings.setShowProblemSet(ui->actionProblem_Set->isChecked()); settings.setShowIssues(ui->actionIssues->isChecked()); + settings.setShowCompileLog(ui->actionTools_Output->isChecked()); settings.setShowDebug(ui->actionDebug_Window->isChecked()); settings.setShowSearch(ui->actionSearch->isChecked()); settings.setShowTODO(ui->actionTODO->isChecked()); @@ -4932,7 +4934,7 @@ void MainWindow::on_actionConvert_to_UTF_8_triggered() void MainWindow::on_tabMessages_tabBarClicked(int index) { if (index == ui->tabMessages->currentIndex()) { -// openCloseBottomPanel(!mBottomPanelOpenned); + ui->tabMessages->toggleShrined(); } } @@ -5364,6 +5366,8 @@ void MainWindow::on_actionForward_triggered() void MainWindow::on_tabInfos_tabBarClicked(int index) { if (index == ui->tabInfos->currentIndex()) { + int width = ui->tabInfos->tabBar()->width(); + ui->tabInfos->toggleShrined(); // openCloseLeftPanel(!mLeftPanelOpenned); } } @@ -5879,6 +5883,12 @@ void MainWindow::showHideInfosTab(QWidget *widget, bool show) int idx = findTabIndex(ui->tabInfos,widget); if (idx>=0) { if (!show) { + if (mTabInfosData.contains(widget)) { + PTabWidgetInfo info = mTabInfosData[widget]; + info->icon = ui->tabInfos->tabIcon(idx); + info->text = ui->tabInfos->tabText(idx); + } + ui->tabInfos->removeTab(idx); } } else { @@ -5907,6 +5917,11 @@ void MainWindow::showHideMessagesTab(QWidget *widget, bool show) int idx = findTabIndex(ui->tabMessages,widget); if (idx>=0) { if (!show) { + if (mTabMessagesData.contains(widget)) { + PTabWidgetInfo info = mTabMessagesData[widget]; + info->icon = ui->tabMessages->tabIcon(idx); + info->text = ui->tabMessages->tabText(idx); + } ui->tabMessages->removeTab(idx); } } else { @@ -7667,7 +7682,7 @@ void MainWindow::on_actionCompiler_Options_triggered() } -void MainWindow::on_dockFiles_dockLocationChanged(const Qt::DockWidgetArea &area) +void MainWindow::on_dockInfos_dockLocationChanged(const Qt::DockWidgetArea &area) { switch(area) { case Qt::DockWidgetArea::BottomDockWidgetArea: @@ -7688,6 +7703,10 @@ void MainWindow::on_dockFiles_dockLocationChanged(const Qt::DockWidgetArea &area void MainWindow::on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &area) { + qDebug()<<"-----"; + qDebug()<dockMessages->minimumSize(); + qDebug()<tabMessages->minimumSize(); + qDebug()<tabMessages->minimumSizeHint(); switch(area) { case Qt::DockWidgetArea::BottomDockWidgetArea: case Qt::DockWidgetArea::TopDockWidgetArea: @@ -7702,16 +7721,21 @@ void MainWindow::on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &a case Qt::DockWidgetArea::BottomDockWidgetArea: case Qt::DockWidgetArea::TopDockWidgetArea: ui->tabMessages->setTabPosition(QTabWidget::TabPosition::South); + ui->debugViews->setTabPosition(QTabWidget::TabPosition::South); break; case Qt::DockWidgetArea::LeftDockWidgetArea: ui->tabMessages->setTabPosition(QTabWidget::TabPosition::West); + ui->debugViews->setTabPosition(QTabWidget::TabPosition::West); break; case Qt::DockWidgetArea::RightDockWidgetArea: ui->tabMessages->setTabPosition(QTabWidget::TabPosition::East); + ui->debugViews->setTabPosition(QTabWidget::TabPosition::East); break; default: break; } - + qDebug()<dockMessages->minimumSize(); + qDebug()<tabMessages->minimumSize(); + qDebug()<tabMessages->minimumSizeHint(); } diff --git a/RedPandaIDE/mainwindow.h b/RedPandaIDE/mainwindow.h index 803f1d58..dffe591c 100644 --- a/RedPandaIDE/mainwindow.h +++ b/RedPandaIDE/mainwindow.h @@ -670,7 +670,7 @@ private slots: void on_actionCompiler_Options_triggered(); - void on_dockFiles_dockLocationChanged(const Qt::DockWidgetArea &area); + void on_dockInfos_dockLocationChanged(const Qt::DockWidgetArea &area); void on_dockMessages_dockLocationChanged(const Qt::DockWidgetArea &area); diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 025f8746..625461ff 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -433,9 +433,9 @@ - + - QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable + QDockWidget::DockWidgetMovable Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea @@ -446,7 +446,7 @@ 1 - + 0 @@ -457,7 +457,7 @@ QTabWidget::West - 0 + 1 true @@ -829,8 +829,14 @@ + + + 818 + 235 + + - QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetMovable + QDockWidget::DockWidgetMovable Qt::BottomDockWidgetArea|Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea @@ -841,7 +847,7 @@ 8 - + 0 @@ -852,7 +858,7 @@ QTabWidget::South - 6 + 0 @@ -1048,7 +1054,7 @@ QTabWidget::North - 4 + 0 @@ -3069,6 +3075,12 @@ QPlainTextEdit
widgets/linenumbertexteditor.h
+ + ShrinkableTabWidget + QTabWidget +
widgets/shrinkabletabwidget.h
+ 1 +
diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index e6b1a642..68757d99 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -67,6 +67,11 @@ void Settings::endGroup() mSettings.endGroup(); } +void Settings::remove(const QString &key) +{ + mSettings.remove(key); +} + void Settings::saveValue(const QString& group, const QString &key, const QVariant &value) { mSettings.beginGroup(group); auto act = finally([this] { @@ -288,6 +293,11 @@ void Settings::_Base::endGroup() mSettings->endGroup(); } +void Settings::_Base::remove(const QString &key) +{ + mSettings->remove(key); +} + void Settings::_Base::saveValue(const QString &key, const QVariant &value) { mSettings->saveValue(key,value); @@ -3177,7 +3187,8 @@ void Settings::Executor::doSave() saveValue("case_editor_font_name",mCaseEditorFontName); saveValue("case_editor_font_size",mCaseEditorFontSize); saveValue("case_editor_font_only_monospaced",mCaseEditorFontOnlyMonospaced); - saveValue("case_timeout", mCaseTimeout); + saveValue("case_timeout_ms", mCaseTimeout); + remove("case_timeout"); saveValue("enable_case_timeout", mEnableCaseTimeout); } @@ -3211,7 +3222,11 @@ void Settings::Executor::doLoad() #endif mCaseEditorFontSize = intValue("case_editor_font_size",12); mCaseEditorFontOnlyMonospaced = boolValue("case_editor_font_only_monospaced",true); - mCaseTimeout = intValue("case_timeout", 2); + int case_timeout = intValue("case_timeout", -1); + if (case_timeout>0) + mCaseTimeout = case_timeout*1000; + else + mCaseTimeout = intValue("case_timeout_ms", 2000); mEnableCaseTimeout = boolValue("enable_case_timeout", true); } @@ -4627,26 +4642,6 @@ void Settings::UI::setMainWindowGeometry(const QByteArray &newMainWindowGeometry mMainWindowGeometry = newMainWindowGeometry; } -bool Settings::UI::bottomPanelOpenned() const -{ - return mBottomPanelOpenned; -} - -void Settings::UI::setBottomPanelOpenned(bool newBottomPanelOpenned) -{ - mBottomPanelOpenned = newBottomPanelOpenned; -} - -int Settings::UI::bottomPanelHeight() const -{ - return mBottomPanelHeight; -} - -void Settings::UI::setBottomPanelHeight(int newBottomPanelHeight) -{ - mBottomPanelHeight = newBottomPanelHeight; -} - int Settings::UI::bottomPanelIndex() const { return mBottomPanelIndex; @@ -4657,26 +4652,6 @@ void Settings::UI::setBottomPanelIndex(int newBottomPanelIndex) mBottomPanelIndex = newBottomPanelIndex; } -bool Settings::UI::leftPanelOpenned() const -{ - return mLeftPanelOpenned; -} - -void Settings::UI::setLeftPanelOpenned(bool newLeftPanelOpenned) -{ - mLeftPanelOpenned = newLeftPanelOpenned; -} - -int Settings::UI::leftPanelWidth() const -{ - return mLeftPanelWidth; -} - -void Settings::UI::setLeftPanelWidth(int newLeftPanelWidth) -{ - mLeftPanelWidth = newLeftPanelWidth; -} - int Settings::UI::leftPanelIndex() const { return mLeftPanelIndex; @@ -5001,11 +4976,7 @@ void Settings::UI::doSave() { saveValue("main_window_state",mMainWindowState); saveValue("main_window_geometry",mMainWindowGeometry); - saveValue("bottom_panel_openned",mBottomPanelOpenned); - saveValue("bottom_panel_height",mBottomPanelHeight); saveValue("bottom_panel_index",mBottomPanelIndex); - saveValue("left_panel_openned",mLeftPanelOpenned); - saveValue("left_panel_width",mLeftPanelWidth); saveValue("left_panel_index",mLeftPanelIndex); saveValue("class_browser_sort_alphabetically",mClassBrowserSortAlpha); saveValue("class_browser_sort_by_type",mClassBrowserSortType); @@ -5049,11 +5020,7 @@ void Settings::UI::doLoad() { mMainWindowState = value("main_window_state",QByteArray()).toByteArray(); mMainWindowGeometry = value("main_window_geometry",QByteArray()).toByteArray(); - mBottomPanelOpenned = boolValue("bottom_panel_openned",false); - mBottomPanelHeight = intValue("bottom_panel_height",220); mBottomPanelIndex = intValue("bottom_panel_index",0); - mLeftPanelOpenned = boolValue("left_panel_openned",true); - mLeftPanelWidth = intValue("left_panel_width",250); mLeftPanelIndex = intValue("left_panel_index",0); mClassBrowserSortAlpha = boolValue("class_browser_sort_alphabetically",true); mClassBrowserSortType = boolValue("class_browser_sort_by_type",true); diff --git a/RedPandaIDE/settings.h b/RedPandaIDE/settings.h index 15b9dff5..bdfc0887 100644 --- a/RedPandaIDE/settings.h +++ b/RedPandaIDE/settings.h @@ -67,6 +67,7 @@ private: explicit _Base(Settings* settings, const QString& groupName); void beginGroup(); void endGroup(); + void remove(const QString &key); void saveValue(const QString &key, const QVariant &value); QVariant value(const QString &key, const QVariant& defaultValue); bool boolValue(const QString &key, bool defaultValue); @@ -930,16 +931,8 @@ public: const QByteArray &mainWindowGeometry() const; void setMainWindowGeometry(const QByteArray &newMainWindowGeometry); - bool bottomPanelOpenned() const; - void setBottomPanelOpenned(bool newBottomPanelOpenned); - int bottomPanelHeight() const; - void setBottomPanelHeight(int newBottomPanelHeight); int bottomPanelIndex() const; void setBottomPanelIndex(int newBottomPanelIndex); - bool leftPanelOpenned() const; - void setLeftPanelOpenned(bool newLeftPanelOpenned); - int leftPanelWidth() const; - void setLeftPanelWidth(int newLeftPanelWidth); int leftPanelIndex() const; void setLeftPanelIndex(int newLeftPanelIndex); @@ -1036,11 +1029,7 @@ public: private: QByteArray mMainWindowState; QByteArray mMainWindowGeometry; - bool mBottomPanelOpenned; - int mBottomPanelHeight; int mBottomPanelIndex; - bool mLeftPanelOpenned; - int mLeftPanelWidth; int mLeftPanelIndex; bool mClassBrowserSortAlpha; bool mClassBrowserSortType; @@ -1348,6 +1337,7 @@ public: Settings& operator= (const Settings&& settings) = delete; void beginGroup(const QString& group); void endGroup(); + void remove(const QString &key); void saveValue(const QString& group, const QString &key, const QVariant &value); void saveValue(const QString &key, const QVariant &value); QVariant value(const QString& group, const QString &key, const QVariant& defaultValue); diff --git a/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui b/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui index d2cd8e2b..7b69f1d5 100644 --- a/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui +++ b/RedPandaIDE/settingsdialog/executorproblemsetwidget.ui @@ -87,13 +87,16 @@
- Sec + ms - 1 + 100 - 10000 + 1000000 + + + 50
diff --git a/RedPandaIDE/widgets/choosethemedialog.cpp b/RedPandaIDE/widgets/choosethemedialog.cpp index 8471c1d4..ceadd908 100644 --- a/RedPandaIDE/widgets/choosethemedialog.cpp +++ b/RedPandaIDE/widgets/choosethemedialog.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "choosethemedialog.h" #include "ui_choosethemedialog.h" diff --git a/RedPandaIDE/widgets/choosethemedialog.h b/RedPandaIDE/widgets/choosethemedialog.h index a4c905f9..1270b02c 100644 --- a/RedPandaIDE/widgets/choosethemedialog.h +++ b/RedPandaIDE/widgets/choosethemedialog.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef CHOOSETHEMEDIALOG_H #define CHOOSETHEMEDIALOG_H diff --git a/RedPandaIDE/widgets/compileargumentswidget.cpp b/RedPandaIDE/widgets/compileargumentswidget.cpp index 53cf74f6..e947208c 100644 --- a/RedPandaIDE/widgets/compileargumentswidget.cpp +++ b/RedPandaIDE/widgets/compileargumentswidget.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "compileargumentswidget.h" #include diff --git a/RedPandaIDE/widgets/compileargumentswidget.h b/RedPandaIDE/widgets/compileargumentswidget.h index edc833c2..b85ed8e5 100644 --- a/RedPandaIDE/widgets/compileargumentswidget.h +++ b/RedPandaIDE/widgets/compileargumentswidget.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef COMPILEARGUMENTSWIDGET_H #define COMPILEARGUMENTSWIDGET_H diff --git a/RedPandaIDE/widgets/customdisablediconengine.cpp b/RedPandaIDE/widgets/customdisablediconengine.cpp index 88e85ccc..2c3d8f47 100644 --- a/RedPandaIDE/widgets/customdisablediconengine.cpp +++ b/RedPandaIDE/widgets/customdisablediconengine.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "customdisablediconengine.h" #include @@ -10,7 +26,7 @@ CustomDisabledIconEngine::CustomDisabledIconEngine() } -void CustomDisabledIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) +void CustomDisabledIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State /*state*/) { painter->save(); painter->setClipRect(rect); @@ -40,7 +56,7 @@ QIconEngine *CustomDisabledIconEngine::clone() const return eng; } -QPixmap CustomDisabledIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) +QPixmap CustomDisabledIconEngine::pixmap(const QSize &/*size*/, QIcon::Mode mode, QIcon::State /*state*/) { if (mode == QIcon::Mode::Disabled) return mDisabledPixmap; @@ -48,12 +64,12 @@ QPixmap CustomDisabledIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QI return mPixmap; } -void CustomDisabledIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state) +void CustomDisabledIconEngine::addPixmap(const QPixmap &pixmap, QIcon::Mode /*mode*/, QIcon::State /*state*/) { setPixmap(pixmap); } -void CustomDisabledIconEngine::addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state) +void CustomDisabledIconEngine::addFile(const QString &fileName, const QSize &/*size*/, QIcon::Mode /*mode*/, QIcon::State /*state*/) { setPixmap(QPixmap(fileName)); } diff --git a/RedPandaIDE/widgets/customdisablediconengine.h b/RedPandaIDE/widgets/customdisablediconengine.h index d56dbb82..bc19dda4 100644 --- a/RedPandaIDE/widgets/customdisablediconengine.h +++ b/RedPandaIDE/widgets/customdisablediconengine.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef CUSTOMDISABLEDICONENGINE_H #define CUSTOMDISABLEDICONENGINE_H diff --git a/RedPandaIDE/widgets/customfilesystemmodel.cpp b/RedPandaIDE/widgets/customfilesystemmodel.cpp index 6bf3e517..8d96e058 100644 --- a/RedPandaIDE/widgets/customfilesystemmodel.cpp +++ b/RedPandaIDE/widgets/customfilesystemmodel.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "customfilesystemmodel.h" #include "../vcs/gitmanager.h" #include "../vcs/gitrepository.h" diff --git a/RedPandaIDE/widgets/customfilesystemmodel.h b/RedPandaIDE/widgets/customfilesystemmodel.h index a87730ed..67c1aae9 100644 --- a/RedPandaIDE/widgets/customfilesystemmodel.h +++ b/RedPandaIDE/widgets/customfilesystemmodel.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef CUSTOMFILESYSTEMMODEL_H #define CUSTOMFILESYSTEMMODEL_H diff --git a/RedPandaIDE/widgets/infomessagebox.cpp b/RedPandaIDE/widgets/infomessagebox.cpp index d8dbfc30..168883a8 100644 --- a/RedPandaIDE/widgets/infomessagebox.cpp +++ b/RedPandaIDE/widgets/infomessagebox.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "infomessagebox.h" #include "ui_infomessagebox.h" diff --git a/RedPandaIDE/widgets/infomessagebox.h b/RedPandaIDE/widgets/infomessagebox.h index 57c5aeb4..4242537f 100644 --- a/RedPandaIDE/widgets/infomessagebox.h +++ b/RedPandaIDE/widgets/infomessagebox.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef INFOMESSAGEBOX_H #define INFOMESSAGEBOX_H diff --git a/RedPandaIDE/widgets/linenumbertexteditor.cpp b/RedPandaIDE/widgets/linenumbertexteditor.cpp index 6d6db9f2..b0ae20f0 100644 --- a/RedPandaIDE/widgets/linenumbertexteditor.cpp +++ b/RedPandaIDE/widgets/linenumbertexteditor.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "linenumbertexteditor.h" #include diff --git a/RedPandaIDE/widgets/linenumbertexteditor.h b/RedPandaIDE/widgets/linenumbertexteditor.h index 2ed08327..ce949292 100644 --- a/RedPandaIDE/widgets/linenumbertexteditor.h +++ b/RedPandaIDE/widgets/linenumbertexteditor.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef LINENUMBERTEXTEDITOR_H #define LINENUMBERTEXTEDITOR_H diff --git a/RedPandaIDE/widgets/newclassdialog.cpp b/RedPandaIDE/widgets/newclassdialog.cpp index bf936a3b..a9e17575 100644 --- a/RedPandaIDE/widgets/newclassdialog.cpp +++ b/RedPandaIDE/widgets/newclassdialog.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "newclassdialog.h" #include "ui_newclassdialog.h" #include "../iconsmanager.h" diff --git a/RedPandaIDE/widgets/newclassdialog.h b/RedPandaIDE/widgets/newclassdialog.h index 37e43729..6b14110b 100644 --- a/RedPandaIDE/widgets/newclassdialog.h +++ b/RedPandaIDE/widgets/newclassdialog.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef NEWCLASSDIALOG_H #define NEWCLASSDIALOG_H diff --git a/RedPandaIDE/widgets/newheaderdialog.cpp b/RedPandaIDE/widgets/newheaderdialog.cpp index 7b042af2..c57235dc 100644 --- a/RedPandaIDE/widgets/newheaderdialog.cpp +++ b/RedPandaIDE/widgets/newheaderdialog.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "newheaderdialog.h" #include "ui_newheaderdialog.h" #include "../iconsmanager.h" diff --git a/RedPandaIDE/widgets/newheaderdialog.h b/RedPandaIDE/widgets/newheaderdialog.h index 640fdc62..4ebd4e80 100644 --- a/RedPandaIDE/widgets/newheaderdialog.h +++ b/RedPandaIDE/widgets/newheaderdialog.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef NEWHEADERDIALOG_H #define NEWHEADERDIALOG_H diff --git a/RedPandaIDE/widgets/newprojectunitdialog.cpp b/RedPandaIDE/widgets/newprojectunitdialog.cpp index d0cc3e7a..39dbafd9 100644 --- a/RedPandaIDE/widgets/newprojectunitdialog.cpp +++ b/RedPandaIDE/widgets/newprojectunitdialog.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "newprojectunitdialog.h" #include "ui_newprojectunitdialog.h" #include "../iconsmanager.h" diff --git a/RedPandaIDE/widgets/newprojectunitdialog.h b/RedPandaIDE/widgets/newprojectunitdialog.h index 67f8ca16..8b326963 100644 --- a/RedPandaIDE/widgets/newprojectunitdialog.h +++ b/RedPandaIDE/widgets/newprojectunitdialog.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef NEWPROJECTUNITDIALOG_H #define NEWPROJECTUNITDIALOG_H diff --git a/RedPandaIDE/widgets/ojproblemsetmodel.cpp b/RedPandaIDE/widgets/ojproblemsetmodel.cpp index a59464c1..6316eafa 100644 --- a/RedPandaIDE/widgets/ojproblemsetmodel.cpp +++ b/RedPandaIDE/widgets/ojproblemsetmodel.cpp @@ -408,7 +408,7 @@ QVariant OJProblemModel::data(const QModelIndex &index, int role) const POJProblemCase problemCase = mProblem->cases[index.row()]; if (problemCase->testState == ProblemCaseTestState::Passed || problemCase->testState == ProblemCaseTestState::Failed) - return problemCase->runningTime/1000.0; + return problemCase->runningTime; else return ""; } @@ -456,7 +456,7 @@ QVariant OJProblemModel::headerData(int section, Qt::Orientation orientation, in case 0: return tr("Name"); case 1: - return tr("Time(sec)"); + return tr("Time(ms)"); } } return QVariant(); diff --git a/RedPandaIDE/widgets/shortcutinputedit.cpp b/RedPandaIDE/widgets/shortcutinputedit.cpp index 9c884a53..e7a594d3 100644 --- a/RedPandaIDE/widgets/shortcutinputedit.cpp +++ b/RedPandaIDE/widgets/shortcutinputedit.cpp @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #include "shortcutinputedit.h" #include diff --git a/RedPandaIDE/widgets/shortcutinputedit.h b/RedPandaIDE/widgets/shortcutinputedit.h index 460e18b8..52eeca4e 100644 --- a/RedPandaIDE/widgets/shortcutinputedit.h +++ b/RedPandaIDE/widgets/shortcutinputedit.h @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ #ifndef SHORTCUTINPUTEDIT_H #define SHORTCUTINPUTEDIT_H diff --git a/RedPandaIDE/widgets/shrinkabletabwidget.cpp b/RedPandaIDE/widgets/shrinkabletabwidget.cpp new file mode 100644 index 00000000..24a81eb3 --- /dev/null +++ b/RedPandaIDE/widgets/shrinkabletabwidget.cpp @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) + * + * 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 3 of the License, or + * (at your option) any later version. + * + * 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, see . + */ +#include "shrinkabletabwidget.h" +#include +#include + +ShrinkableTabWidget::ShrinkableTabWidget(QWidget *parent):QTabWidget(parent), + mShrinked(false) +{ + +} + +void ShrinkableTabWidget::setShrinked(bool shrinked) +{ + if (!mShrinked) { + mBeforeShrinkSize = size(); + } + mShrinked = shrinked; + switch(this->tabPosition()) { + case QTabWidget::East: + case QTabWidget::West: + if (mShrinked) { + this->setFixedWidth(tabBar()->width()); + } else { + this->setMaximumWidth(QWIDGETSIZE_MAX); + } + break; + case QTabWidget::North: + case QTabWidget::South: + if (mShrinked) { + this->setFixedHeight(tabBar()->height()); + } else { + this->setMaximumHeight(QWIDGETSIZE_MAX); + } + } +} + +void ShrinkableTabWidget::toggleShrined() +{ + setShrinked(!mShrinked); +} + +QSize ShrinkableTabWidget::sizeHint() const +{ + return QTabWidget::sizeHint(); +} + +QSize ShrinkableTabWidget::minimumSizeHint() const +{ + QSize size=QTabWidget::minimumSizeHint(); + switch(this->tabPosition()) { + case QTabWidget::East: + case QTabWidget::West: + size.setWidth(tabBar()->width()); + break; + case QTabWidget::North: + case QTabWidget::South: + size.setHeight(tabBar()->height()); + } +// qDebug()<<"min size hint()"<. + */ +#ifndef SHRINKABLETABWIDGET_H +#define SHRINKABLETABWIDGET_H + +#include + +class ShrinkableTabWidget : public QTabWidget +{ + Q_OBJECT +public: + ShrinkableTabWidget(QWidget* parent=nullptr); + + void setShrinked(bool shrinked); + void toggleShrined(); + + // QWidget interface +public: + QSize sizeHint() const; + QSize minimumSizeHint() const; +private: + bool mShrinked; + QSize mBeforeShrinkSize; +}; + +#endif // SHRINKABLETABWIDGET_H