Пример #1
0
bool TimeSig::setProperty(P_ID propertyId, const QVariant& v)
      {
      switch (propertyId) {
            case P_ID::SHOW_COURTESY:
                  if (generated())
                        return false;
                  setShowCourtesySig(v.toBool());
                  break;
            case P_ID::NUMERATOR_STRING:
                  setNumeratorString(v.toString());
                  break;
            case P_ID::DENOMINATOR_STRING:
                  setDenominatorString(v.toString());
                  break;
            case P_ID::GROUPS:
                  setGroups(v.value<Groups>());
                  break;
            case P_ID::TIMESIG:
                  setSig(v.value<Fraction>());
                  break;
            case P_ID::TIMESIG_GLOBAL:
                  setGlobalSig(v.value<Fraction>());
                  break;
            case P_ID::TIMESIG_STRETCH:
                  setStretch(v.value<Fraction>());
                  break;
            case P_ID::TIMESIG_TYPE:
                  _timeSigType = (TimeSigType)(v.toInt());
                  break;
            case P_ID::SCALE:
                  _scale = v.toSizeF();
                  break;
            default:
                  if (!Element::setProperty(propertyId, v))
                        return false;
                  break;
            }
      score()->setLayoutAll();      // TODO
      setGenerated(false);
      return true;
      }
Пример #2
0
shared_ptr<StackItem> StackItem::deserialize(const BinaryDataRef& dataRef)
{
   shared_ptr<StackItem> itemPtr;

   BinaryRefReader brr(dataRef);

   auto id = brr.get_uint32_t();
   auto prefix = brr.get_uint8_t();

   switch (prefix)
   {
   case STACKITEM_PUSHDATA_PREFIX:
   {
      auto len = brr.get_var_int();
      auto&& data = brr.get_BinaryData(len);

      itemPtr = make_shared<StackItem_PushData>(id, move(data));
      break;
   }

   case STACKITEM_SIG_PREFIX:
   {
      auto len = brr.get_var_int();
      SecureBinaryData data(brr.get_BinaryData(len));

      itemPtr = make_shared<StackItem_Sig>(id, move(data));
      break;
   }

   case STACKITEM_MULTISIG_PREFIX:
   {
      auto m = brr.get_uint16_t();
      auto item_ms = make_shared<StackItem_MultiSig>(id, m);

      auto count = brr.get_var_int();
      for (unsigned i = 0; i < count; i++)
      {
         auto pos = brr.get_uint16_t();
         auto len = brr.get_var_int();
         SecureBinaryData data(brr.get_BinaryData(len));

         item_ms->setSig(pos, data);
      }

      itemPtr = item_ms;
      break;
   }

   case STACKITEM_OPCODE_PREFIX:
   {
      auto opcode = brr.get_uint8_t();

      itemPtr = make_shared<StackItem_OpCode>(id, opcode);
      break;
   }

   case STACKITEM_SERSCRIPT_PREFIX:
   {
      auto len = brr.get_var_int();
      auto&& data = brr.get_BinaryData(len);

      itemPtr = make_shared<StackItem_SerializedScript>(id, move(data));
      break;
   }

   default:
      throw runtime_error("unexpected stack item prefix");
   }

   return itemPtr;
}
Пример #3
0
void NoteGroups::resetClicked()
      {
      setSig(_sig, _groups);
      }