ENH: Re-arrange UI a bit.
BUG: Properly update when values that changed since the last configure.
This commit is contained in:
parent
34c882a9f8
commit
5a539b731b
|
@ -1,5 +1,6 @@
|
|||
<RCC>
|
||||
<qresource prefix="/Icons" >
|
||||
<file>CMakeSetup.png</file>
|
||||
<file>Delete16.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -83,6 +83,8 @@ CMakeSetupDialog::CMakeSetupDialog()
|
|||
this->ProgressBar->reset();
|
||||
this->InterruptButton->setIcon(
|
||||
this->style()->standardPixmap(QStyle::SP_DialogCancelButton));
|
||||
this->InterruptButton->setEnabled(false);
|
||||
this->RemoveEntry->setEnabled(false);
|
||||
|
||||
QMenu* FileMenu = this->menuBar()->addMenu(tr("&File"));
|
||||
this->ReloadCacheAction = FileMenu->addAction(tr("&Reload Cache"));
|
||||
|
@ -190,13 +192,15 @@ void CMakeSetupDialog::initialize()
|
|||
this, SLOT(updateGeneratorLabel(QString)));
|
||||
this->updateGeneratorLabel(QString());
|
||||
|
||||
QObject::connect(this->DeleteCacheButton, SIGNAL(clicked(bool)),
|
||||
this, SLOT(doDeleteCache()));
|
||||
|
||||
QObject::connect(this->CacheValues->cacheModel(),
|
||||
SIGNAL(dataChanged(QModelIndex,QModelIndex)),
|
||||
this, SLOT(setCacheModified()));
|
||||
|
||||
|
||||
QObject::connect(this->CacheValues->selectionModel(),
|
||||
SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(selectionChanged()));
|
||||
QObject::connect(this->RemoveEntry, SIGNAL(clicked(bool)),
|
||||
this, SLOT(removeSelectedCacheEntries()));
|
||||
|
||||
// get the saved binary directories
|
||||
QStringList buildPaths = this->loadBuildPaths();
|
||||
|
@ -457,9 +461,9 @@ void CMakeSetupDialog::setEnabledState(bool enabled)
|
|||
this->ConfigureButton->setEnabled(enabled);
|
||||
this->ReloadCacheAction->setEnabled(enabled);
|
||||
this->DeleteCacheAction->setEnabled(enabled);
|
||||
this->DeleteCacheButton->setEnabled(enabled);
|
||||
this->ExitAction->setEnabled(enabled);
|
||||
this->ConfigureAction->setEnabled(enabled);
|
||||
this->RemoveEntry->setEnabled(false); // let selection re-enable it
|
||||
// generate button/action are handled separately
|
||||
}
|
||||
|
||||
|
@ -671,4 +675,30 @@ void CMakeSetupDialog::setCacheModified()
|
|||
this->setGenerateEnabled(false);
|
||||
}
|
||||
|
||||
void CMakeSetupDialog::removeSelectedCacheEntries()
|
||||
{
|
||||
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
|
||||
QList<QPersistentModelIndex> pidxs;
|
||||
foreach(QModelIndex i, idxs)
|
||||
{
|
||||
pidxs.append(i);
|
||||
}
|
||||
foreach(QPersistentModelIndex pi, pidxs)
|
||||
{
|
||||
this->CacheValues->model()->removeRow(pi.row());
|
||||
}
|
||||
}
|
||||
|
||||
void CMakeSetupDialog::selectionChanged()
|
||||
{
|
||||
QModelIndexList idxs = this->CacheValues->selectionModel()->selectedRows();
|
||||
if(idxs.count() && !this->InterruptButton->isEnabled())
|
||||
{
|
||||
this->RemoveEntry->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->RemoveEntry->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -68,6 +68,8 @@ protected slots:
|
|||
void onBinaryDirectoryChanged(const QString& dir);
|
||||
void onSourceDirectoryChanged(const QString& dir);
|
||||
void setCacheModified();
|
||||
void removeSelectedCacheEntries();
|
||||
void selectionChanged();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent*);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>705</width>
|
||||
<height>495</height>
|
||||
<width>707</width>
|
||||
<height>582</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
|
@ -59,93 +59,186 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="Advanced" >
|
||||
<property name="text" >
|
||||
<string>Show Advanced</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Search:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="Search" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>61</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="Generator" >
|
||||
<property name="text" >
|
||||
<string>Current Generator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QSplitter" name="Splitter" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<widget class="QCMakeCacheView" name="CacheValues" >
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
<widget class="QFrame" name="frame" >
|
||||
<property name="frameShape" >
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior" >
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
<property name="frameShadow" >
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0" colspan="6" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Search:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="Search" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="Advanced" >
|
||||
<property name="text" >
|
||||
<string>Show Advanced Entries</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>61</width>
|
||||
<height>23</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="RemoveEntry" >
|
||||
<property name="toolTip" >
|
||||
<string>Remove Selected Entries</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="CMakeSetup.qrc" >:/Icons/Delete16.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="6" >
|
||||
<widget class="QCMakeCacheView" name="CacheValues" >
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode" >
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior" >
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QPushButton" name="ConfigureButton" >
|
||||
<property name="text" >
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" >
|
||||
<widget class="QPushButton" name="GenerateButton" >
|
||||
<property name="text" >
|
||||
<string>Generate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="QLabel" name="Generator" >
|
||||
<property name="text" >
|
||||
<string>Current Generator:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="3" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>121</width>
|
||||
<height>27</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="5" >
|
||||
<widget class="QProgressBar" name="ProgressBar" >
|
||||
<property name="minimum" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textVisible" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="textDirection" >
|
||||
<enum>QProgressBar::BottomToTop</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="4" >
|
||||
<widget class="QToolButton" name="InterruptButton" >
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="6" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Press Configure to update and display new values in red, then press Generate to generate selected build files.</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="Output" >
|
||||
<property name="lineWrapMode" >
|
||||
|
@ -157,77 +250,6 @@
|
|||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" >
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QPushButton" name="ConfigureButton" >
|
||||
<property name="text" >
|
||||
<string>Configure</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="GenerateButton" >
|
||||
<property name="text" >
|
||||
<string>Generate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="DeleteCacheButton" >
|
||||
<property name="text" >
|
||||
<string>Delete Cache</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="InterruptButton" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="ProgressBar" >
|
||||
<property name="value" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textVisible" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="3" column="0" >
|
||||
<widget class="QLabel" name="label_3" >
|
||||
<property name="text" >
|
||||
<string>Right click on a cache value for additional options (delete, ignore, and help).<br>Press Configure to update and display new values in red, then press Generate to generate selected build files.</string>
|
||||
</property>
|
||||
<property name="alignment" >
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 731 B |
|
@ -26,9 +26,6 @@
|
|||
#include <QStyle>
|
||||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QDirModel>
|
||||
#include <QCompleter>
|
||||
|
||||
|
@ -79,82 +76,7 @@ QCMakeCacheModel* QCMakeCacheView::cacheModel() const
|
|||
{
|
||||
return this->CacheModel;
|
||||
}
|
||||
|
||||
void QCMakeCacheView::contextMenuEvent(QContextMenuEvent* /*e*/)
|
||||
{
|
||||
QList<QModelIndex> idxs = this->selectionModel()->selectedRows();
|
||||
|
||||
if(idxs.count())
|
||||
{
|
||||
QMenu* menu = new QMenu(this);
|
||||
QAction* deleteAction = NULL;
|
||||
QAction* ignoreAction = NULL;
|
||||
if(this->cacheModel()->editEnabled())
|
||||
{
|
||||
QString t = idxs.count() > 1 ? tr("Delete Cache Entries") :
|
||||
tr("Delete Cache Entry");
|
||||
deleteAction = menu->addAction(t);
|
||||
t = idxs.count() > 1 ? tr("Ignore Cache Entries") :
|
||||
tr("Ignore Cache Entry");
|
||||
ignoreAction = menu->addAction(t);
|
||||
}
|
||||
QAction* helpAction = menu->addAction(tr("Help For Cache Entry"));
|
||||
QAction* which = menu->exec(QCursor::pos());
|
||||
if(!which)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(which == helpAction)
|
||||
{
|
||||
QModelIndex idx = this->selectionModel()->currentIndex();
|
||||
idx = this->SearchFilter->mapToSource(idx);
|
||||
idx = this->AdvancedFilter->mapToSource(idx);
|
||||
idx = this->cacheModel()->index(idx.row(), 0);
|
||||
QString msg = this->cacheModel()->data(idx, Qt::DisplayRole).toString() +
|
||||
"\n\n" +
|
||||
this->cacheModel()->data(idx, QCMakeCacheModel::HelpRole).toString();
|
||||
QDialog dialog;
|
||||
dialog.setWindowTitle(tr("CMakeSetup Help"));
|
||||
QVBoxLayout* l = new QVBoxLayout(&dialog);
|
||||
QLabel* lab = new QLabel(&dialog);
|
||||
l->addWidget(lab);
|
||||
lab->setText(msg);
|
||||
lab->setWordWrap(true);
|
||||
QDialogButtonBox* btns = new QDialogButtonBox(QDialogButtonBox::Ok,
|
||||
Qt::Horizontal, &dialog);
|
||||
QObject::connect(btns, SIGNAL(accepted()), &dialog, SLOT(accept()));
|
||||
l->addWidget(btns);
|
||||
dialog.exec();
|
||||
}
|
||||
else
|
||||
{
|
||||
QList<QPersistentModelIndex> pidxs;
|
||||
foreach(QModelIndex i, idxs)
|
||||
{
|
||||
i = this->SearchFilter->mapToSource(i);
|
||||
i = this->AdvancedFilter->mapToSource(i);
|
||||
pidxs.append(i);
|
||||
}
|
||||
if(which == deleteAction)
|
||||
{
|
||||
foreach(QPersistentModelIndex j, pidxs)
|
||||
{
|
||||
this->cacheModel()->removeRows(j.row(), 1);
|
||||
}
|
||||
}
|
||||
else if(which == ignoreAction)
|
||||
{
|
||||
foreach(QPersistentModelIndex j, pidxs)
|
||||
{
|
||||
j = this->cacheModel()->index(j.row(), 1);
|
||||
this->cacheModel()->setData(j, "IGNORE", Qt::DisplayRole);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
|
||||
Qt::KeyboardModifiers mod)
|
||||
{
|
||||
|
@ -228,17 +150,19 @@ void QCMakeCacheModel::clear()
|
|||
void QCMakeCacheModel::setProperties(const QCMakeCachePropertyList& props)
|
||||
{
|
||||
QSet<QCMakeCacheProperty> newProps = props.toSet();
|
||||
QSet<QCMakeCacheProperty> newProps2 = props.toSet();
|
||||
QSet<QCMakeCacheProperty> oldProps = this->Properties.toSet();
|
||||
|
||||
oldProps.intersect(newProps);
|
||||
newProps.subtract(oldProps);
|
||||
newProps2.subtract(newProps);
|
||||
|
||||
this->NewCount = newProps.count();
|
||||
this->Properties.clear();
|
||||
|
||||
this->Properties = newProps.toList();
|
||||
qSort(this->Properties);
|
||||
QCMakeCachePropertyList tmp = oldProps.toList();
|
||||
QCMakeCachePropertyList tmp = newProps2.toList();
|
||||
qSort(tmp);
|
||||
this->Properties += tmp;
|
||||
|
||||
|
@ -384,17 +308,20 @@ QModelIndex QCMakeCacheModel::buddy ( const QModelIndex& idx ) const
|
|||
return idx;
|
||||
}
|
||||
|
||||
bool QCMakeCacheModel::removeRows(int row, int, const QModelIndex&)
|
||||
bool QCMakeCacheModel::removeRows(int row, int num, const QModelIndex&)
|
||||
{
|
||||
if(row < 0 || row >= this->Properties.count())
|
||||
if(row < 0 || row+num > this->Properties.count())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this->beginRemoveRows(QModelIndex(), row, row);
|
||||
this->Properties.removeAt(row);
|
||||
if(this->NewCount >= row+1)
|
||||
this->beginRemoveRows(QModelIndex(), row, row+num-1);
|
||||
for(int i=0; i<num; i++)
|
||||
{
|
||||
this->NewCount--;
|
||||
this->Properties.removeAt(row);
|
||||
if(this->NewCount >= row+1)
|
||||
{
|
||||
this->NewCount--;
|
||||
}
|
||||
}
|
||||
this->endRemoveRows();
|
||||
return true;
|
||||
|
|
|
@ -45,7 +45,6 @@ public slots:
|
|||
void setSearchFilter(const QString&);
|
||||
|
||||
protected:
|
||||
void contextMenuEvent(QContextMenuEvent* e);
|
||||
QModelIndex moveCursor(CursorAction, Qt::KeyboardModifiers);
|
||||
void showEvent(QShowEvent* e);
|
||||
bool Init;
|
||||
|
|
Loading…
Reference in New Issue