Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement multi-tab feature in TabManager class #2955

Open
wants to merge 35 commits into
base: master
from
Open
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7502652
Implement multi-tab feature in TabManager class
RomitKumar May 26, 2019
8086470
Integrate support for legacy and scintilla editor along
RomitKumar May 28, 2019
c9b76a7
Implement pre-available editing features for each tab
RomitKumar May 28, 2019
cfa32da
remove support for legacy editor
RomitKumar May 29, 2019
1ad0f53
corrected keyboard shortcut for zoom-in and zoom-out
RomitKumar May 29, 2019
a60542f
undoState and windowModified updates for each tab
RomitKumar May 30, 2019
0b1427d
Correct stl export and parameterWidget enable state behaviour
RomitKumar Jun 1, 2019
a2a0da5
update to enable Scintilla Editor in travis check
RomitKumar Jun 1, 2019
cb2d2d6
Customizer widget disables on changing tab
RomitKumar Jun 1, 2019
b7e4d80
animation stops on changing tab
RomitKumar Jun 1, 2019
6bc13c5
remove commented lines
RomitKumar Jun 1, 2019
23129ba
Extended Find, Find and Replace behaviour for multi-tab
RomitKumar Jun 4, 2019
d594980
Removed support for single file QScintilla Editor
RomitKumar Jun 6, 2019
396d75b
Add the feature of New Tab
RomitKumar Jun 9, 2019
ee26a80
Correct the new tab implementation
RomitKumar Jun 9, 2019
486562d
Implement open file in new tab
RomitKumar Jun 9, 2019
232844b
Recent file and examples open in new tab
RomitKumar Jun 9, 2019
0ea2735
Handle file drop for multi-tab
RomitKumar Jun 9, 2019
c73a63a
Implement close confirmation dialog for unsaved tab and window
RomitKumar Jun 9, 2019
6a0a1d1
Changed behaviour of option in file menu
RomitKumar Jun 11, 2019
e3ff4d9
Corrected open behaviour for file drops
RomitKumar Jun 11, 2019
0e92308
Code cleanup, renaming of function and variable names
RomitKumar Jun 13, 2019
cdaee5e
Cleanup of Code
RomitKumar Jun 13, 2019
b0c95e8
Implement the feature of Save All
RomitKumar Jun 14, 2019
35e3fe0
Parameter Widget enabled on file load
RomitKumar Jun 14, 2019
acc3123
Recent File and example open in empty tab
RomitKumar Jun 14, 2019
087359f
Tab Header spans whole width of screen
RomitKumar Jun 16, 2019
c59df44
Update openscad.pro file
RomitKumar Jun 16, 2019
fd93e57
Add Tab Header in ToolBar
RomitKumar Jun 17, 2019
a50fd61
Corrected the opening of tab in toolbar
RomitKumar Jun 17, 2019
689292c
Undocked editor contains tab header toolbar
RomitKumar Jun 17, 2019
dff9b9b
Tab tool bar hidden for single tab
RomitKumar Jun 21, 2019
12c605f
Corrected implementation of opening of file in empty editor tab
RomitKumar Jul 13, 2019
30085ff
Corrected interpretation of ampersand in file name
RomitKumar Jul 13, 2019
a99d689
Merge branch 'master' into multi-tab
RomitKumar Jul 14, 2019
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Removed support for single file QScintilla Editor

The application now has only multi-tab QScintilla Editor. When single tab is present, the tabs are not visible, effectively giving the feeling of single-tab editor.
  • Loading branch information...
RomitKumar committed Jun 6, 2019
commit d594980fb192da2871dcc1c442ac521624d54b19
@@ -125,7 +125,6 @@ void Preferences::init() {
this->defaultmap["editor/fontfamily"] = found_family;
this->defaultmap["editor/fontsize"] = 12;
this->defaultmap["editor/syntaxhighlight"] = "For Light Background";
this->defaultmap[Preferences::PREF_EDITOR_TYPE] = Preferences::EDITOR_TYPE_QSCINTILLA;

#if defined (Q_OS_MAC)
this->defaultmap["editor/ctrlmousewheelzoom"] = false;
@@ -390,12 +389,6 @@ void Preferences::on_fontSize_currentIndexChanged(const QString &size)
emit fontChanged(getValue("editor/fontfamily").toString(), intsize);
}

