Merge pull request #429 from AttorneyOnline/fix/continuous-bg
Fix continuous playback being nonfunctional on non-CharLayer elements, and allow users to toggle the feature
This commit is contained in:
		
						commit
						580313cbcd
					
				@ -222,6 +222,10 @@ public:
 | 
				
			|||||||
  // for settings.
 | 
					  // for settings.
 | 
				
			||||||
  bool is_customchat_enabled();
 | 
					  bool is_customchat_enabled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Returns the value of whether continuous playback should be used
 | 
				
			||||||
 | 
					  // from the config.ini.
 | 
				
			||||||
 | 
					  bool is_continuous_enabled();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  // Returns the value of the maximum amount of lines the IC chatlog
 | 
					  // Returns the value of the maximum amount of lines the IC chatlog
 | 
				
			||||||
  // may contain, from config.ini.
 | 
					  // may contain, from config.ini.
 | 
				
			||||||
  int get_max_log_size();
 | 
					  int get_max_log_size();
 | 
				
			||||||
 | 
				
			|||||||
@ -99,6 +99,9 @@ private:
 | 
				
			|||||||
  QLabel *ui_customchat_lbl;
 | 
					  QLabel *ui_customchat_lbl;
 | 
				
			||||||
  QCheckBox *ui_customchat_cb;
 | 
					  QCheckBox *ui_customchat_cb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  QLabel *ui_continuous_lbl;
 | 
				
			||||||
 | 
					  QCheckBox *ui_continuous_cb;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QWidget *ui_callwords_tab;
 | 
					  QWidget *ui_callwords_tab;
 | 
				
			||||||
  QWidget *ui_callwords_widget;
 | 
					  QWidget *ui_callwords_widget;
 | 
				
			||||||
  QVBoxLayout *ui_callwords_layout;
 | 
					  QVBoxLayout *ui_callwords_layout;
 | 
				
			||||||
 | 
				
			|||||||
