From 4d6d7e3bf80a242a6d122b5a832d3aaed6e2e9db Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 9 Aug 2012 10:59:41 +0200 Subject: [PATCH 1/6] bad fixes --- src/gui/UBFeaturesWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 6d007f48..20393c75 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -616,8 +616,8 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget( QLabel *mLabel = new QLabel(labelText, this); mLineEdit = new QLineEdit(this); - mValidator = new QRegExpValidator(QRegExp("[\^\/\:\?\*\|\<\>\"]{2,}"), this); - mLineEdit->setValidator(mValidator); + //mValidator = new QRegExpValidator(QRegExp("[A-Za-z][1-9][0-9]{0,2}"), this); + //mLineEdit->setValidator(mValidator); labelLayout->addWidget(mLabel); labelLayout->addWidget(mLineEdit); From bda4b918716d38912948652accc2963ae8e595eb Mon Sep 17 00:00:00 2001 From: Claudio Valerio Date: Thu, 9 Aug 2012 11:34:06 +0200 Subject: [PATCH 2/6] second bad fix --- src/domain/UBGraphicsItemDelegate.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 816636c1..dc59bb35 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -1128,8 +1128,9 @@ DelegateMediaControl::DelegateMediaControl(UBGraphicsMediaItem* pDelegated, QGra setPen(Qt::NoPen); setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); - lcdTimer = new MediaTimer(this); - lcdTimer->init(); + lcdTimer = 0; + //lcdTimer = new MediaTimer(this); + //lcdTimer->init(); update(); } @@ -1180,8 +1181,8 @@ void DelegateMediaControl::positionHandles() { mLCDTimerArea.setWidth(parentItem()->boundingRect().height()); mLCDTimerArea.setHeight(parentItem()->boundingRect().height()); - lcdTimer->setRect(mLCDTimerArea); - lcdTimer->setPos(mSeecArea.width()-mLCDTimerArea.width(),0); + //lcdTimer->setRect(mLCDTimerArea); + //lcdTimer->setPos(mSeecArea.width()-mLCDTimerArea.width(),0); mSeecArea.setWidth(rect().width()-mLCDTimerArea.width()); @@ -1189,7 +1190,7 @@ void DelegateMediaControl::positionHandles() selfRect.setHeight(parentItem()->boundingRect().height()); setRect(selfRect); - lcdTimer->setPos(rect().width() - mLCDTimerArea.width(), 0); + //lcdTimer->setPos(rect().width() - mLCDTimerArea.width(), 0); } @@ -1197,7 +1198,7 @@ void DelegateMediaControl::update() { QTime t; t = t.addMSecs(mCurrentTimeInMs < 0 ? 0 : mCurrentTimeInMs); - lcdTimer->display(t.toString("m:ss")); + //lcdTimer->display(t.toString("m:ss")); QGraphicsRectItem::update(); } @@ -1249,7 +1250,7 @@ void DelegateMediaControl::seekToMousePos(QPointF mousePos) qreal frameWidth = rect().height() / 2; minX = frameWidth; - length = mSeecArea.width() - lcdTimer->rect().width(); + length = mSeecArea.width() /*- lcdTimer->rect().width()*/; qreal mouseX = mousePos.x(); if (mouseX >= (mSeecArea.width() - mSeecArea.height()/2)) From 3c0d021b2db9e1a26f9206e3903b186c99f237e0 Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Thu, 9 Aug 2012 13:38:35 +0300 Subject: [PATCH 3/6] Digital timer fix --- src/domain/UBGraphicsItemDelegate.cpp | 38 +++++++++------------------ src/domain/UBGraphicsItemDelegate.h | 29 ++++++++++++-------- 2 files changed, 31 insertions(+), 36 deletions(-) diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index 0781bfc5..81d4fe34 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -727,7 +727,11 @@ void UBGraphicsToolBarItem::paint(QPainter *painter, const QStyleOptionGraphicsI } MediaTimer::MediaTimer(QGraphicsItem * parent): QGraphicsRectItem(parent) -{} +{ + val = 0; + smallPoint = false; + setNumDigits(4); +} MediaTimer::~MediaTimer() {} @@ -810,9 +814,7 @@ void MediaTimer::drawDigit(const QPoint &pos, QPainter &p, int segLen, } } -char* MediaTimer::getSegments(char ch) // gets list of segments for ch -{ - char segments[30][8] = +char MediaTimer::segments [][8] = { { 0, 1, 2, 4, 5, 6,99, 0}, // 0 0 { 2, 5,99, 0, 0, 0, 0, 0}, // 1 1 @@ -827,16 +829,17 @@ char* MediaTimer::getSegments(char ch) // gets list of segments fo { 8, 9,99, 0, 0, 0, 0, 0}, // 10 : {99, 0, 0, 0, 0, 0, 0, 0} // 11 empty }; - - int n; + +const char* MediaTimer::getSegments(char ch) // gets list of segments for ch +{ if (ch >= '0' && ch <= '9') return segments[ch - '0']; if (ch == ':') - n = 10; + return segments[10]; if (ch == ' ') - n = 11; + return segments[11]; - return segments[n]; + return NULL; } void MediaTimer::drawSegment(const QPoint &pos, char segmentNo, QPainter &p, @@ -986,15 +989,8 @@ void MediaTimer::addPoint(QPolygon &a, const QPoint &p) } void MediaTimer::paint(QPainter *p, - const QStyleOptionGraphicsItem *option, QWidget *widget) + const QStyleOptionGraphicsItem *, QWidget*) { - Q_UNUSED(option); - Q_UNUSED(widget); - - QFont f = p->font(); - f.setPointSizeF(f.pointSizeF()); - p->setFont(f); - if (smallPoint) drawString(digitStr, *p, &points, false); else @@ -1058,13 +1054,6 @@ void MediaTimer::internalSetString(const QString& s) update(); } -void MediaTimer::init() -{ - val = 0; - smallPoint = false; - setNumDigits(4); -} - void MediaTimer::display(const QString &s) { val = 0; @@ -1132,7 +1121,6 @@ DelegateMediaControl::DelegateMediaControl(UBGraphicsMediaItem* pDelegated, QGra setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Control)); lcdTimer = new MediaTimer(this); - lcdTimer->init(); update(); } diff --git a/src/domain/UBGraphicsItemDelegate.h b/src/domain/UBGraphicsItemDelegate.h index 68c9e35e..f135f66b 100644 --- a/src/domain/UBGraphicsItemDelegate.h +++ b/src/domain/UBGraphicsItemDelegate.h @@ -71,33 +71,40 @@ class DelegateButton: public QGraphicsSvgItem }; +/* + Code of this class is copied from QT QLCDNumber class sources + See src\gui\widgets\qlcdnumber.cpp for original code +*/ class MediaTimer: public QGraphicsRectItem { public: MediaTimer(QGraphicsItem * parent = 0); ~MediaTimer(); - char* getSegments(char); - void addPoint(QPolygon&, const QPoint&); - void init(); - void internalSetString(const QString& s); - void drawString(const QString& s, QPainter &, QBitArray * = 0, bool = true); - void drawDigit(const QPoint &, QPainter &, int, char, char = ' '); - void drawSegment(const QPoint &, char, QPainter &, int, bool = false); void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); + void display(const QString &str); - void setNumDigits(int nDigits); private: + + static const char* getSegments(char); + void drawString(const QString& s, QPainter &, QBitArray * = 0, bool = true); + void drawDigit(const QPoint &, QPainter &, int, char, char = ' '); + void drawSegment(const QPoint &, char, QPainter &, int, bool = false); + void addPoint(QPolygon&, const QPoint&); + void internalSetString(const QString& s); + void setNumDigits(int nDigits); + + static char segments [][8]; + int ndigits; QString digitStr; QBitArray points; double val; -uint shadow : 1; -uint smallPoint : 1; - + uint shadow : 1; + uint smallPoint : 1; }; class DelegateMediaControl: public QObject, public QGraphicsRectItem From 2b2abcf3d7bc2bf36b3f3fe8062e71698928a026 Mon Sep 17 00:00:00 2001 From: Ilia Ryabokon Date: Thu, 9 Aug 2012 16:34:06 +0300 Subject: [PATCH 4/6] Regexp fix --- src/board/UBFeaturesController.cpp | 2 -- src/gui/UBFeaturesWidget.cpp | 4 +--- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index e8ad51c4..afc8ec53 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -22,8 +22,6 @@ const QString UBFeaturesController::virtualRootName = "root"; - - void UBFeaturesComputingThread::scanFS(const QUrl & currentPath, const QString & currVirtualPath) { Q_ASSERT(QFileInfo(currentPath.toLocalFile()).exists()); diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index 6d007f48..a8818582 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -604,8 +604,6 @@ void UBFeaturesCentralWidget::increaseStatusBarValue() UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget(parent) { -// SET_STYLE_SHEET() - this->setStyleSheet("background:white;"); QVBoxLayout *mainLayout = new QVBoxLayout(); @@ -616,7 +614,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget( QLabel *mLabel = new QLabel(labelText, this); mLineEdit = new QLineEdit(this); - mValidator = new QRegExpValidator(QRegExp("[\^\/\:\?\*\|\<\>\"]{2,}"), this); + mValidator = new QRegExpValidator(QRegExp("[^\\/\\:\\?\\*\\|\\<\\>\\\"]{2,}"), this); mLineEdit->setValidator(mValidator); labelLayout->addWidget(mLabel); labelLayout->addWidget(mLineEdit); From fbb5d87537aa8005ab875c0e24b00d9abd61931b Mon Sep 17 00:00:00 2001 From: Ilia Ryabokon Date: Thu, 9 Aug 2012 21:09:07 +0300 Subject: [PATCH 5/6] Sankore 874 feature widget create folder twice resolved --- src/board/UBFeaturesController.cpp | 22 +++++++++++++++++++++ src/board/UBFeaturesController.h | 1 + src/gui/UBFeaturesActionBar.cpp | 10 ++++++++++ src/gui/UBFeaturesActionBar.h | 2 ++ src/gui/UBFeaturesWidget.cpp | 31 ++++++++++++++++++++++++++++-- src/gui/UBFeaturesWidget.h | 11 ++++++++++- 6 files changed, 74 insertions(+), 3 deletions(-) diff --git a/src/board/UBFeaturesController.cpp b/src/board/UBFeaturesController.cpp index afc8ec53..a0bac9dd 100644 --- a/src/board/UBFeaturesController.cpp +++ b/src/board/UBFeaturesController.cpp @@ -622,6 +622,7 @@ void UBFeaturesController::importImage(const QImage &image, const QString &fileN importImage(image, currentElement, fileName); } + void UBFeaturesController::importImage( const QImage &image, const UBFeature &destination, const QString &fileName ) { QString mFileName = fileName; @@ -648,6 +649,27 @@ void UBFeaturesController::importImage( const QImage &image, const UBFeature &de } +QStringList UBFeaturesController::getFileNamesInFolders() +{ + QStringList strList; + + Q_ASSERT(curListModel); + + for (int i = 0; i < curListModel->rowCount(QModelIndex()); i++) { + QModelIndex ind = curListModel->index(i, 0); + if (!ind.isValid()) { + qDebug() << "incorrect model index catched"; + continue; + } + UBFeature curFeature = curListModel->data(ind, Qt::UserRole + 1).value(); + if (curFeature.getType() == FEATURE_FOLDER) { + strList << QFileInfo(curFeature.getFullPath().toLocalFile()).fileName(); + } + } + + return strList; +} + void UBFeaturesController::addNewFolder(QString name) { QString path = currentElement.getFullPath().toLocalFile() + "/" + name; diff --git a/src/board/UBFeaturesController.h b/src/board/UBFeaturesController.h index 13f0142d..64bbd5cc 100644 --- a/src/board/UBFeaturesController.h +++ b/src/board/UBFeaturesController.h @@ -157,6 +157,7 @@ public: void removeFromFavorite(const QUrl &path, bool deleteManualy = false); void importImage(const QImage &image, const QString &fileName = QString()); void importImage( const QImage &image, const UBFeature &destination, const QString &fileName = QString() ); + QStringList getFileNamesInFolders(); void fileSystemScan(const QUrl &currPath, const QString & currVirtualPath); int featuresCount(const QUrl &currPath); diff --git a/src/gui/UBFeaturesActionBar.cpp b/src/gui/UBFeaturesActionBar.cpp index 80341927..65ee920f 100644 --- a/src/gui/UBFeaturesActionBar.cpp +++ b/src/gui/UBFeaturesActionBar.cpp @@ -209,6 +209,16 @@ void UBFeaturesActionBar::onActionRescanModel() emit rescanModel(); } +void UBFeaturesActionBar::lockIt() +{ + setEnabled(false); +} + +void UBFeaturesActionBar::unlockIt() +{ + setEnabled(true); +} + void UBFeaturesActionBar::dragEnterEvent( QDragEnterEvent *event ) { const UBFeaturesMimeData *fMimeData = qobject_cast(event->mimeData()); diff --git a/src/gui/UBFeaturesActionBar.h b/src/gui/UBFeaturesActionBar.h index 71b6fdc0..b3a406e6 100644 --- a/src/gui/UBFeaturesActionBar.h +++ b/src/gui/UBFeaturesActionBar.h @@ -45,6 +45,8 @@ private slots: void onActionRemoveFavorite(); void onActionTrash(); void onActionRescanModel(); + void lockIt(); + void unlockIt(); protected: void dragEnterEvent( QDragEnterEvent *event ); diff --git a/src/gui/UBFeaturesWidget.cpp b/src/gui/UBFeaturesWidget.cpp index a8818582..5cc7b27a 100644 --- a/src/gui/UBFeaturesWidget.cpp +++ b/src/gui/UBFeaturesWidget.cpp @@ -1,5 +1,4 @@ #include - #include "UBFeaturesWidget.h" #include "domain/UBAbstractWidget.h" #include "gui/UBThumbnailWidget.h" @@ -61,6 +60,7 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) layout->addWidget(mActionBar); connect(centralWidget->listView(), SIGNAL(clicked(const QModelIndex &)), this, SLOT(currentSelected(const QModelIndex &))); + connect(this, SIGNAL(sendFileNameList(QStringList)), centralWidget, SIGNAL(sendFileNameList(QStringList))); connect(mActionBar, SIGNAL(searchElement(const QString &)), this, SLOT( searchStarted(const QString &))); connect(mActionBar, SIGNAL(newFolderToCreate()), this, SLOT(createNewFolder())); connect(mActionBar, SIGNAL(deleteElements(const UBFeaturesMimeData *)), this, SLOT(deleteElements(const UBFeaturesMimeData *))); @@ -79,6 +79,8 @@ UBFeaturesWidget::UBFeaturesWidget(QWidget *parent, const char *name) connect(centralWidget, SIGNAL(createNewFolderSignal(QString)), controller, SLOT(addNewFolder(QString))); connect(controller, SIGNAL(scanStarted()), centralWidget, SLOT(scanStarted())); connect(controller, SIGNAL(scanFinished()), centralWidget, SLOT(scanFinished())); + connect(controller, SIGNAL(scanStarted()), mActionBar, SLOT(lockIt())); + connect(controller, SIGNAL(scanFinished()), mActionBar, SLOT(unlockIt())); connect(controller, SIGNAL(maxFilesCountEvaluated(int)), centralWidget, SIGNAL(maxFilesCountEvaluated(int))); connect(controller, SIGNAL(featureAddedFromThread()), centralWidget, SLOT(increaseStatusBarValue())); } @@ -145,6 +147,7 @@ void UBFeaturesWidget::currentSelected(const QModelIndex ¤t) void UBFeaturesWidget::createNewFolder() { centralWidget->showAdditionalData(UBFeaturesCentralWidget::NewFolderDialog, UBFeaturesCentralWidget::Modal); + emit sendFileNameList(controller->getFileNamesInFolders()); } void UBFeaturesWidget::addFolder() @@ -492,6 +495,7 @@ UBFeaturesCentralWidget::UBFeaturesCentralWidget(QWidget *parent) : QWidget(pare connect(dlg, SIGNAL(createNewFolder(QString)), this, SLOT(createNewFolderSlot(QString))); connect(dlg, SIGNAL(closeDialog()), this, SLOT(hideAdditionalData())); + connect(this, SIGNAL(sendFileNameList(QStringList)), dlg, SLOT(setFileNameList(QStringList))); //Progress bar to show scanning progress QProgressBar *progressBar = new QProgressBar(); @@ -621,7 +625,7 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget( QHBoxLayout *buttonLayout = new QHBoxLayout(this); - QPushButton *acceptButton = new QPushButton(acceptText, this); + acceptButton = new QPushButton(acceptText, this); QPushButton *cancelButton = new QPushButton(cancelText, this); buttonLayout->addWidget(acceptButton); buttonLayout->addWidget(cancelButton); @@ -629,14 +633,23 @@ UBFeaturesNewFolderDialog::UBFeaturesNewFolderDialog(QWidget *parent) : QWidget( mainLayout->addLayout(labelLayout); mainLayout->addLayout(buttonLayout); + acceptButton->setEnabled(false); + connect(acceptButton, SIGNAL(clicked()), this, SLOT(accept())); connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); + connect(mLineEdit, SIGNAL(textEdited(QString)), this, SLOT(reactOnTextChanged(QString))); + + reactOnTextChanged(QString()); } void UBFeaturesNewFolderDialog::setRegexp(const QRegExp pRegExp) { mValidator->setRegExp(pRegExp); } +bool UBFeaturesNewFolderDialog::validString(const QString &pStr) +{ + return mLineEdit->hasAcceptableInput() && !mFileNameList.contains(pStr, Qt::CaseSensitive); +} void UBFeaturesNewFolderDialog::accept() { @@ -649,6 +662,20 @@ void UBFeaturesNewFolderDialog::reject() mLineEdit->clear(); emit closeDialog(); } +void UBFeaturesNewFolderDialog::setFileNameList(const QStringList &pLst) +{ + mFileNameList = pLst; +} +void UBFeaturesNewFolderDialog::reactOnTextChanged(const QString &pStr) +{ + if (validString(pStr)) { + acceptButton->setEnabled(true); + mLineEdit->setStyleSheet("background:white;"); + } else { + acceptButton->setEnabled(false); + mLineEdit->setStyleSheet("background:#FFB3C8;"); + } +} UBFeaturesWebView::UBFeaturesWebView(QWidget* parent, const char* name):QWidget(parent) , mpView(NULL) diff --git a/src/gui/UBFeaturesWidget.h b/src/gui/UBFeaturesWidget.h index 0f3f21c2..788de51b 100644 --- a/src/gui/UBFeaturesWidget.h +++ b/src/gui/UBFeaturesWidget.h @@ -72,6 +72,9 @@ public: int scrollbarHorisontalPadding() const { return 10;} int scrollbarVerticalIndent() const { return 0;} +signals: + void sendFileNameList(const QStringList lst); + private slots: void onPreviewLoaded(int id, bool pSuccess, QUrl sourceUrl, QString pContentTypeHeader, QByteArray pData, QPointF pPos, QSize pSize, bool isBackground); void currentSelected( const QModelIndex & ); @@ -190,7 +193,6 @@ public: void setLockedExcludingAdditional(bool pLock); - QStackedWidget *mStackedWidget; UBFeaturesNavigatorWidget *mNavigator; UBFeatureProperties *mFeatureProperties; @@ -201,6 +203,7 @@ public: signals: void lockMainWidget(bool pLock); void createNewFolderSignal(QString pStr); + void sendFileNameList(const QStringList lst); // progressbar widget related signals void maxFilesCountEvaluated(int pValue); @@ -228,6 +231,7 @@ public: UBFeaturesNewFolderDialog(QWidget *parent = 0); void setRegexp(const QRegExp pRegExp); + bool validString(const QString &pStr); signals: void createNewFolder(QString str); @@ -236,10 +240,15 @@ signals: private slots: void accept(); void reject(); + void setFileNameList(const QStringList &pLst); + void reactOnTextChanged(const QString &pStr); + private: QLineEdit *mLineEdit; QRegExpValidator *mValidator; + QStringList mFileNameList; + QPushButton *acceptButton; }; From f25da1f3eca4e15f88da33bac5665ff9fd7f6d88 Mon Sep 17 00:00:00 2001 From: shibakaneki Date: Fri, 10 Aug 2012 08:52:36 +0200 Subject: [PATCH 6/6] Fixed issue 633 --- src/board/UBBoardPaletteManager.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/board/UBBoardPaletteManager.cpp b/src/board/UBBoardPaletteManager.cpp index c0064762..3cfcd5a1 100644 --- a/src/board/UBBoardPaletteManager.cpp +++ b/src/board/UBBoardPaletteManager.cpp @@ -681,8 +681,10 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is { case eUBDockPaletteWidget_BOARD: { - mLeftPalette->assignParent(UBApplication::boardController->controlContainer()); - mRightPalette->assignParent(UBApplication::boardController->controlContainer()); + mLeftPalette->assignParent(mContainer); + mRightPalette->assignParent(mContainer); + mRightPalette->stackUnder(mStylusPalette); + mLeftPalette->stackUnder(mStylusPalette); if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) { @@ -714,6 +716,8 @@ void UBBoardPaletteManager::changeMode(eUBDockPaletteWidgetMode newMode, bool is { mLeftPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); mRightPalette->assignParent((QWidget*)UBApplication::applicationController->uninotesController()->drawingView()); + mRightPalette->lower(); + mLeftPalette->lower(); if (UBPlatformUtils::hasVirtualKeyboard() && mKeyboardPalette != NULL) {