void Preferences::on_editorType_currentIndexChanged(int idx)
{
QSettingsCached settings;
settings.setValue(Preferences::PREF_EDITOR_TYPE, idx == 0 ? Preferences::EDITOR_TYPE_QSCINTILLA : Preferences::EDITOR_TYPE_MULTITAB);
}

void Preferences::on_syntaxHighlight_activated(const QString &s)
{
QSettingsCached settings;
@@ -880,10 +873,6 @@ void Preferences::updateGUI()
}
}

QString editortypevar = getValue(Preferences::PREF_EDITOR_TYPE).toString();
int edidx = editortypevar == Preferences::EDITOR_TYPE_QSCINTILLA ? 0 : 1;
this->editorType->setCurrentIndex(edidx);

this->mouseWheelZoomBox->setChecked(getValue("editor/ctrlmousewheelzoom").toBool());

if (AutoUpdater *updater = AutoUpdater::updater()) {
@@ -12,11 +12,6 @@ class Preferences : public QMainWindow, public Ui::Preferences
Q_OBJECT;

public:
static constexpr const char* PREF_EDITOR_TYPE = "editor/editortype";

static constexpr const char* EDITOR_TYPE_QSCINTILLA = "QScintilla Editor";
static constexpr const char* EDITOR_TYPE_MULTITAB = "Multi-Tab Editor";

~Preferences();

static void create(QStringList colorSchemes);
@@ -52,7 +47,6 @@ public slots:
void on_undockCheckBox_toggled(bool);
void on_checkNowButton_clicked();
void on_launcherBox_toggled(bool);
void on_editorType_currentIndexChanged(int);
void on_enableSoundOnRenderCompleteCheckBox_toggled(bool);
void on_enableHardwarningsCheckBox_toggled(bool);
void on_enableParameterCheckBox_toggled(bool);
@@ -108,7 +102,6 @@ public slots:
void colorSchemeChanged(const QString &scheme) const;
void openCSGSettingsChanged() const;
void syntaxHighlightChanged(const QString &s) const;
void editorTypeChanged(const QString &type);
void editorConfigChanged() const;
void ExperimentalChanged() const ;
void updateMouseCentricZoom(bool state) const;
@@ -144,81 +144,6 @@
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout_9">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_27">
<item>
<spacer name="horizontalSpacer_28">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_12">
<property name="text">
<string>Editor Type</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="editorType">
<item>
<property name="text">
<string>QScintilla Editor</string>
</property>
</item>
<item>
<property name="text">
<string>Multi-Tab Editor</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QLabel" name="label_13">
<property name="font">
<font>
<pointsize>10</pointsize>
<weight>50</weight>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>(requires restart)</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>30</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_28">
<item>
<spacer name="horizontalSpacer_29">
@@ -248,7 +173,7 @@
</item>
</layout>
</item>
<item row="1" column="1">
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QFontComboBox" name="fontChooser">
@@ -282,7 +207,7 @@
</item>
</layout>
</item>
<item row="2" column="0">
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_29">
<item>
<spacer name="horizontalSpacer_30">
@@ -309,7 +234,7 @@
</item>
</layout>
</item>
<item row="3" column="0">
<item row="2" column="0">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -322,14 +247,14 @@
</property>
</spacer>
</item>
<item row="3" column="1">
<item row="2" column="1">
<widget class="QCheckBox" name="mouseWheelZoomBox">
<property name="text">
<string>Ctrl/Cmd-Mouse-wheel zooms text</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_26">
<item>
<widget class="QComboBox" name="syntaxHighlight">
@@ -198,17 +198,13 @@ MainWindow::MainWindow(const QString &filename)
updateStatusBar(nullptr);

tabManager = new TabManager(this);
editorDockContents->layout()->addWidget(tabManager->getTabObj());

connect(Preferences::inst()->ButtonConfig, SIGNAL(inputMappingChanged()), InputDriverManager::instance(), SLOT(onInputMappingUpdated()), Qt::UniqueConnection);
connect(Preferences::inst()->AxisConfig, SIGNAL(inputMappingChanged()), InputDriverManager::instance(), SLOT(onInputMappingUpdated()), Qt::UniqueConnection);
connect(Preferences::inst()->AxisConfig, SIGNAL(inputCalibrationChanged()), InputDriverManager::instance(), SLOT(onInputCalibrationUpdated()), Qt::UniqueConnection);
connect(Preferences::inst()->AxisConfig, SIGNAL(inputGainChanged()), InputDriverManager::instance(), SLOT(onInputGainUpdated()), Qt::UniqueConnection);

if(tabManager->useMultitab)
editorDockContents->layout()->addWidget(tabManager->getTabObj());
else
editorDockContents->layout()->addWidget(tabManager->editor);

setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
@@ -13,27 +13,17 @@ TabManager::TabManager(MainWindow *o)
{
par = o;

QSettingsCached settings;
editortype = settings.value(Preferences::PREF_EDITOR_TYPE).toString();
useMultitab = (editortype == Preferences::EDITOR_TYPE_MULTITAB);
par->fileActionNewTab->setEnabled(useMultitab);

if(useMultitab)
{
tabobj = new QTabWidget();
tabobj->setTabsClosable(true);
tabobj->setMovable(true);
connect(tabobj, SIGNAL(currentChanged(int)), this, SLOT(curChanged(int)));
connect(tabobj, SIGNAL(tabCloseRequested(int)), this, SLOT(closeRequested(int)));
}
tabobj = new QTabWidget();
tabobj->setTabsClosable(true);
tabobj->setMovable(true);
tabobj->setTabBarAutoHide(true);
connect(tabobj, SIGNAL(currentChanged(int)), this, SLOT(curChanged(int)));
connect(tabobj, SIGNAL(tabCloseRequested(int)), this, SLOT(closeRequested(int)));

createTab();

if(useMultitab)
{
connect(tabobj, SIGNAL(currentChanged(int)), this, SLOT(stopAnimation()));
connect(tabobj, SIGNAL(currentChanged(int)), this, SLOT(updateFindState()));
}
connect(tabobj, SIGNAL(currentChanged(int)), this, SLOT(stopAnimation()));
connect(tabobj, SIGNAL(currentChanged(int)), this, SLOT(updateFindState()));

connect(par, SIGNAL(highlightError(int)), this, SLOT(highlightError(int)));
connect(par, SIGNAL(unhighlightLastError()), this, SLOT(unhighlightLastError()));
@@ -91,10 +81,7 @@ void TabManager::createTab()
{
assert(par != nullptr);

if(useMultitab)
editor = new ScintillaEditor(tabobj);
else
editor = new ScintillaEditor(par->editorDockContents);
editor = new ScintillaEditor(tabobj);

// clearing default mapping of keyboard shortcut for font size
QsciCommandSet *qcmdset = ((ScintillaEditor *)editor)->qsci->standardCommands();
@@ -124,11 +111,8 @@ void TabManager::createTab()
editor->initFont(Preferences::inst()->getValue("editor/fontfamily").toString(), Preferences::inst()->getValue("editor/fontsize").toUInt());
editor->setHighlightScheme(Preferences::inst()->getValue("editor/syntaxhighlight").toString());

if(useMultitab)
{
tabobj->addTab(editor, "tab");
tabobj->setCurrentWidget(editor);
}
tabobj->addTab(editor, "tab");
tabobj->setCurrentWidget(editor);
}

void TabManager::curContent()
@@ -13,8 +13,6 @@ class TabManager: public QObject
public:
TabManager(MainWindow *);
QTabWidget *getTabObj();
QString editortype;
bool useMultitab;
EditorInterface *editor;

public:
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.