| 1 |
/* |
| 2 |
* Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd. |
| 3 |
* |
| 4 |
* Author: ZhangYong <[email protected]> |
| 5 |
* |
| 6 |
* Maintainer: ZhangYong <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
#include "allpicview.h" |
| 22 |
#include <QMimeData> |
| 23 |
#include "imageengine/imageengineapi.h" |
| 24 |
#include "mainwindow.h" |
| 25 |
#include <dgiovolumemanager.h> |
| 26 |
#include <dgiofile.h> |
| 27 |
#include <dgiofileinfo.h> |
| 28 |
#include <dgiovolume.h> |
| 29 |
|
| 30 |
#include "ac-desktop-define.h" |
| 31 |
#include "batchoperatewidget.h" |
| 32 |
#include "noresultwidget.h" |
| 33 |
|
| 34 |
namespace { |
| 35 |
struct MetaData { |
| 36 |
QString key; |
| 37 |
const char *name; |
| 38 |
}; |
| 39 |
|
| 40 |
static MetaData MetaDataBasics[] = { |
| 41 |
{"FileName", QT_TRANSLATE_NOOP("MetadataName", "Photo name")}, |
| 42 |
{"FileFormat", QT_TRANSLATE_NOOP("MetadataName", "Type")}, |
| 43 |
{"FileSize", QT_TRANSLATE_NOOP("MetadataName", "File size")}, |
| 44 |
{"Dimension", QT_TRANSLATE_NOOP("MetadataName", "Dimensions")}, |
| 45 |
{"DateTimeOriginal", QT_TRANSLATE_NOOP("MetadataName", "Date captured")}, |
| 46 |
{"DateTimeDigitized", QT_TRANSLATE_NOOP("MetadataName", "Date modified")}, |
| 47 |
{"Tag", QT_TRANSLATE_NOOP("MetadataName", "Tag")}, |
| 48 |
{"", ""} |
| 49 |
}; |
| 50 |
}; |
| 51 |
|
| 52 |
namespace { |
| 53 |
const int VIEW_IMPORT = 0; |
| 54 |
const int VIEW_ALLPICS = 1; |
| 55 |
const int VIEW_SEARCH = 2; |
| 56 |
} //namespace |
| 57 |
|
| 58 |
AllPicView::AllPicView() |
| 59 |
: step(0) |
| 60 |
{ |
| 61 |
setAcceptDrops(true); |
| 62 |
fatherwidget = new DWidget(this); |
| 63 |
fatherwidget->setFixedSize(this->size()); |
| 64 |
m_pStackedWidget = new DStackedWidget(this); |
| 65 |
AC_SET_OBJECT_NAME(m_pStackedWidget, All_Picture_StackedWidget); |
| 66 |
AC_SET_ACCESSIBLE_NAME(m_pStackedWidget, All_Picture_StackedWidget); |
| 67 |
m_pImportView = new ImportView(); |
| 68 |
m_pThumbnailListView = new ThumbnailListView(ThumbnailDelegate::AllPicViewType, COMMON_STR_ALLPHOTOS); |
| 69 |
// m_pThumbnailListView->setStyleSheet("background-color:red;"); |
| 70 |
AC_SET_OBJECT_NAME(m_pThumbnailListView, All_Picture_Thembnail); |
| 71 |
AC_SET_ACCESSIBLE_NAME(m_pThumbnailListView, All_Picture_Thembnail); |
| 72 |
m_thumbnailListViewWidget = new DWidget(); |
| 73 |
QLayout *m_mainLayout = new QVBoxLayout(); |
| 74 |
m_mainLayout->addWidget(m_pThumbnailListView); |
| 75 |
|
| 76 |
//初始化筛选无结果窗口 |
| 77 |
m_noResultWidget = new NoResultWidget(this); |
| 78 |
m_mainLayout->addWidget(m_noResultWidget); |
| 79 |
m_noResultWidget->setVisible(false); |
| 80 |
|
| 81 |
m_thumbnailListViewWidget->setLayout(m_mainLayout); |
| 82 |
m_pSearchView = new SearchView(); |
| 83 |
m_pStackedWidget->addWidget(m_pImportView); |
| 84 |
m_pStackedWidget->setCurrentIndex(VIEW_IMPORT); |
| 85 |
m_pStackedWidget->addWidget(m_thumbnailListViewWidget); |
| 86 |
m_pStackedWidget->addWidget(m_pSearchView); |
| 87 |
m_pStackedWidget->setCurrentIndex(VIEW_ALLPICS); |
| 88 |
m_pStatusBar = new StatusBar(this); |
| 89 |
m_pStatusBar->raise(); |
| 90 |
m_pStatusBar->setFixedWidth(this->width()); |
| 91 |
m_pStatusBar->move(0, this->height() - m_pStatusBar->height()); |
| 92 |
QVBoxLayout *pVBoxLayout = new QVBoxLayout(); |
| 93 |
pVBoxLayout->setContentsMargins(0, 0, 0, 0); |
| 94 |
pVBoxLayout->addWidget(m_pStackedWidget); |
| 95 |
fatherwidget->setLayout(pVBoxLayout); |
| 96 |
m_mainLayout->setContentsMargins(2, 0, 0, m_pStatusBar->height()); |
| 97 |
//初始化悬浮窗 |
| 98 |
initSuspensionWidget(); |
| 99 |
initConnections(); |
| 100 |
// m_spinner = new DSpinner(this); |
| 101 |
// m_spinner->setFixedSize(40, 40); |
| 102 |
// m_spinner->hide(); |
| 103 |
connect(m_pThumbnailListView, &ThumbnailListView::sigUpdatePicNum, this, &AllPicView::updatePicsIntoThumbnailViewWithCache); |
| 104 |
connect(m_pThumbnailListView, &ThumbnailListView::sigDBImageLoaded, this, &AllPicView::updateStackedWidget); |
| 105 |
m_pwidget = new QWidget(this); |
| 106 |
m_pwidget->setAttribute(Qt::WA_TransparentForMouseEvents); |
| 107 |
if (ImageEngineApi::instance()->getAllImageDataCount() > 0) { |
| 108 |
m_pThumbnailListView->slotLoadFirstPageThumbnailsFinish(); |
| 109 |
} else { |
| 110 |
if (ImageEngineApi::instance()->m_firstPageIsLoaded) { |
| 111 |
//相册为空的情况。 |
| 112 |
m_pThumbnailListView->slotLoadFirstPageThumbnailsFinish(); |
| 113 |
} else { |
| 114 |
connect(ImageEngineApi::instance(), &ImageEngineApi::sigLoadFirstPageThumbnailsToView, |
| 115 |
m_pThumbnailListView, &ThumbnailListView::slotLoadFirstPageThumbnailsFinish); |
| 116 |
} |
| 117 |
} |
| 118 |
AC_SET_OBJECT_NAME(this, All_Picture_View); |
| 119 |
AC_SET_ACCESSIBLE_NAME(this, All_Picture_View); |
| 120 |
} |
| 121 |
|
| 122 |
bool AllPicView::imageImported(bool success) |
| 123 |
{ |
| 124 |
Q_UNUSED(success); |
| 125 |
emit dApp->signalM->closeWaitDialog(); |
| 126 |
return true; |
| 127 |
} |
| 128 |
|
| 129 |
void AllPicView::initConnections() |
| 130 |
{ |
| 131 |
qRegisterMetaType<DBImgInfoList>("DBImgInfoList &"); |
| 132 |
connect(dApp->signalM, &SignalManager::imagesInserted, this, &AllPicView::updatePicsIntoThumbnailView); |
| 133 |
//有图片删除后,刷新列表 |
| 134 |
connect(dApp->signalM, &SignalManager::imagesRemovedPar, this, &AllPicView::onImgRemoved); |
| 135 |
// 添加重复照片提示 |
| 136 |
connect(dApp->signalM, &SignalManager::RepeatImportingTheSamePhotos, this, &AllPicView::onRepeatImportingTheSamePhotos); |
| 137 |
connect(m_pThumbnailListView, &ThumbnailListView::openImage, this, &AllPicView::onOpenImage); |
| 138 |
connect(m_pThumbnailListView, &ThumbnailListView::sigSlideShow, this, &AllPicView::onSlideShow); |
| 139 |
//图片旋转后更新图片 |
| 140 |
connect(dApp->signalM, &SignalManager::sigUpdateImageLoader, this, &AllPicView::updatePicsThumbnailView); |
| 141 |
connect(m_pStatusBar->m_pSlider, &DSlider::valueChanged, dApp->signalM, &SignalManager::emitSliderValueChg); |
| 142 |
// connect(m_pThumbnailListView, &ThumbnailListView::sigMouseMove, this, &AllPicView::updatePicNum); |
| 143 |
// connect(m_pThumbnailListView, &ThumbnailListView::sigMouseRelease, this, &AllPicView::updatePicNum); |
| 144 |
// connect(m_pThumbnailListView, &ThumbnailListView::customContextMenuRequested, this, &AllPicView::updatePicNum); |
| 145 |
|
| 146 |
//缩略图选中项发生变化 |
| 147 |
connect(m_pThumbnailListView->selectionModel(), &QItemSelectionModel::selectionChanged, |
| 148 |
this, &AllPicView::sltSelectionChanged); |
| 149 |
connect(m_pSearchView->m_pThumbnailListView->selectionModel(), &QItemSelectionModel::selectionChanged, |
| 150 |
this, &AllPicView::sltSelectionChanged); |
| 151 |
//筛选显示,当先列表中内容为无结果 |
| 152 |
connect(m_pThumbnailListView, &ThumbnailListView::sigNoPicOrNoVideo, this, &AllPicView::slotNoPicOrNoVideo); |
| 153 |
// connect(m_pSearchView->m_pThumbnailListView, &ThumbnailListView::sigMouseRelease, this, &AllPicView::updatePicNum); |
| 154 |
// connect(m_pSearchView->m_pThumbnailListView, &ThumbnailListView::customContextMenuRequested, this, &AllPicView::updatePicNum); |
| 155 |
connect(m_pImportView->m_pImportBtn, &DPushButton::clicked, this, &AllPicView::onImportViewImportBtnClicked); |
| 156 |
connect(dApp->signalM, &SignalManager::sigImportFailedToView, this, &AllPicView::onImportFailedToView); |
| 157 |
// connect(m_pThumbnailListView, &ThumbnailListView::sigSelectAll, this, &AllPicView::updatePicNum); |
| 158 |
connect(dApp->signalM, &SignalManager::sigShortcutKeyDelete, this, &AllPicView::onKeyDelete); |
| 159 |
connect(dApp->signalM, &SignalManager::sigMonitorChanged, this, &AllPicView::monitorHaveNewFile); |
| 160 |
} |
| 161 |
|
| 162 |
void AllPicView::initSuspensionWidget() |
| 163 |
{ |
| 164 |
//添加悬浮title |
| 165 |
m_SuspensionWidget = new QWidget(m_thumbnailListViewWidget); |
| 166 |
m_SuspensionWidget->setFocusPolicy(Qt::ClickFocus); |
| 167 |
//右侧批量操作控件 |
| 168 |
QHBoxLayout *hlayoutDateLabel = new QHBoxLayout(m_SuspensionWidget); |
| 169 |
m_SuspensionWidget->setLayout(hlayoutDateLabel); |
| 170 |
|
| 171 |
m_batchOperateWidget = new BatchOperateWidget(m_pThumbnailListView, BatchOperateWidget::NullType, this); |
| 172 |
m_batchOperateWidget->setObjectName(All_Picture_BatchOperateWidget); |
| 173 |
m_batchOperateWidget->setFocusPolicy(Qt::FocusPolicy::StrongFocus); |
| 174 |
hlayoutDateLabel->addStretch(100); |
| 175 |
hlayoutDateLabel->setContentsMargins(0, 0, 19, 0); |
| 176 |
hlayoutDateLabel->addWidget(m_batchOperateWidget); |
| 177 |
|
| 178 |
DPalette ppal_light = DApplicationHelper::instance()->palette(m_SuspensionWidget); |
| 179 |
// ppal_light.setBrush(DPalette::Background, ppal_light.color(DPalette::Base)); |
| 180 |
ppal_light.setBrush(DPalette::Base, ppal_light.color(DPalette::Window)); |
| 181 |
QGraphicsOpacityEffect *opacityEffect_light = new QGraphicsOpacityEffect; |
| 182 |
opacityEffect_light->setOpacity(0.95); |
| 183 |
m_SuspensionWidget->setPalette(ppal_light); |
| 184 |
m_SuspensionWidget->setGraphicsEffect(opacityEffect_light); |
| 185 |
m_SuspensionWidget->setAutoFillBackground(true); |
| 186 |
|
| 187 |
m_SuspensionWidget->setContentsMargins(0, 0, 0, 0); |
| 188 |
m_SuspensionWidget->setGeometry(0, 0, this->width() - 15, SUSPENSION_WIDGET_HEIGHT); |
| 189 |
} |
| 190 |
|
| 191 |
void AllPicView::updateStackedWidget() |
| 192 |
{ |
| 193 |
if (0 < DBManager::instance()->getImgsCount()) { |
| 194 |
m_pStackedWidget->setCurrentIndex(VIEW_ALLPICS); |
| 195 |
m_pStatusBar->setVisible(true); |
| 196 |
} else { |
| 197 |
m_pStackedWidget->setCurrentIndex(VIEW_IMPORT); |
| 198 |
m_pStatusBar->setVisible(false); |
| 199 |
} |
| 200 |
updatePicNum(); |
| 201 |
} |
| 202 |
|
| 203 |
void AllPicView::monitorHaveNewFile(QStringList list) |
| 204 |
{ |
| 205 |
ImageEngineApi::instance()->ImportImagesFromFileList(list, "", this, true); |
| 206 |
} |
| 207 |
|
| 208 |
void AllPicView::updatePicsIntoThumbnailView() |
| 209 |
{ |
| 210 |
m_pThumbnailListView->stopLoadAndClear(true); |
| 211 |
DBImgInfoList infoList = DBManager::instance()->getAllInfos(); |
| 212 |
//加空白栏 |
| 213 |
m_pThumbnailListView->insertBlankOrTitleItem(ItemTypeBlank, "", "", SUSPENSION_WIDGET_HEIGHT); |
| 214 |
m_pThumbnailListView->insertThumbnailByImgInfos(infoList); |
| 215 |
if (VIEW_SEARCH == m_pStackedWidget->currentIndex()) { |
| 216 |
//donothing |
| 217 |
} else { |
| 218 |
updateStackedWidget(); |
| 219 |
} |
| 220 |
m_pThumbnailListView->reloadImage(); |
| 221 |
restorePicNum(); |
| 222 |
} |
| 223 |
|
| 224 |
void AllPicView::updatePicsIntoThumbnailViewWithCache() |
| 225 |
{ |
| 226 |
m_pThumbnailListView->stopLoadAndClear(false); |
| 227 |
if (VIEW_SEARCH == m_pStackedWidget->currentIndex()) { |
| 228 |
//donothing |
| 229 |
} else { |
| 230 |
updateStackedWidget(); |
| 231 |
} |
| 232 |
restorePicNum(); |
| 233 |
} |
| 234 |
|
| 235 |
void AllPicView::onRepeatImportingTheSamePhotos(QStringList importPaths, QStringList duplicatePaths, const QString &albumName) |
| 236 |
{ |
| 237 |
Q_UNUSED(importPaths) |
| 238 |
if (albumName.length() == 0 && dApp->getMainWindow()->getCurrentViewType() == 0) { |
| 239 |
m_pThumbnailListView->selectDuplicatePhotos(duplicatePaths); |
| 240 |
} |
| 241 |
} |
| 242 |
|
| 243 |
void AllPicView::onOpenImage(int row, const QString &path, bool bFullScreen) |
| 244 |
{ |
| 245 |
SignalManager::ViewInfo info; |
| 246 |
info.album = ""; |
| 247 |
info.lastPanel = nullptr; |
| 248 |
info.fullScreen = bFullScreen; |
| 249 |
auto imagelist = m_pThumbnailListView->getFileList(row); |
| 250 |
if (imagelist.size() > 0) { |
| 251 |
info.paths << imagelist; |
| 252 |
info.path = path; |
| 253 |
} else { |
| 254 |
info.paths.clear(); |
| 255 |
} |
| 256 |
info.viewType = utils::common::VIEW_ALLPIC_SRN; |
| 257 |
info.viewMainWindowID = VIEW_MAINWINDOW_ALLPIC; |
| 258 |
info.dBImgInfos = m_pThumbnailListView->getAllFileInfo(row); |
| 259 |
|
| 260 |
emit dApp->signalM->viewImage(info); |
| 261 |
emit dApp->signalM->showImageView(VIEW_MAINWINDOW_ALLPIC); |
| 262 |
} |
| 263 |
|
| 264 |
void AllPicView::onSlideShow(const QString &path) |
| 265 |
{ |
| 266 |
SignalManager::ViewInfo info; |
| 267 |
info.album = ""; |
| 268 |
info.lastPanel = nullptr; |
| 269 |
auto photolist = m_pThumbnailListView->selectedPaths(); |
| 270 |
if (photolist.size() > 1) { |
| 271 |
//如果选中数目大于1,则幻灯片播放选中项 |
| 272 |
info.paths = photolist; |
| 273 |
info.path = photolist.at(0); |
| 274 |
} else { |
| 275 |
//如果选中项只有一项,则幻灯片播放全部 |
| 276 |
info.paths = m_pThumbnailListView->getFileList(); |
| 277 |
info.path = path; |
| 278 |
} |
| 279 |
info.fullScreen = true; |
| 280 |
info.slideShow = true; |
| 281 |
info.viewType = utils::common::VIEW_ALLPIC_SRN; |
| 282 |
info.viewMainWindowID = VIEW_MAINWINDOW_ALLPIC; |
| 283 |
emit dApp->signalM->startSlideShow(info); |
| 284 |
emit dApp->signalM->showSlidePanel(VIEW_MAINWINDOW_ALLPIC); |
| 285 |
} |
| 286 |
|
| 287 |
void AllPicView::onImportViewImportBtnClicked() |
| 288 |
{ |
| 289 |
emit dApp->signalM->startImprot(); |
| 290 |
m_pImportView->onImprotBtnClicked(); |
| 291 |
//导入结束后判断是否有导入,有导入则切换显示列表 |
| 292 |
if (ImageEngineApi::instance()->getAllImageDataCount() > 0) { |
| 293 |
m_pStackedWidget->setCurrentIndex(VIEW_ALLPICS); |
| 294 |
} |
| 295 |
} |
| 296 |
|
| 297 |
void AllPicView::onImportFailedToView() |
| 298 |
{ |
| 299 |
if (isVisible()) { |
| 300 |
// m_spinner->hide(); |
| 301 |
// m_spinner->stop(); |
| 302 |
updateStackedWidget(); |
| 303 |
} |
| 304 |
} |
| 305 |
|
| 306 |
void AllPicView::onImgRemoved(const DBImgInfoList &infos) |
| 307 |
{ |
| 308 |
updateStackedWidget(); |
| 309 |
} |
| 310 |
|
| 311 |
void AllPicView::sltSelectionChanged(const QItemSelection &selected, const QItemSelection &deselected) |
| 312 |
{ |
| 313 |
updatePicNum(); |
| 314 |
} |
| 315 |
|
| 316 |
ThumbnailListView *AllPicView::getThumbnailListView() |
| 317 |
{ |
| 318 |
return m_pThumbnailListView; |
| 319 |
} |
| 320 |
|
| 321 |
void AllPicView::updatePicsThumbnailView(QStringList strpath) |
| 322 |
{ |
| 323 |
if (strpath.empty()) { |
| 324 |
updatePicsIntoThumbnailViewWithCache(); |
| 325 |
} else { |
| 326 |
updatePicsIntoThumbnailView(); |
| 327 |
} |
| 328 |
} |
| 329 |
|
| 330 |
void AllPicView::dragEnterEvent(QDragEnterEvent *e) |
| 331 |
{ |
| 332 |
if (!utils::base::checkMimeUrls(e->mimeData()->urls())) { |
| 333 |
return; |
| 334 |
} |
| 335 |
e->setDropAction(Qt::CopyAction); |
| 336 |
e->accept(); |
| 337 |
} |
| 338 |
|
| 339 |
void AllPicView::dropEvent(QDropEvent *event) |
| 340 |
{ |
| 341 |
QList<QUrl> urls = event->mimeData()->urls(); |
| 342 |
if (urls.isEmpty()) { |
| 343 |
return; |
| 344 |
} |
| 345 |
ImageEngineApi::instance()->ImportImagesFromUrlList(urls, nullptr, this); |
| 346 |
event->accept(); |
| 347 |
} |
| 348 |
|
| 349 |
void AllPicView::dragMoveEvent(QDragMoveEvent *event) |
| 350 |
{ |
| 351 |
event->accept(); |
| 352 |
} |
| 353 |
|
| 354 |
void AllPicView::dragLeaveEvent(QDragLeaveEvent *e) |
| 355 |
{ |
| 356 |
Q_UNUSED(e); |
| 357 |
} |
| 358 |
|
| 359 |
void AllPicView::resizeEvent(QResizeEvent *e) |
| 360 |
{ |
| 361 |
Q_UNUSED(e); |
| 362 |
// m_spinner->move(width() / 2 - 20, (height() - 50) / 2 - 20); |
| 363 |
m_pwidget->setFixedHeight(this->height() - 23); |
| 364 |
m_pwidget->setFixedWidth(this->width()); |
| 365 |
m_pwidget->move(0, 0); |
| 366 |
m_pStatusBar->setFixedWidth(this->width()); |
| 367 |
m_pStatusBar->move(0, this->height() - m_pStatusBar->height()); |
| 368 |
fatherwidget->setFixedSize(this->size()); |
| 369 |
m_SuspensionWidget->setGeometry(0, 0, width() - 15, SUSPENSION_WIDGET_HEIGHT); |
| 370 |
updatePicNum(); |
| 371 |
} |
| 372 |
//筛选显示,当先列表中内容为无结果 |
| 373 |
void AllPicView::slotNoPicOrNoVideo(bool isNoResult) |
| 374 |
{ |
| 375 |
qDebug() << __FUNCTION__ << "---" << isNoResult; |
| 376 |
m_noResultWidget->setVisible(isNoResult); |
| 377 |
m_pThumbnailListView->setVisible(!isNoResult); |
| 378 |
if (isNoResult) { |
| 379 |
m_pStatusBar->m_pAllPicNumLabel->setText(QObject::tr("No results")); |
| 380 |
} else { |
| 381 |
updatePicNum(); |
| 382 |
} |
| 383 |
} |
| 384 |
|
| 385 |
void AllPicView::updatePicNum() |
| 386 |
{ |
| 387 |
int photoSelctCount = 0; |
| 388 |
int videoSelctCount = 0; |
| 389 |
if (VIEW_ALLPICS == m_pStackedWidget->currentIndex()) { |
| 390 |
photoSelctCount = m_pThumbnailListView->getAppointTypeSelectItemCount(ItemTypePic); |
| 391 |
videoSelctCount = m_pThumbnailListView->getAppointTypeSelectItemCount(ItemTypeVideo); |
| 392 |
} else if (VIEW_SEARCH == m_pStackedWidget->currentIndex()) { |
| 393 |
photoSelctCount = m_pSearchView->m_pThumbnailListView->getAppointTypeSelectItemCount(ItemTypePic); |
| 394 |
videoSelctCount = m_pSearchView->m_pThumbnailListView->getAppointTypeSelectItemCount(ItemTypeVideo); |
| 395 |
} |
| 396 |
|
| 397 |
if (photoSelctCount > 0 || videoSelctCount > 0) { |
| 398 |
m_pStatusBar->resetSelectedStatue(photoSelctCount, videoSelctCount); |
| 399 |
} else { |
| 400 |
restorePicNum(); |
| 401 |
} |
| 402 |
} |
| 403 |
|
| 404 |
const ThumbnailListView *AllPicView::getAllPicThumbnailListViewModel() |
| 405 |
{ |
| 406 |
return m_pThumbnailListView; |
| 407 |
} |
| 408 |
|
| 409 |
void AllPicView::restorePicNum() |
| 410 |
{ |
| 411 |
int photoCount = 0; |
| 412 |
int videoCount = 0; |
| 413 |
if (VIEW_ALLPICS == m_pStackedWidget->currentIndex()) { |
| 414 |
photoCount = m_pThumbnailListView->getAppointTypeItemCount(ItemTypePic); |
| 415 |
videoCount = m_pThumbnailListView->getAppointTypeItemCount(ItemTypeVideo); |
| 416 |
} else if (VIEW_SEARCH == m_pStackedWidget->currentIndex()) { |
| 417 |
photoCount = m_pSearchView->m_pThumbnailListView->getAppointTypeItemCount(ItemTypePic); |
| 418 |
videoCount = m_pSearchView->m_pThumbnailListView->getAppointTypeItemCount(ItemTypeVideo); |
| 419 |
} |
| 420 |
m_pStatusBar->resetUnselectedStatue(photoCount, videoCount); |
| 421 |
} |
| 422 |
|
| 423 |
void AllPicView::onKeyDelete() |
| 424 |
{ |
| 425 |
if (!isVisible()) |
| 426 |
return; |
| 427 |
if (VIEW_SEARCH == m_pStackedWidget->currentIndex()) |
| 428 |
return; |
| 429 |
|
| 430 |
QStringList paths = m_pThumbnailListView->selectedPaths(); |
| 431 |
m_pThumbnailListView->clearSelection(); |
| 432 |
ImageEngineApi::instance()->moveImagesToTrash(paths); |
| 433 |
} |