@ -325,6 +325,11 @@ void AOLayer::start_playback(QString p_image)
 | 
				
			|||||||
  if (!file_exists(p_image))
 | 
					  if (!file_exists(p_image))
 | 
				
			||||||
    return;
 | 
					    return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (!ao_app->is_continuous_enabled()) {
 | 
				
			||||||
 | 
					    continuous = false;
 | 
				
			||||||
 | 
					    force_continuous = true;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QString scaling_override =
 | 
					  QString scaling_override =
 | 
				
			||||||
      ao_app->read_design_ini("scaling", p_image + ".ini");
 | 
					      ao_app->read_design_ini("scaling", p_image + ".ini");
 | 
				
			||||||
  if (scaling_override != "")
 | 
					  if (scaling_override != "")
 | 
				
			||||||
@ -351,12 +356,13 @@ void AOLayer::start_playback(QString p_image)
 | 
				
			|||||||
    frame = 0;
 | 
					    frame = 0;
 | 
				
			||||||
    continuous = false;
 | 
					    continuous = false;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  // CANTFIX: this causes a slight hitch
 | 
					  // CANTFIX: this causes a hitch
 | 
				
			||||||
  // The correct way of doing this would be to use QImageReader::jumpToImage()
 | 
					  // The correct way of doing this would be to use QImageReader::jumpToImage()
 | 
				
			||||||
  // and populate missing data in the movie ticker when it's needed. This is
 | 
					  // and populate missing data in the movie ticker when it's needed. This is
 | 
				
			||||||
  // unforunately completely impossible, because QImageReader::jumpToImage() is
 | 
					  // unfortunately completely impossible, because QImageReader::jumpToImage() is
 | 
				
			||||||
  // not implemented in any image format AO2 is equipped to use. Instead, the
 | 
					  // not implemented in any image format AO2 is equipped to use. Instead, the
 | 
				
			||||||
  // default behavior is used - that is, absolutely nothing.
 | 
					  // default behavior is used - that is, absolutely nothing.
 | 
				
			||||||
 | 
					  // This is why continuous playback can be toggled off.
 | 
				
			||||||
  if (continuous) {
 | 
					  if (continuous) {
 | 
				
			||||||
    for (int i = frame; i--;) {
 | 
					    for (int i = frame; i--;) {
 | 
				
			||||||
      if (i <= -1)
 | 
					      if (i <= -1)
 | 
				
			||||||
@ -368,6 +374,7 @@ void AOLayer::start_playback(QString p_image)
 | 
				
			|||||||
      // qDebug() << "appending delay of " << l_delay;
 | 
					      // qDebug() << "appending delay of " << l_delay;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					  last_path = p_image;
 | 
				
			||||||
  // qDebug() << "CONT: " << continuous << " MAX: " << max_frames
 | 
					  // qDebug() << "CONT: " << continuous << " MAX: " << max_frames
 | 
				
			||||||
  //         << " LAST MAX: " << last_max_frames << " FRAME: " << frame;
 | 
					  //         << " LAST MAX: " << last_max_frames << " FRAME: " << frame;
 | 
				
			||||||
  QPixmap f_pixmap = this->get_pixmap(m_reader.read());
 | 
					  QPixmap f_pixmap = this->get_pixmap(m_reader.read());
 | 
				
			||||||
 | 
				
			|||||||
@ -459,6 +459,19 @@ AOOptionsDialog::AOOptionsDialog(QWidget *parent, AOApplication *p_ao_app)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb);
 | 
					  ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_customchat_cb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  row += 1;
 | 
				
			||||||
 | 
					  ui_continuous_lbl = new QLabel(ui_form_layout_widget);
 | 
				
			||||||
 | 
					  ui_continuous_lbl->setText(tr("Continuous Playback:"));
 | 
				
			||||||
 | 
					  ui_continuous_lbl->setToolTip(
 | 
				
			||||||
 | 
					      tr("Whether or not to resume playing animations from where they left off. Turning off might reduce lag."));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_gameplay_form->setWidget(row, QFormLayout::LabelRole, ui_continuous_lbl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_continuous_cb = new QCheckBox(ui_form_layout_widget);
 | 
				
			||||||
 | 
					  ui_continuous_cb->setChecked(ao_app->is_continuous_enabled());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  ui_gameplay_form->setWidget(row, QFormLayout::FieldRole, ui_continuous_cb);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  QScrollArea *scroll = new QScrollArea(this);
 | 
					  QScrollArea *scroll = new QScrollArea(this);
 | 
				
			||||||
  scroll->setWidget(ui_form_layout_widget);
 | 
					  scroll->setWidget(ui_form_layout_widget);
 | 
				
			||||||
  ui_gameplay_tab->setLayout(new QVBoxLayout);
 | 
					  ui_gameplay_tab->setLayout(new QVBoxLayout);
 | 
				
			||||||
@ -872,6 +885,7 @@ void AOOptionsDialog::save_pressed()
 | 
				
			|||||||
  configini->setValue("stickypres", ui_stickypres_cb->isChecked());
 | 
					  configini->setValue("stickypres", ui_stickypres_cb->isChecked());
 | 
				
			||||||
  configini->setValue("customchat", ui_customchat_cb->isChecked());
 | 
					  configini->setValue("customchat", ui_customchat_cb->isChecked());
 | 
				
			||||||
  configini->setValue("automatic_logging_enabled", ui_log_cb->isChecked());
 | 
					  configini->setValue("automatic_logging_enabled", ui_log_cb->isChecked());
 | 
				
			||||||
 | 
					  configini->setValue("continuous_playback", ui_continuous_cb->isChecked());
 | 
				
			||||||
  QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
 | 
					  QFile *callwordsini = new QFile(ao_app->get_base_path() + "callwords.ini");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
 | 
					  if (callwordsini->open(QIODevice::WriteOnly | QIODevice::Truncate |
 | 
				
			||||||
 | 
				
			|||||||
@ -1095,6 +1095,12 @@ bool AOApplication::is_customchat_enabled()
 | 
				
			|||||||
  return result.startsWith("true");
 | 
					  return result.startsWith("true");
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool AOApplication::is_continuous_enabled()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  QString result = configini->value("continuous_playback", "true").value<QString>();
 | 
				
			||||||
 | 
					  return result.startsWith("true");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool AOApplication::get_casing_enabled()
 | 
					bool AOApplication::get_casing_enabled()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  QString result = configini->value("casing_enabled", "false").value<QString>();
 | 
					  QString result = configini->value("casing_enabled", "false").value<QString>();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user