Ejemplo n.º 1
0
const String JucerFillType::toString() const
{
    switch (mode)
    {
    case solidColour:
        return T("solid: ") + colourToHex (colour);

    case linearGradient:
    case radialGradient:
        return (mode == linearGradient ? T("linear: ")
                                       : T(" radial: "))
                + positionToString (gradPos1)
                + T(", ")
                + positionToString (gradPos2)
                + T(", 0=") + colourToHex (gradCol1)
                + T(", 1=") + colourToHex (gradCol2);

    case imageBrush:
        return T("image: ") + imageResourceName
                + T(", ")
                + String (imageOpacity)
                + T(", ")
                + positionToString (imageAnchor);

    default:
        jassertfalse
        break;
    }

    return String::empty;
}
Ejemplo n.º 2
0
QVariant PositionModel::data(const QModelIndex &index, int role) const
{
  if (!index.isValid() || (role != Qt::DisplayRole))
    return QVariant();

  switch (index.column())
  {
    case 0:
      return positionToString(static_cast<Wally::Application::Position> (index.row()));
      break;

    case 1:
      switch (static_cast<Wally::Application::Position> (index.row()))
      {
        case Wally::Application::Centered:
          return ":/images/centered";

        case Wally::Application::Tiled:
          return ":/images/tiled";

        case Wally::Application::CenterTiled:
          return ":/images/center_tiled";

        case Wally::Application::CenteredMaxpect:
          return ":/images/centered_maxpect";

        case Wally::Application::TiledMaxpect:
          return ":/images/tiled_maxpect";

        case Wally::Application::Scaled:
          return ":/images/scaled";

        case Wally::Application::CenteredAutoFit:
          return ":/images/centered_autofit";

        case Wally::Application::ScaleAndCrop:
          return ":/images/scale_crop";

        case Wally::Application::SymmetricalTiled:
          return ":/images/symmetrical_tiled";

        case Wally::Application::MirroredTiled:
          return ":/images/mirrored_tiled";

        case Wally::Application::SymmetricalMirroredTiled:
          return ":/images/symmetrical_mirrored_tiled";
      }
  }

  return QVariant();
}
Ejemplo n.º 3
0
void SettingsDialog::on_pbPosition_clicked()
{
  QScopedPointer< Gui::Dialog > dialog(new Gui::Dialog(Gui::Dialog::CenterOfScreen,this));
  PositionModel *model = new PositionModel(dialog.data());
  QTableView *view = new QTableView(dialog.data());
  QItemSelectionModel *selectionModel = new QItemSelectionModel(model,dialog.data());

  dialog->setWindowTitle(tr("Set position"));

  QVBoxLayout *layout = new QVBoxLayout;
  QDialogButtonBox *dialogButtons = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
                                                         Qt::Horizontal,dialog.data());
  connect(dialogButtons,SIGNAL(accepted()),dialog.data(),SLOT(accept()));
  connect(dialogButtons,SIGNAL(rejected()),dialog.data(),SLOT(reject()));

  view->setModel(model);
  view->setItemDelegateForColumn(0,new PositionLabelDelegate);
  view->setItemDelegateForColumn(1,new PositionDelegate(QApplication::palette()));
  view->setSelectionBehavior(QAbstractItemView::SelectRows);
  view->setSelectionMode(QAbstractItemView::SingleSelection);
  view->setSelectionModel(selectionModel);
  view->verticalHeader()->setVisible(false);
  view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
  view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
  view->setEditTriggers(QAbstractItemView::NoEditTriggers);

  layout->addWidget(view);
  layout->addWidget(dialogButtons);
  dialog->setLayout(layout);
  dialog->resize(700,500);
  connect(dialog.data(),SIGNAL(executed()),view,SLOT(resizeColumnsToContents()));
  connect(dialog.data(),SIGNAL(executed()),view,SLOT(resizeRowsToContents()));

  selectionModel->select(model->index(pbPosition->property("wallPosition").toInt(),0),
                         QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
  view->scrollTo(model->index(pbPosition->property("wallPosition").toInt(),0));
  if (dialog->exec() == QDialog::Accepted)
  {
    Wally::Application::Position p = static_cast<Wally::Application::Position> (selectionModel->currentIndex().row());
    pbPosition->setProperty("wallPosition",static_cast<int> (p));
    pbPosition->setText(positionToString(p).replace("&","&&"));
    settingsModified();
  }
}
Ejemplo n.º 4
0
void SettingsDialog::loadSettings(const WallySettings &mainSettings)
{
  _settings = mainSettings;
  QColor borderColor = _settings.value(MAIN_SECTION).value(BORDER_COLOR).toString();
  borderColor.setAlpha(_settings.value(MAIN_SECTION).value(AUTO_COLOR).toBool()? 0 : 255);

  loadingSettings = true;
  sbInterval->setValue(_settings.value(MAIN_SECTION).value(INTERVAL).toInt());
  cbIntervalUnit->setCurrentIndex(cbIntervalUnit->findData(_settings.value(MAIN_SECTION).value(INTERVAL_UNIT)));
  pbBorderColor->setColor(borderColor);
  pbPosition->setProperty("wallPosition",_settings.value(MAIN_SECTION).value(WALLPAPER_POSITION));
  pbPosition->setText(positionToString(static_cast<Wally::Application::Position> (_settings.value(MAIN_SECTION).value(WALLPAPER_POSITION).toInt())).replace("&","&&"));
  cbSwitchOnPlay->setChecked(_settings.value(MAIN_SECTION).value(SWITCH_ON_PLAY).toBool());
  cbAutoPlay->setChecked(_settings.value(MAIN_SECTION).value(PLAY_ON_START).toBool());
  cbAutoLaunchOnSysStart->setChecked(_settings.value(MAIN_SECTION).value(RUN_ON_SYS_START).toBool());
  cbOnlyLandscapes->setChecked(_settings.value(MAIN_SECTION).value(ONLY_LANDSCAPES).toBool());
  cbRotateImages->setChecked(_settings.value(MAIN_SECTION).value(EXIF_ROTATE_IMAGES).toBool());
  cbSizeConstraint->setCurrentIndex(_settings.value(MAIN_SECTION).value(SIZE_CONSTRAINT).toInt());
  cbViewInfoInTooltip->setChecked(_settings.value(MAIN_SECTION).value(VIEW_INFO_IN_TOOLTIP).toBool());
  cbDisableSplashScreen->setChecked(_settings.value(MAIN_SECTION).value(DISABLE_SPLASH_SCREEN).toBool());
  cbQuitAfterBackgroundChange->setChecked(_settings.value(MAIN_SECTION).value(QUIT_AFTER_BACKGROUND_CHANGE).toBool());
  cbRandomOrder->setChecked(_settings.value(MAIN_SECTION).value(RANDOM_SEARCH).toBool());
  cbUseFullDesktop->setChecked(_settings.value(MAIN_SECTION).value(USE_FULL_DESKTOP_AREA).toBool());
  cbViewInfoOnPhoto->setChecked(_settings.value(MAIN_SECTION).value(VIEW_INFO_ON_PHOTO).toBool());
  cbInfoPositionOnPhoto->setCurrentIndex(
    cbInfoPositionOnPhoto->findData(_settings.value(MAIN_SECTION).value(INFO_POSITION_ON_PHOTO).toInt()));
  sbFreeDiskSpace->setValue(_settings.value(MAIN_SECTION).value(MIN_FREE_DISK_SPACE).toInt());
  cbFreeDiskSpaceFactor->setCurrentIndex(
    cbFreeDiskSpaceFactor->findData(_settings.value(MAIN_SECTION).value(MIN_FREE_DISK_SPACE_FACTOR).toInt()));
  sbHistoryTimeLimit->setValue(_settings.value(MAIN_SECTION).value(HISTORY_TIME_LIMIT).toInt());
  cbHistoryTimeLimitFactor->setCurrentIndex(_settings.value(MAIN_SECTION).value(HISTORY_TIME_LIMIT_FACTOR).toInt());
  rbDirectConnection->setChecked(!_settings.value(NETWORK_SECTION).value(USE_PROXY).toBool());
  rbProxyConnection->setChecked(_settings.value(NETWORK_SECTION).value(USE_PROXY).toBool());
  rbSystemProxy->setChecked(_settings.value(NETWORK_SECTION).value(USE_SYSTEM_PROXY).toBool());
  rbCustomProxy->setChecked(!_settings.value(NETWORK_SECTION).value(USE_SYSTEM_PROXY).toBool());
  cbProxyType->setCurrentIndex(cbProxyType->findData(_settings.value(NETWORK_SECTION).value(PROXY_TYPE).toInt()));
  leProxyServer->setText(_settings.value(NETWORK_SECTION).value(PROXY_SERVER).toString());
  sbProxyPort->setValue(_settings.value(NETWORK_SECTION).value(PROXY_PORT).toInt());
  cbProxyAuthentication->setChecked(_settings.value(NETWORK_SECTION).value(PROXY_AUTHENTICATION).toBool());
  leProxyUsername->setText(_settings.value(NETWORK_SECTION).value(PROXY_USERNAME).toString());
  leProxyPassword->setText(_settings.value(NETWORK_SECTION).value(PROXY_PASSWORD).toString());
  loadingSettings = false;
}