void ImageCollection::setState(State state) { if(_state == state && state != Hidden) return; if(state == Hidden) { listItem()->visible().setValue(0.); iconItem()->visible().setValue(0.); viewingItem()->visible().setValue(0.); timeItem()->visible().setValue(0.); } else if(state == Time) { timeItem()->visible().setValue(1.); if(_state == Expanded) { layoutTime(); } else { layoutImmTime(); } } else if(_state == Hidden) { Q_ASSERT(state == Collapsed || state == Expanded); if(state == Expanded) { listItem()->setActive(true); listItem()->visible().setValue(1.); layoutImmExpanded(); } else if(state == Collapsed) { iconItem()->visible().setValue(1.); layoutImmCollapsed(); listItem()->setActive(false); } } else if(state == Expanded) { Q_ASSERT(_state == Collapsed || _state == View || _state == Time); listItem()->setActive(true); listItem()->setFocused(true); listItem()->visible().setValue(1.); if(_state == Time) { layoutExpandedFromTime(); } else if(_state == View) { layoutExpandedFromView(); } else { layoutExpanded(); } } else if(state == Collapsed) { Q_ASSERT(_state == Expanded); layoutCollapsed(); listItem()->setActive(false); } else if(state == View) { Q_ASSERT(_state == Expanded); layoutView(); } _state = state; }
GfxCanvasItem *ImageCollection::nameItem(bool create) { if(!_nameItem && create) { _nameItem = new GfxCanvasImage(nameImg(), iconItem()); _nameItem->visible().setValue(35); _nameItem->y().setValue(50); } return _nameItem; }
void ImageCollection::layoutImmCollapsed() { tl.complete(); _collapseLayer.moveToParent(&_iconItem); QPoint p = collapsePoint(); for(int ii = 0; ii < count(); ++ii) { Image *img = image(ii); img->imageParent().setValue(0.); img->moveToParent(iconItem()); #define PHOTO_OFFSET 7 switch(ii) { case 0: img->x().setValue( p.x() - PHOTO_OFFSET); img->y().setValue( p.y() - PHOTO_OFFSET); img->quality().setValue( 1.); img->visible().setValue( 1.); break; case 1: img->x().setValue( p.x() + PHOTO_OFFSET); img->y().setValue( p.y() - PHOTO_OFFSET); img->quality().setValue( 1.); img->visible().setValue( 1.); break; case 2: img->x().setValue( p.x() + PHOTO_OFFSET); img->y().setValue( p.y() + PHOTO_OFFSET); img->quality().setValue( 1.); img->visible().setValue( 1.); break; case 3: img->x().setValue( p.x() - PHOTO_OFFSET); img->y().setValue( p.y() + PHOTO_OFFSET); img->quality().setValue( 1.); img->visible().setValue( 1.); break; default: img->x().setValue( p.x()); img->y().setValue( p.y()); img->visible().setValue( 0.); break; } img->imageParent().setValue(1.); img->scale().setValue( SMALL_ZOOM * .7); int rotate = (qrand() % 40) - 20; img->rotate().setValue(rotate); img->imageParent().setValue(1.); } GfxCanvasItem *i = nameItem(); i->visible().setValue(1.); }
void AppSettings::getThemes(QString selTheme, QString themeDir){ //Getting installed themes QString aughtor="", license=""; QDir tmp(themeDir); tmp.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot); QFileInfoList list = tmp.entryInfoList(); // Getting converted icons from temp directory for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); std::auto_ptr<QListWidgetItem> iconItem (new QListWidgetItem(listThemesView, 0)); QFile file(QString("%1/%2/theme.info").arg(themeDir).arg(fileInfo.fileName())); if (file.open(QIODevice::ReadOnly | QIODevice::Text)){ aughtor = file.readLine(); aughtor.remove ( "\n" ); license = file.readLine(); } if ((!aughtor.isEmpty()) and (!license.isEmpty())){ iconItem->setText(QString("%1 [%2; %3]").arg(fileInfo.fileName()).arg(aughtor).arg(license)); } else { iconItem->setText(fileInfo.fileName()); } iconItem->setToolTip(QString("%1/%2").arg(themeDir).arg(fileInfo.fileName())); iconItem->setIcon(QIcon(QString("%1/%2/data/wine.png").arg(themeDir).arg(fileInfo.fileName()))); if (!selTheme.isNull()){ if (selTheme==fileInfo.filePath()){ //Setting selection to selected theme listThemesView->setCurrentItem(iconItem.release()); //Loading pixmaps from theme //loadThemeIcons(fileInfo.filePath()); } } } return; }
void ImageCollection::layoutCollapsed() { tl.complete(); _collapseLayer.moveToParent(&_iconItem); QPoint p = collapsePoint(); int seenOnScreen = 0; int f = focused(); _collapseLayer.z().setValue(-10000.); for(int ii = count() - 1; ii >= 0; --ii) { Image *img = image(ii); img->moveToParent(iconItem()); if(!isOnScreen(ii)) continue; seenOnScreen++; int pauseTime = (seenOnScreen - 1) * 50; tl.pause(img->x(), pauseTime); tl.pause(img->y(), pauseTime); tl.pause(img->rotate(), pauseTime); img->z().setValue(-ii); if(ii == f) { tl.move(img->scale(), SMALL_ZOOM, 50); tl.sync(img->z(), img->scale()); img->z().setValue(1); tl.set(img->z(), -ii); if(pauseTime > 50) tl.pause(img->scale(), pauseTime - 50); } else { tl.pause(img->scale(), pauseTime); } } seenOnScreen = 0; for(int ii = 0; ii < count(); ++ii) { if(!isOnScreen(ii)) continue; seenOnScreen++; Image *img = image(ii); #define PHOTO_OFFSET 7 int idx = seenOnScreen; switch(idx) { case 0: tl.move(img->x(), p.x() - PHOTO_OFFSET, 150); tl.move(img->y(), p.y() - PHOTO_OFFSET, 150); tl.sync(img->quality(), img->x()); tl.set(img->quality(), 1.); break; case 1: tl.move(img->x(), p.x() + PHOTO_OFFSET, 150); tl.move(img->y(), p.y() - PHOTO_OFFSET, 150); tl.sync(img->quality(), img->x()); tl.set(img->quality(), 1.); break; case 2: tl.move(img->x(), p.x() + PHOTO_OFFSET, 150); tl.move(img->y(), p.y() + PHOTO_OFFSET, 150); tl.sync(img->quality(), img->x()); tl.set(img->quality(), 1.); break; case 3: tl.move(img->x(), p.x() - PHOTO_OFFSET, 150); tl.move(img->y(), p.y() + PHOTO_OFFSET, 150); tl.sync(img->quality(), img->x()); tl.set(img->quality(), 1.); break; default: tl.move(img->x(), p.x(), 150); tl.move(img->y(), p.y(), 150); //tl.set(img->quality(), 0.); break; } int rotate = (qrand() % 40) - 20; if(isOnScreen(ii)) { tl.move(img->scale(), SMALL_ZOOM * .7, 150); tl.move(img->rotate(), rotate, 150); tl.sync(image(ii)->imageParent(), image(ii)->x()); tl.set(image(ii)->imageParent(), 1.); } else { img->scale().setValue(SMALL_ZOOM * .7); img->rotate().setValue(rotate); img->visible().setValue(0.); img->imageParent().setValue(1.); } } tl.sync(); seenOnScreen = 0; for(int ii = 0; ii < count(); ++ii) { if(!isOnScreen(ii)) continue; seenOnScreen++; if(seenOnScreen > 4) tl.set(image(ii)->visible(), 0.); } GfxCanvasItem *i = nameItem(); tl.move(i->visible(), 1., 300); }
AppSettings::AppSettings(QWidget * parent, Qt::WFlags f) : QDialog(parent, f) { // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib calss pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); setupUi(this); splitter.reset(new QSplitter(widgetContent)); splitter->addWidget(optionsTreeWidget); splitter->addWidget(optionsStack); QList<int> size; size << 150 << 150; splitter->setSizes(size); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); vlayout->addWidget(splitter.release()); vlayout->setMargin(0); vlayout->setSpacing(0); widgetContent->setLayout(vlayout.release()); setWindowTitle(tr("%1 settings").arg(APP_NAME)); lblCaption->setText(tr("%1 settings").arg(APP_NAME)); connect(optionsTree, SIGNAL(itemClicked (QTreeWidgetItem *, int)), this, SLOT(optionsTree_itemClicked ( QTreeWidgetItem *, int))); connect(cmdCancel, SIGNAL(clicked()), this, SLOT(cmdCancel_Click())); connect(cmdOk, SIGNAL(clicked()), this, SLOT(cmdOk_Click())); connect(cmdHelp, SIGNAL(clicked()), this, SLOT(cmdHelp_Click())); connect(comboProxyType, SIGNAL(currentIndexChanged(QString)), this, SLOT(comboProxyType_indexChanged(QString))); //Installing event filters for get buttuns cmdGetWineBin->installEventFilter(this); cmdGetWineServerBin->installEventFilter(this); cmdGetWineLoaderBin->installEventFilter(this); cmdGetWineLibs->installEventFilter(this); cmdGetTarBin->installEventFilter(this); cmdGetMountBin->installEventFilter(this); cmdGetUmountBin->installEventFilter(this); cmdGetSudoBin->installEventFilter(this); cmdGetGuiSudoBin->installEventFilter(this); cmdGetNiceBin->installEventFilter(this); cmdGetReniceBin->installEventFilter(this); cmdGetConsoleBin->installEventFilter(this); cmdGetShBin->installEventFilter(this); QSettings settings(APP_SHORT_NAME, "default"); settings.beginGroup("wine"); txtWineBin->setText(settings.value("WineBin").toString()); txtWineServerBin->setText(settings.value("ServerBin").toString()); txtWineLoaderBin->setText(settings.value("LoaderBin").toString()); txtWineLibs->setText(settings.value("WineLibs").toString()); settings.endGroup(); settings.beginGroup("logging"); connect (cbShowTray, SIGNAL(stateChanged (int)), this, SLOT(cbShowTray_stateChanged (int))); if (settings.value("autoClear", 1).toInt()==1){ cbClearLogs->setCheckState(Qt::Checked); } else { cbClearLogs->setCheckState(Qt::Unchecked); } settings.endGroup(); settings.beginGroup("app"); if (settings.value("showTrareyIcon", 0).toInt()==1){ cbShowTray->setCheckState(Qt::Checked); } else { cbShowTray->setCheckState(Qt::Unchecked); } if (settings.value("showNotifications", 1).toInt()==1){ cbShowNotifications->setCheckState(Qt::Checked); } else { cbShowNotifications->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTray", 0).toInt()==1){ cbMinimizeToTray->setCheckState(Qt::Checked); } else { cbMinimizeToTray->setCheckState(Qt::Unchecked); } if (settings.value("minimizeToTrayAtAppStart", 0).toInt()==1){ cbMinimizeToTrayApp->setCheckState(Qt::Checked); } else { cbMinimizeToTrayApp->setCheckState(Qt::Unchecked); } listThemesView->clear(); std::auto_ptr<QListWidgetItem> iconItem (new QListWidgetItem(listThemesView, 0)); iconItem->setText("Default [Aughtor: Xavier Corredor Llano ([email protected]); License: GPL v.2.1]"); iconItem->setIcon(QIcon(":data/wine.png")); iconItem->setToolTip("Default"); listThemesView->setSelectionMode(QAbstractItemView::SingleSelection); QString themeDir=""; themeDir.append(QDir::homePath()); themeDir.append("/.config/"); themeDir.append(APP_SHORT_NAME); themeDir.append("/theme/"); getThemes(settings.value("theme").toString(), themeDir); loadThemeIcons(); if (settings.value("theme").toString()=="Default"){ listThemesView->setCurrentItem(iconItem.release()); } themeDir.clear(); #ifdef _OS_DARWIN_ themeDir.append(QDir::currentPath()); themeDir.append("/"); themeDir.append(APP_SHORT_NAME); themeDir.append(".app/Contents/Resources/theme"); #else themeDir.append(APP_PREF); themeDir.append("/share/"); themeDir.append(APP_SHORT_NAME); themeDir.append("/theme"); #endif getThemes(settings.value("theme").toString(), themeDir); getLangs(); if (settings.value("lang").toString().isEmpty()){ comboLangs->setCurrentIndex(comboLangs->findText(tr("System Default"))); } else { comboLangs->setCurrentIndex(comboLangs->findText(settings.value("lang").toString())); } settings.endGroup(); settings.beginGroup("system"); txtTarBin->setText(settings.value("tar").toString()); txtMountBin->setText(settings.value("mount").toString()); txtUmountBin->setText(settings.value("umount").toString()); txtSudoBin->setText(settings.value("sudo").toString()); txtGuiSudoBin->setText(settings.value("gui_sudo").toString()); txtNiceBin->setText(settings.value("nice").toString()); txtReniceBin->setText(settings.value("renice").toString()); txtShBin->setText(settings.value("sh").toString()); settings.endGroup(); settings.beginGroup("console"); txtConsoleBin->setText(settings.value("bin").toString()); txtConsoleArgs->setText(settings.value("args").toString()); settings.endGroup(); settings.beginGroup("quickmount"); comboMountProfiles->setCurrentIndex(settings.value("type", 0).toInt()); connect(comboMountProfiles, SIGNAL(currentIndexChanged(int)), this, SLOT(comboMountProfiles_currentIndexChanged(int))); if (!settings.value("mount_drive_string").toString().isEmpty()) txtMountString->setText(settings.value("mount_drive_string").toString()); if (!settings.value("mount_image_string").toString().isEmpty()) txtMountImageString->setText(settings.value("mount_image_string").toString()); if (!settings.value("umount_string").toString().isEmpty()) txtUmountString->setText(settings.value("umount_string").toString()); settings.endGroup(); #ifdef WITH_ICOUTILS settings.beginGroup("icotool"); txtWrestoolBin->setText(settings.value("wrestool").toString()); txtIcotoolBin->setText(settings.value("icotool").toString()); settings.endGroup(); cmdGetWrestoolBin->installEventFilter(this); cmdGetIcotoolBin->installEventFilter(this); #else txtWrestoolBin->setEnabled(false); txtIcotoolBin->setEnabled(false); cmdGetWrestoolBin->setEnabled(false); cmdGetIcotoolBin->setEnabled(false); #endif settings.beginGroup("network"); txtProxyHost->setText(settings.value("host").toString()); txtProxyPort->setText(settings.value("port").toString()); txtProxyUser->setText(settings.value("user").toString()); txtProxyPass->setText(settings.value("pass").toString()); comboProxyType->setCurrentIndex(settings.value("type").toInt()); settings.endGroup(); #ifdef _OS_FREEBSD_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); #endif #ifdef _OS_DARWIN_ this->comboMountProfiles->removeItem(3); this->comboMountProfiles->removeItem(2); this->comboMountProfiles->removeItem(1); this->comboMountProfiles->setItemText(0, tr("generic")); this->txtMountString->setEnabled(false); this->frameMount->setVisible(false); #endif settings.beginGroup("advanced"); if (settings.value("openRunDialog", 0).toInt()==0){ cbOpenRunDialog->setChecked(false); } else { cbOpenRunDialog->setChecked(true); } if (settings.value("useSingleClick", 0).toInt()==0){ cbUseSingleClick->setChecked(false); } else { cbUseSingleClick->setChecked(true); } #if QT_VERSION >= 0x040500 if (settings.value("useNativeFileDialog", 1).toInt()==1){ cbUseNativeDialog->setChecked(true); } else { cbUseNativeDialog->setChecked(false); } #else cbUseNativeDialog->setEnabled(false); #endif QString res = settings.value("defaultDesktopSize").toString(); if (res.isEmpty()){ cboxDesktopSize->setCurrentIndex(0); } else { cboxDesktopSize->setCurrentIndex(cboxDesktopSize->findText(res)); } settings.endGroup(); settings.beginGroup("DesktopImport"); if (settings.value("remove", 0).toInt()==0){ cbRemoveDesktopFiles->setChecked(false); } else { cbRemoveDesktopFiles->setChecked(true); } if (settings.value("importAtStartup", 0).toInt()==0){ cbImportDesktopFilesAtStartup->setChecked(false); } else { cbImportDesktopFilesAtStartup->setChecked(true); } settings.endGroup(); settings.beginGroup("AppDB"); if (settings.value("useSystemBrowser", 1).toInt()==1){ cbUseSystemBrowser->setChecked(true); } else { cbUseSystemBrowser->setChecked(false); } settings.endGroup(); QList<QTreeWidgetItem *> items = optionsTree->findItems (tr("General"), Qt::MatchExactly); if (items.count()>0){ items.at(0)->setExpanded(true); optionsTree->setCurrentItem(items.at(0)); optionsStack->setCurrentIndex(0); tabwGeneral->setCurrentIndex(0); } cmdOk->setFocus(Qt::ActiveWindowFocusReason); return; }