Skip to content

Commit 6e80eb6

Browse files
committed
Plugin: modify set plugins paths
1 parent a2512f9 commit 6e80eb6

File tree

7 files changed

+45
-9
lines changed

7 files changed

+45
-9
lines changed

App/Client/ParameterDlgSettings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ CParameterDlgSettings::CParameterDlgSettings(CParameterApp *pPara,
3535
}
3636
bool bScroll = false;
3737
QScreen* pScreen = QApplication::primaryScreen();
38-
QSize size = pScreen->availableGeometry().size();
39-
if(nWidth > size.width() * 3 / 4 || nHeigth > size.height() * 3 / 4)
38+
QSize size = this->size();
39+
if(nWidth > size.width() || nHeigth > size.height())
4040
bScroll = true;
4141
// [connect accepted to slotAccept of widget]
4242
foreach(auto p, wViewer)

Src/FrmManagePlugins.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ CFrmManagePlugins::CFrmManagePlugins(QWidget *parent) : CParameterUI(parent)
5454
int CFrmManagePlugins::SetParameter(CParameter *pParameter)
5555
{
5656
m_pPara = qobject_cast<CParameterPlugin*>(pParameter);
57+
ui->gbPluginsPath->setChecked(m_pPara->GetEnableSetPluginsPath());
5758
foreach(auto szPath, m_pPara->GetPluginsPath()) {
5859
auto pPath = new QStandardItem(szPath);
5960
m_pModelPluginPath->appendRow(pPath);
@@ -77,6 +78,7 @@ int CFrmManagePlugins::SetParameter(CParameter *pParameter)
7778
int CFrmManagePlugins::Accept()
7879
{
7980
QStringList lstPath;
81+
m_pPara->SetEnableSetPluginsPath(ui->gbPluginsPath->isChecked());
8082
for(int i = 0; i < m_pModelPluginPath->rowCount(); i++) {
8183
lstPath << m_pModelPluginPath->item(i)->text();
8284
}

Src/FrmManagePlugins.ui

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>600</width>
10-
<height>450</height>
9+
<width>550</width>
10+
<height>400</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">
@@ -25,7 +25,7 @@
2525
</widget>
2626
</item>
2727
<item row="0" column="0">
28-
<widget class="QGroupBox" name="groupBox">
28+
<widget class="QGroupBox" name="gbPluginsPath">
2929
<property name="sizePolicy">
3030
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
3131
<horstretch>0</horstretch>
@@ -35,6 +35,12 @@
3535
<property name="title">
3636
<string>Plugins path:</string>
3737
</property>
38+
<property name="checkable">
39+
<bool>true</bool>
40+
</property>
41+
<property name="checked">
42+
<bool>false</bool>
43+
</property>
3844
<layout class="QGridLayout" name="gridLayout_2">
3945
<item row="0" column="0">
4046
<widget class="QListView" name="lvPluginsPath">

Src/Manager.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,15 @@ int CManager::LoadPlugins()
168168
}
169169
}//*/
170170

171-
if(m_pParameter->GetPluginsPath().isEmpty())
171+
QStringList lstPaths;
172+
if(m_pParameter->GetEnableSetPluginsPath()) {
173+
lstPaths = m_pParameter->GetPluginsPath();
174+
}
175+
else
176+
lstPaths << RabbitCommon::CDir::Instance()->GetDirPlugins();
177+
if(lstPaths.isEmpty())
172178
qWarning(log) << "The plugins path is empty. please set it from: `Menu` -> `Tools` -> `Settings` -> `Load Plugins`";
173-
foreach (auto szPath, m_pParameter->GetPluginsPath()) {
179+
foreach (auto szPath, lstPaths) {
174180
//QString szPath = RabbitCommon::CDir::Instance()->GetDirPlugins();
175181

176182
QStringList filters;

Src/ParameterCompone/ParameterPlugin.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ CParameterPlugin::CParameterPlugin(QObject *parent)
1919
, m_bShowProtocolPrefix(false)
2020
, m_bShowIpPortInName(false)
2121
, m_AdaptWindows(CFrmViewer::ADAPT_WINDOWS::KeepAspectRationToWindow)
22+
, m_bEnableSetPluginsPath(false)
2223
, m_szPluginsPath(RabbitCommon::CDir::Instance()->GetDirPlugins())
2324
, m_WhiteList(this, "Whilelist")
2425
, m_BlackList(this, "BlackList")
@@ -64,6 +65,7 @@ int CParameterPlugin::OnLoad(QSettings &set)
6465
SetAdaptWindows((CFrmViewer::ADAPT_WINDOWS)set.value("Viewer/AdaptWindows",
6566
(int)GetAdaptWindows()).toInt());
6667
SetPluginsPath(set.value("PluginsPath", GetPluginsPath()).toStringList());
68+
SetEnableSetPluginsPath(set.value("PluginsPath/Enable", GetEnableSetPluginsPath()).toBool());
6769
set.endGroup();
6870
return 0;
6971
}
@@ -86,6 +88,7 @@ int CParameterPlugin::OnSave(QSettings& set)
8688
set.setValue("Connecter/Name/ShowIpPort", GetShowIpPortInName());
8789
set.setValue("Viewer/AdaptWindows", (int)GetAdaptWindows());
8890
set.setValue("PluginsPath", GetPluginsPath());
91+
set.setValue("PluginsPath/Enable", GetEnableSetPluginsPath());
8992
set.endGroup();
9093
return 0;
9194
}
@@ -308,6 +311,19 @@ void CParameterPlugin::SetAdaptWindows(CFrmViewer::ADAPT_WINDOWS aw)
308311
emit sigAdaptWindowsChanged();
309312
}
310313

314+
bool CParameterPlugin::GetEnableSetPluginsPath() const
315+
{
316+
return m_bEnableSetPluginsPath;
317+
}
318+
319+
void CParameterPlugin::SetEnableSetPluginsPath(bool newEnableSetPluginsPath)
320+
{
321+
if(m_bEnableSetPluginsPath == newEnableSetPluginsPath)
322+
return;
323+
m_bEnableSetPluginsPath = newEnableSetPluginsPath;
324+
SetModified(true);
325+
}
326+
311327
QStringList CParameterPlugin::GetPluginsPath() const
312328
{
313329
return m_szPluginsPath;

Src/ParameterCompone/ParameterPlugin.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ class PLUGIN_EXPORT CParameterPlugin : public CParameter
180180
CFrmViewer::ADAPT_WINDOWS m_AdaptWindows;
181181
Q_PROPERTY(CFrmViewer::ADAPT_WINDOWS AdaptWindows READ GetAdaptWindows WRITE SetAdaptWindows NOTIFY sigAdaptWindowsChanged)
182182

183+
public:
184+
bool GetEnableSetPluginsPath() const;
185+
void SetEnableSetPluginsPath(bool newEnableSetPluginsPath);
186+
private:
187+
bool m_bEnableSetPluginsPath;
188+
183189
public:
184190
QStringList GetPluginsPath() const;
185191
void SetPluginsPath(const QStringList &newPluginsPath);

Src/ParameterCompone/ParameterRecordUI.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>471</width>
10-
<height>383</height>
9+
<width>550</width>
10+
<height>400</height>
1111
</rect>
1212
</property>
1313
<property name="windowTitle">

0 commit comments

Comments
 (0)