|
@@ -477,15 +477,16 @@ void DbTreeViewManager::loadDirectories(int configId, const int &userPrivilege)
|
|
obj["Separator"] = query.value("Separator").toInt();
|
|
obj["Separator"] = query.value("Separator").toInt();
|
|
obj["UserGrade"] = query.value("UserGrade").toString();
|
|
obj["UserGrade"] = query.value("UserGrade").toString();
|
|
obj["Circle"] = query.value("Circle").toInt();
|
|
obj["Circle"] = query.value("Circle").toInt();
|
|
- qDebug() << "加载目录:"<< obj["Name"].toString() << " ParentId:" << obj["ParentId"].toInt()<< " Separator:" << obj["Separator"].toInt();
|
|
|
|
- qDebug() << " Circle:" << obj["Circle"].toInt();
|
|
|
|
|
|
+ //qDebug() << "加载目录:"<< obj["Name"].toString() << " ParentId:" << obj["ParentId"].toInt()<< " Separator:" << obj["Separator"].toInt();
|
|
|
|
+ //qDebug() << " Circle:" << obj["Circle"].toInt();
|
|
|
|
|
|
// 权限判断:只有当记录的 UserGrade 中包含当前用户权限时才加入
|
|
// 权限判断:只有当记录的 UserGrade 中包含当前用户权限时才加入
|
|
bool ok;
|
|
bool ok;
|
|
- if (hasPrivilege(obj["UserGrade"].toString().toInt(&ok,16), userPrivilege))
|
|
|
|
|
|
+ if (hasPrivilege(obj["UserGrade"].toString().toInt(&ok, 16), userPrivilege)) {
|
|
directories.append(obj);
|
|
directories.append(obj);
|
|
- else
|
|
|
|
- qDebug() << "目录跳过(权限不足):" << obj["Name"].toString();
|
|
|
|
|
|
+
|
|
|
|
+ //qDebug() << "目录跳过(权限不足):" << obj["Name"].toString();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -3255,7 +3256,7 @@ void DbTreeViewManager::onButtonBackClicked()
|
|
promptSaveChanges();
|
|
promptSaveChanges();
|
|
if (m_thirdLevelFieldWnd) {
|
|
if (m_thirdLevelFieldWnd) {
|
|
// 当前在第三层目录,返回到上一层目录
|
|
// 当前在第三层目录,返回到上一层目录
|
|
- qDebug() << "当前在第三层目录,准备返回上一层。";
|
|
|
|
|
|
+ //qDebug() << "当前在第三层目录,准备返回上一层。";
|
|
for(int i=0;i<5;i++){
|
|
for(int i=0;i<5;i++){
|
|
if(currentMenuId == menuArray[i].menuId){
|
|
if(currentMenuId == menuArray[i].menuId){
|
|
menuArray[i].isthird = false;
|
|
menuArray[i].isthird = false;
|
|
@@ -3294,7 +3295,7 @@ void DbTreeViewManager::onButtonBackClicked()
|
|
}
|
|
}
|
|
|
|
|
|
if (path.isEmpty()) {
|
|
if (path.isEmpty()) {
|
|
- qWarning() << "导航路径为空,无法返回上一层。";
|
|
|
|
|
|
+ // qWarning() << "导航路径为空,无法返回上一层。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3302,14 +3303,14 @@ void DbTreeViewManager::onButtonBackClicked()
|
|
path.removeLast();
|
|
path.removeLast();
|
|
|
|
|
|
if (path.isEmpty()) {
|
|
if (path.isEmpty()) {
|
|
- qDebug() << "已经在根目录,无法返回。";
|
|
|
|
|
|
+ // qDebug() << "已经在根目录,无法返回。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// 根据新的路径查找对应的 QModelIndex
|
|
// 根据新的路径查找对应的 QModelIndex
|
|
QModelIndex parentIndex = findItemByPath(path);
|
|
QModelIndex parentIndex = findItemByPath(path);
|
|
if (!parentIndex.isValid()) {
|
|
if (!parentIndex.isValid()) {
|
|
- qWarning() << "无法找到路径对应的目录项:" << path;
|
|
|
|
|
|
+ //qWarning() << "无法找到路径对应的目录项:" << path;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3374,29 +3375,29 @@ void DbTreeViewManager::onButtonBackClicked()
|
|
}
|
|
}
|
|
|
|
|
|
// 如果不在第三层目录,则在目录树中返回上一层
|
|
// 如果不在第三层目录,则在目录树中返回上一层
|
|
- qDebug() << "当前不在第三层目录,尝试在目录树中返回上一层。";
|
|
|
|
|
|
+ // qDebug() << "当前不在第三层目录,尝试在目录树中返回上一层。";
|
|
|
|
|
|
QModelIndex currentIndex = m_pTreeViewDown->currentIndex();
|
|
QModelIndex currentIndex = m_pTreeViewDown->currentIndex();
|
|
if (!currentIndex.isValid()) {
|
|
if (!currentIndex.isValid()) {
|
|
- qWarning() << "当前没有选中的目录项,无法返回。";
|
|
|
|
|
|
+ // qWarning() << "当前没有选中的目录项,无法返回。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
QStandardItem* currentItem = m_pCModel->itemFromIndex(currentIndex);
|
|
QStandardItem* currentItem = m_pCModel->itemFromIndex(currentIndex);
|
|
if (!currentItem) {
|
|
if (!currentItem) {
|
|
- qWarning() << "当前选中的目录项无效。";
|
|
|
|
|
|
+ // qWarning() << "当前选中的目录项无效。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
QStandardItem* parentItem = currentItem->parent();
|
|
QStandardItem* parentItem = currentItem->parent();
|
|
if (!parentItem) {
|
|
if (!parentItem) {
|
|
- qDebug() << "当前已经在根目录,无法返回。";
|
|
|
|
|
|
+ // qDebug() << "当前已经在根目录,无法返回。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
QModelIndex parentIndex = m_pCModel->indexFromItem(parentItem);
|
|
QModelIndex parentIndex = m_pCModel->indexFromItem(parentItem);
|
|
if (!parentIndex.isValid()) {
|
|
if (!parentIndex.isValid()) {
|
|
- qWarning() << "父目录的 QModelIndex 无效。";
|
|
|
|
|
|
+ // qWarning() << "父目录的 QModelIndex 无效。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3484,14 +3485,14 @@ void DbTreeViewManager::onButtonDownClicked()
|
|
// 1) 收集所有 第三层 节点
|
|
// 1) 收集所有 第三层 节点
|
|
QList<QStandardItem*> thirdLevelList = collectAllThirdLevelItems();
|
|
QList<QStandardItem*> thirdLevelList = collectAllThirdLevelItems();
|
|
if (thirdLevelList.isEmpty()) {
|
|
if (thirdLevelList.isEmpty()) {
|
|
- qDebug() << "[onButtonDownClicked] 没有任何三级目录,无法遍历。";
|
|
|
|
|
|
+ //qDebug() << "[onButtonDownClicked] 没有任何三级目录,无法遍历。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// 2) 找到 当前选中的节点 在 thirdLevelList 里的索引
|
|
// 2) 找到 当前选中的节点 在 thirdLevelList 里的索引
|
|
QModelIndex curIndex = m_pTreeViewDown->currentIndex();
|
|
QModelIndex curIndex = m_pTreeViewDown->currentIndex();
|
|
if (!curIndex.isValid()) {
|
|
if (!curIndex.isValid()) {
|
|
- qDebug() << "[onButtonDownClicked] 当前没有选中节点,默认跳到第一个三级目录。";
|
|
|
|
|
|
+ // qDebug() << "[onButtonDownClicked] 当前没有选中节点,默认跳到第一个三级目录。";
|
|
// 如果想默认跳到第一个
|
|
// 如果想默认跳到第一个
|
|
QStandardItem *firstItem = thirdLevelList.first();
|
|
QStandardItem *firstItem = thirdLevelList.first();
|
|
QModelIndex idx = m_pCModel->indexFromItem(firstItem);
|
|
QModelIndex idx = m_pCModel->indexFromItem(firstItem);
|
|
@@ -3507,7 +3508,7 @@ void DbTreeViewManager::onButtonDownClicked()
|
|
|
|
|
|
QStandardItem *curItem = m_pCModel->itemFromIndex(curIndex);
|
|
QStandardItem *curItem = m_pCModel->itemFromIndex(curIndex);
|
|
if (!curItem) {
|
|
if (!curItem) {
|
|
- qWarning() << "[onButtonDownClicked] currentItem 无效。";
|
|
|
|
|
|
+ //qWarning() << "[onButtonDownClicked] currentItem 无效。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3517,7 +3518,7 @@ void DbTreeViewManager::onButtonDownClicked()
|
|
// 在 thirdLevelList 里找到 curItem
|
|
// 在 thirdLevelList 里找到 curItem
|
|
currentPos = thirdLevelList.indexOf(curItem);
|
|
currentPos = thirdLevelList.indexOf(curItem);
|
|
if (currentPos < 0) {
|
|
if (currentPos < 0) {
|
|
- qDebug() << "[onButtonDownClicked] 当前节点不是三级目录,尝试找父级是不是三级目录…";
|
|
|
|
|
|
+ //qDebug() << "[onButtonDownClicked] 当前节点不是三级目录,尝试找父级是不是三级目录…";
|
|
// 向上找父节点是否在 thirdLevelList 里
|
|
// 向上找父节点是否在 thirdLevelList 里
|
|
QStandardItem *temp = curItem->parent();
|
|
QStandardItem *temp = curItem->parent();
|
|
while (temp) {
|
|
while (temp) {
|
|
@@ -3529,7 +3530,7 @@ void DbTreeViewManager::onButtonDownClicked()
|
|
temp = temp->parent();
|
|
temp = temp->parent();
|
|
}
|
|
}
|
|
if (currentPos < 0) {
|
|
if (currentPos < 0) {
|
|
- qDebug() << "还是找不到,说明当前目录不属于任何三级目录,直接跳到第一个";
|
|
|
|
|
|
+ // qDebug() << "还是找不到,说明当前目录不属于任何三级目录,直接跳到第一个";
|
|
QStandardItem *firstItem = thirdLevelList.first();
|
|
QStandardItem *firstItem = thirdLevelList.first();
|
|
QModelIndex idx = m_pCModel->indexFromItem(firstItem);
|
|
QModelIndex idx = m_pCModel->indexFromItem(firstItem);
|
|
m_pTreeViewDown->setCurrentIndex(idx);
|
|
m_pTreeViewDown->setCurrentIndex(idx);
|
|
@@ -3546,7 +3547,7 @@ void DbTreeViewManager::onButtonDownClicked()
|
|
// 尝试下一个
|
|
// 尝试下一个
|
|
int nextPos = currentPos + 1;
|
|
int nextPos = currentPos + 1;
|
|
if (nextPos >= thirdLevelList.size()) {
|
|
if (nextPos >= thirdLevelList.size()) {
|
|
- qDebug() << "[onButtonDownClicked] 已经是最后一个三级目录了,无法再向下。";
|
|
|
|
|
|
+ //qDebug() << "[onButtonDownClicked] 已经是最后一个三级目录了,无法再向下。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3568,14 +3569,14 @@ void DbTreeViewManager::onButtonUpClicked()
|
|
// 1) 收集所有 第三层 节点
|
|
// 1) 收集所有 第三层 节点
|
|
QList<QStandardItem*> thirdLevelList = collectAllThirdLevelItems();
|
|
QList<QStandardItem*> thirdLevelList = collectAllThirdLevelItems();
|
|
if (thirdLevelList.isEmpty()) {
|
|
if (thirdLevelList.isEmpty()) {
|
|
- qDebug() << "[onButtonUpClicked] 没有任何三级目录,无法遍历。";
|
|
|
|
|
|
+ //qDebug() << "[onButtonUpClicked] 没有任何三级目录,无法遍历。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
// 2) 找到 当前选中的节点
|
|
// 2) 找到 当前选中的节点
|
|
QModelIndex curIndex = m_pTreeViewDown->currentIndex();
|
|
QModelIndex curIndex = m_pTreeViewDown->currentIndex();
|
|
if (!curIndex.isValid()) {
|
|
if (!curIndex.isValid()) {
|
|
- qDebug() << "[onButtonUpClicked] 当前无选中节点,默认跳到最后一个三级目录。";
|
|
|
|
|
|
+ // qDebug() << "[onButtonUpClicked] 当前无选中节点,默认跳到最后一个三级目录。";
|
|
// 跳到最后一个
|
|
// 跳到最后一个
|
|
QStandardItem *lastItem = thirdLevelList.last();
|
|
QStandardItem *lastItem = thirdLevelList.last();
|
|
QModelIndex idx = m_pCModel->indexFromItem(lastItem);
|
|
QModelIndex idx = m_pCModel->indexFromItem(lastItem);
|
|
@@ -3598,7 +3599,7 @@ void DbTreeViewManager::onButtonUpClicked()
|
|
// 如果当前节点不是三级目录, 向上查找
|
|
// 如果当前节点不是三级目录, 向上查找
|
|
int currentPos = thirdLevelList.indexOf(curItem);
|
|
int currentPos = thirdLevelList.indexOf(curItem);
|
|
if (currentPos < 0) {
|
|
if (currentPos < 0) {
|
|
- qDebug() << "[onButtonUpClicked] 当前节点不是三级目录,尝试找父级是不是三级目录。";
|
|
|
|
|
|
+ // qDebug() << "[onButtonUpClicked] 当前节点不是三级目录,尝试找父级是不是三级目录。";
|
|
QStandardItem *temp = curItem->parent();
|
|
QStandardItem *temp = curItem->parent();
|
|
while (temp) {
|
|
while (temp) {
|
|
int pos = thirdLevelList.indexOf(temp);
|
|
int pos = thirdLevelList.indexOf(temp);
|
|
@@ -3609,7 +3610,7 @@ void DbTreeViewManager::onButtonUpClicked()
|
|
temp = temp->parent();
|
|
temp = temp->parent();
|
|
}
|
|
}
|
|
if (currentPos < 0) {
|
|
if (currentPos < 0) {
|
|
- qDebug() << "找不到任何三级目录,直接跳到最后一个。";
|
|
|
|
|
|
+ // qDebug() << "找不到任何三级目录,直接跳到最后一个。";
|
|
QStandardItem *lastItem = thirdLevelList.last();
|
|
QStandardItem *lastItem = thirdLevelList.last();
|
|
QModelIndex idx = m_pCModel->indexFromItem(lastItem);
|
|
QModelIndex idx = m_pCModel->indexFromItem(lastItem);
|
|
m_pTreeViewDown->setCurrentIndex(idx);
|
|
m_pTreeViewDown->setCurrentIndex(idx);
|
|
@@ -3625,7 +3626,7 @@ void DbTreeViewManager::onButtonUpClicked()
|
|
// 尝试上一个
|
|
// 尝试上一个
|
|
int prevPos = currentPos - 1;
|
|
int prevPos = currentPos - 1;
|
|
if (prevPos < 0) {
|
|
if (prevPos < 0) {
|
|
- qDebug() << "[onButtonUpClicked] 已经是第一个三级目录了,无法再向上。";
|
|
|
|
|
|
+ // qDebug() << "[onButtonUpClicked] 已经是第一个三级目录了,无法再向上。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3646,7 +3647,7 @@ void DbTreeViewManager::onButtonRightClicked()
|
|
{
|
|
{
|
|
promptSaveChanges();
|
|
promptSaveChanges();
|
|
if (m_forwardStack.isEmpty()) {
|
|
if (m_forwardStack.isEmpty()) {
|
|
- qDebug() << "[Forward] 已经没有可以前进的页面";
|
|
|
|
|
|
+ //qDebug() << "[Forward] 已经没有可以前进的页面";
|
|
buttonRight->setIcon(QIcon(":/images/home_right.png"));
|
|
buttonRight->setIcon(QIcon(":/images/home_right.png"));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -3669,7 +3670,7 @@ void DbTreeViewManager::onButtonLeftClicked()
|
|
{
|
|
{
|
|
promptSaveChanges();
|
|
promptSaveChanges();
|
|
if (m_backStack.size() < 2) {
|
|
if (m_backStack.size() < 2) {
|
|
- qDebug() << "[Back] 已经无法再后退";
|
|
|
|
|
|
+ //qDebug() << "[Back] 已经无法再后退";
|
|
buttonLeft->setIcon(QIcon(":/images/home_left_hide.png"));
|
|
buttonLeft->setIcon(QIcon(":/images/home_left_hide.png"));
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -3718,13 +3719,13 @@ QModelIndex DbTreeViewManager::findItemByPath(const QStringList &path)
|
|
QStandardItem *child = currentItem->child(i);
|
|
QStandardItem *child = currentItem->child(i);
|
|
if (child == nullptr)
|
|
if (child == nullptr)
|
|
{
|
|
{
|
|
- qDebug() << "child is nullptr";
|
|
|
|
|
|
+ // qDebug() << "child is nullptr";
|
|
}
|
|
}
|
|
if (child->text() == part) {
|
|
if (child->text() == part) {
|
|
currentIndex = m_pCModel->indexFromItem(child);
|
|
currentIndex = m_pCModel->indexFromItem(child);
|
|
currentItem = child;
|
|
currentItem = child;
|
|
found = true;
|
|
found = true;
|
|
- qDebug() << "找到路径部分:" << part;
|
|
|
|
|
|
+ // qDebug() << "找到路径部分:" << part;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -3750,10 +3751,10 @@ void DbTreeViewManager::setCheckedPaths(const QStringList &checkedPathsList)
|
|
QStandardItem *item = m_pCModel->itemFromIndex(idx);
|
|
QStandardItem *item = m_pCModel->itemFromIndex(idx);
|
|
if (item) {
|
|
if (item) {
|
|
item->setCheckState(Qt::Checked);
|
|
item->setCheckState(Qt::Checked);
|
|
- qDebug() << " Setting item:" << item->text() << "to Checked";
|
|
|
|
|
|
+ //qDebug() << " Setting item:" << item->text() << "to Checked";
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- qDebug() << "Path not found:" << pathStr;
|
|
|
|
|
|
+ //qDebug() << "Path not found:" << pathStr;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -3804,7 +3805,7 @@ void DbTreeViewManager::updateParentItems(QStandardItem *parentItem)
|
|
|
|
|
|
int checkedCount = 0;
|
|
int checkedCount = 0;
|
|
int totalCount = parentItem->rowCount();
|
|
int totalCount = parentItem->rowCount();
|
|
- qDebug() << "Updating child items of:" << parentItem->text();
|
|
|
|
|
|
+ //qDebug() << "Updating child items of:" << parentItem->text();
|
|
|
|
|
|
for (int i = 0; i < totalCount; ++i)
|
|
for (int i = 0; i < totalCount; ++i)
|
|
{
|
|
{
|
|
@@ -4137,14 +4138,14 @@ void DbTreeViewManager::saveCheckedPaths()
|
|
|
|
|
|
settings.endGroup();
|
|
settings.endGroup();
|
|
|
|
|
|
- qDebug() << "保存复选框状态路径:" << checkedList;
|
|
|
|
|
|
+ //qDebug() << "保存复选框状态路径:" << checkedList;
|
|
}
|
|
}
|
|
|
|
|
|
// 加载选中路径
|
|
// 加载选中路径
|
|
void DbTreeViewManager::loadCheckedPaths()
|
|
void DbTreeViewManager::loadCheckedPaths()
|
|
{
|
|
{
|
|
if (m_currentConfigName == "") {
|
|
if (m_currentConfigName == "") {
|
|
- qWarning() << "当前配置ID无效,无法加载复选框状态。";
|
|
|
|
|
|
+ //qWarning() << "当前配置ID无效,无法加载复选框状态。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4159,7 +4160,7 @@ void DbTreeViewManager::loadCheckedPaths()
|
|
|
|
|
|
settings.endGroup();
|
|
settings.endGroup();
|
|
|
|
|
|
- qDebug() << "加载复选框状态路径:" << loadedChecked;
|
|
|
|
|
|
+ //qDebug() << "加载复选框状态路径:" << loadedChecked;
|
|
|
|
|
|
m_blockItemChanged = true;
|
|
m_blockItemChanged = true;
|
|
|
|
|
|
@@ -4227,14 +4228,14 @@ void DbTreeViewManager::saveExpandedPaths()
|
|
|
|
|
|
settings.endGroup();
|
|
settings.endGroup();
|
|
|
|
|
|
- qDebug() << "保存展开路径:" << expandedList;
|
|
|
|
|
|
+ //qDebug() << "保存展开路径:" << expandedList;
|
|
}
|
|
}
|
|
|
|
|
|
// 加载展开路径
|
|
// 加载展开路径
|
|
void DbTreeViewManager::loadExpandedPaths()
|
|
void DbTreeViewManager::loadExpandedPaths()
|
|
{
|
|
{
|
|
if (m_currentConfigName == "") {
|
|
if (m_currentConfigName == "") {
|
|
- qWarning() << "当前配置ID无效,无法加载展开路径。";
|
|
|
|
|
|
+ //qWarning() << "当前配置ID无效,无法加载展开路径。";
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -4249,7 +4250,7 @@ void DbTreeViewManager::loadExpandedPaths()
|
|
|
|
|
|
settings.endGroup();
|
|
settings.endGroup();
|
|
|
|
|
|
- qDebug() << "加载展开路径:" << loadedExpanded;
|
|
|
|
|
|
+ //qDebug() << "加载展开路径:" << loadedExpanded;
|
|
|
|
|
|
m_blockItemChanged = true;
|
|
m_blockItemChanged = true;
|
|
|
|
|
|
@@ -4260,9 +4261,9 @@ void DbTreeViewManager::loadExpandedPaths()
|
|
if (idx.isValid()) {
|
|
if (idx.isValid()) {
|
|
m_pTreeViewDown->expand(idx);
|
|
m_pTreeViewDown->expand(idx);
|
|
expandedPaths.insert(p);
|
|
expandedPaths.insert(p);
|
|
- qDebug() << "成功恢复展开路径:" << p;
|
|
|
|
|
|
+ // qDebug() << "成功恢复展开路径:" << p;
|
|
} else {
|
|
} else {
|
|
- qDebug() << "未找到展开路径部分: " << p;
|
|
|
|
|
|
+ // qDebug() << "未找到展开路径部分: " << p;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|