text:
<?php

namespace ElkArte\Sessions;

use ElkArte\ValuesContainer;

/**
 * Class SessionIndex
 */
class SessionIndex extends ValuesContainer
{
	protected $_idx = '';

	/**
	 * Constructor
	 *
	 * @param string $idx The index of to be used in $_SESSION
	 * @param array|null $data Any array of data used to initialize the object (optional)
	 */
	public function __construct($idx, $data = null)
	{
		$this->_idx = $idx;

		if (!isset($_SESSION[$this->_idx]))
		{
			$_SESSION[$this->_idx] = $data === null ? array() : (array) $data;
		}

		$this->data = &$_SESSION[$this->_idx];
	}
}


text:
@font-face {
	font-family: 'toolbar';
	src:url('fonts/toolbar.eot');
	src:url('fonts/toolbar.eot?#iefix') format('embedded-opentype'),
		url('fonts/toolbar.woff') format('woff'),
		url('fonts/toolbar.ttf') format('truetype'),
		url('fonts/toolbar.svg#toolbar') format('svg');
	font-weight: normal;
	font-style: normal;
}

/* Use the following CSS code if you want to use data attributes for inserting your icons */
[data-icon]:before {
	font-family: 'toolbar';
	content: attr(data-icon);
	speak: none;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
}

/* Use the following CSS code if you want to have a class per icon */
/*
Instead of a list of all class selectors,
you can use the generic selector below, but it's slower:
[class*="icon-"] {
*/
.icon-file, .icon-image, .icon-zoom-out, .icon-zoom-in, .icon-expand, .icon-expand-2, .icon-folder-open, .icon-folder, .icon-cog, .icon-menu, .icon-wrench, .icon-settings, .icon-loop, .icon-pin, .icon-first, .icon-last, .icon-arrow-left, .icon-arrow-right, .icon-arrow-left-2, .icon-arrow-right-2, .icon-arrow-left-3, .icon-arrow-right-3, .icon-previous, .icon-next, .icon-droplet, .icon-adjust, .icon-sun, .icon-remove-sign, .icon-remove, .icon-copy {
	font-family: 'toolbar';
	speak: none;
	font-style: normal;
	font-weight: normal;
	font-variant: normal;
	text-transform: none;
	line-height: 1;
	-webkit-font-smoothing: antialiased;
}
.icon-file:before {
	content: "\e000";
}
.icon-image:before {
	content: "\e001";
}
.icon-zoom-out:before {
	content: "\e002";
}
.icon-zoom-in:before {
	content: "\e003";
}
.icon-expand:before {
	content: "\e004";
}
.icon-expand-2:before {
	content: "\e005";
}
.icon-folder-open:before {
	content: "\e006";
}
.icon-folder:before {
	content: "\e007";
}
.icon-cog:before {
	content: "\e008";
}
.icon-menu:before {
	content: "\e009";
}
.icon-wrench:before {
	content: "\e00a";
}
.icon-settings:before {
	content: "\e00b";
}
.icon-loop:before {
	content: "\e00c";
}
.icon-pin:before {
	content: "\e00d";
}
.icon-first:before {
	content: "\e00e";
}
.icon-last:before {
	content: "\e00f";
}
.icon-arrow-left:before {
	content: "\e011";
}
.icon-arrow-right:before {
	content: "\e010";
}
.icon-arrow-left-2:before {
	content: "\e012";
}
.icon-arrow-right-2:before {
	content: "\e013";
}
.icon-arrow-left-3:before {
	content: "\e014";
}
.icon-arrow-right-3:before {
	content: "\e015";
}
.icon-previous:before {
	content: "\e016";
}
.icon-next:before {
	content: "\e017";
}
.icon-droplet:before {
	content: "\e01a";
}
.icon-adjust:before {
	content: "\f042";
}
.icon-sun:before {
	content: "\e018";
}
.icon-remove-sign:before {
	content: "\f057";
}
.icon-remove:before {
	content: "\f00d";
}
.icon-copy:before {
	content: "\e037";
}
/* v1.0 | 20080212 */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
	margin: 0;
	padding: 0;
	border: 0;
	outline: 0;
	font-size: 100%;
	vertical-align: baseline;
	background: transparent;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}

/* remember to define focus styles! */
:focus {
	outline: 0;
}

/* remember to highlight inserts somehow! */
ins {
	text-decoration: none;
}
del {
	text-decoration: line-through;
}

/* tables still need 'cellspacing="0"' in the markup */
table {
	border-collapse: collapse;
	border-spacing: 0;
}

.cb-control {
	font-family: helvetica, arial, sans-serif;
	font-size: 12px;
}

.cb-control {
	color: #fff;
	background-color: #111;
	padding: 10px;
	position: fixed !important;
	box-shadow: 0 0 4px #000;
}

.navigate {
	top: 0;
	margin: 0;
	cursor: pointer;
	width: 128px;
	opacity: 0;
	background: center no-repeat;
	box-shadow: none;
	padding: 0 3em;
}

.navigate > span {
	color: #000;
	font-size: 10em;
	background-color: rgba(255, 255, 255, 0.8);
	border-radius: 1em;
	top: 35%;
	position: relative;
}

body:not(.mobile) .navigate:hover {
	opacity: 1;
}

.navigate-left {
	left: 0;
}

.navigate-right {
	right: 0;
}

#cb-loading-overlay {
	z-index: 100;
	opacity: 0.8;
	background: #000 url("img/loading.gif") no-repeat center;
	box-shadow: none;
}

#cb-status {
	z-index: 101;
	font-size: 12px;
	right: 0;
	bottom: 0;
	margin: 8px;
	border-radius: 4px;
}

#cb-progress-bar {
	width: 200px;
}

#cb-progress-bar,
#cb-progress-bar .progressbar-value {
	height: 3px;
}

#cb-progress-bar .progressbar-value {
	width: 0;
	background: #86C441;
	border-color: #3E7600;
}

* {
	-webkit-user-select: none;
	-webkit-touch-callout: none;
	-webkit-tap-highlight-color: rgba(0,0,0,0);
}

body {
	font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
	font-size: 12px;
	line-height: 20px;
	color: #333;
}

button, input, label {
	cursor: pointer;
}

.pull-left {
	float: left;
}

.pull-right {
	float: right;
}

.toolbar {
	color: white;
	background-color: black;
	background-image: linear-gradient(to bottom, rgb(80, 80, 80), rgb(17, 17, 17));
	overflow: visible;
	padding: 0.75em;
	position: fixed;
	left: 0;
	right: 0;
	z-index: 99;
	margin-bottom: 0;
	box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
	opacity: 0;
  transition: opacity 0.2s ease-in-out;
}

.mobile .toolbar {
	opacity: 1;
}

.toolbar:hover {
	opacity: 1;
}

.toolbar li {
	display: inline-block;
	position: relative;
}

.toolbar .separator {
	border: solid 1px;
	height: 1em;
}

.toolbar button {
	color: white;
	border: none;
	background-color: transparent;
	padding: 0;
}

.toolbar li > button {
	font-size: 1.5em;
	padding: 0 12px;
}

.mobile .toolbar li > button {
	padding: 0 9px;
}

.toolbar li > button:hover {
	color: #8CC746;
}

.toolbar button[data-action=close]:hover {
	color: #FF6464;
}

.toolbar .dropdown {
	font-size: 1em;
	position: absolute;
	width: 212px;
	background-color: white;
	color: #111;
	border-radius: 4px;
	box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
	top: 2em;
	padding: 4px 0;
	display: none;
}

body:not(.mobile) .toolbar li:hover > .dropdown {
	display: block;
}

/* dropdown arrow code taken from Twitter Bootstrap 2.3.1 */
.toolbar .dropdown:after {
	position: absolute;
	top: -4px;
	left: 15px;
	display: inline-block;
	border-right: 6px solid transparent;
	border-bottom: 6px solid #ffffff;
	border-left: 6px solid transparent;
	content: '';
}

.toolbar .close {
	display: none;
}

.dropdown .control-group {
	padding: 8px;
}

.dropdown .sliders {
	font-size: 1.5em;
}

.dropdown .control-group span {
	float: left;
	margin: 0 2px;
	clear: both;
}

.dropdown .control-group input[type=range] {
	width: 171px;
	float: right;
	margin: 0;
}

redpajama_set_name: RedPajamaGithub


text:
//
//  KSOFormPickerViewRow.h
//  KSOForm-iOS
//
//  Created by William Towe on 9/26/17.
//  Copyright © 2018 Kosoku Interactive, LLC. All rights reserved.
//
//  Licensed under the Apache License, Version 2.0 (the "License");
//  you may not use this file except in compliance with the License.
//  You may obtain a copy of the License at
//
//  http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 Protocol for an object that represents a single row within a UIPickerView.
 */
@protocol KSOFormPickerViewRow <NSObject>
@optional
/**
 The title for the picker view row.
 */
@property (readonly,nonatomic) NSString *formPickerViewRowTitle;
/**
 The attributed title for the picker view row. If this is implemented, it is preferred over formPickerViewRowTitle.
 */
@property (readonly,nonatomic) NSAttributedString *formPickerViewRowAttributedTitle;
@end

/**
 Adds support for KSOFormPickerViewRow to NSString.
 */
@interface NSString (KSOFormPickerViewRowExtensions) <KSOFormPickerViewRow>
@end

/**
 Adds support for KSOFormPickerViewRow to NSAttributedString.
 */
@interface NSAttributedString (KSOFormPickerViewRowExtensions) <KSOFormPickerViewRow>
@end

NS_ASSUME_NONNULL_END


text:
{-# OPTIONS

 -XMultiParamTypeClasses
 -XFunctionalDependencies
 -XMultiWayIf
 -XFlexibleInstances
 -XFlexibleContexts
#-}

module Search (Treelike, children, root, graft, SearchPath, TPath, TPath2, path, meTree, cur, curTree, up, down, prev, next, start, changeMe, emptyPath, node, dFSStep, dFSStep2, zipUp) where
import System.Environment
import Control.Monad
import Data.Tree
import Control.Monad.Trans.State

import Utilities

class Treelike a b | a -> b where
      children :: a -> [a]
      root :: a -> b
      graft :: b -> [a] -> a
node :: (Treelike a b) => b -> a
node x = graft x []

instance Treelike (Tree a) a where
         children ta = (case ta of Node _ c -> c)
         root ta = (case ta of Node a1 _ -> a1)
         graft top ts = Node top ts

--another way to make an instance: for a concrete a with function f: a-> a
--instance Treelike a a where
--         children ta = f ta
--         root ta = ta
--         graft top ts = top

--breadcrumbs  | c -> a b
class (Treelike a b) => SearchPath a b c | c -> a b  where
      curTree :: c -> a
      cur :: c -> b
      down :: c -> c
      up :: c -> c
      next :: c -> c
      prev :: c -> c
      hasNext :: c -> Bool
      hasPrev :: c -> Bool
      hasChild :: c -> Bool
      start :: a -> c
      changeMe :: a -> c -> c
      atTop :: c -> Bool
      emptyPath :: c

cur2 :: (Treelike a b) => b -> TPath a b -> b
cur2 y t = case (meTree t) of (Just a) -> cur t
                              Nothing -> y

--basically a list zipper inside. probably a little overkill.
data TNode a b = TNode {meN :: b
             , leftN :: [a]
             , rightN :: [a]
             }

instance Show b => Show (TNode a b) where
         show x = show (meN x)

data TPath a b = TPath {path :: [TNode a b]
             , meTree :: Maybe a
             }

type TPath2 b = TPath (Tree b) b

instance (Show a , Show b) => Show (TPath a b) where
         show x = "(" ++ show (path x) ++ ", " ++ show (meTree x) ++")"

--do not call on empty tree!
--tip :: TPath a b -> b
--tip x = meN (head (path x))

left :: TPath a b -> [a]
left x = leftN (head (path x))

right :: TPath a b -> [a]
right x = rightN (head (path x))

update :: TPath a b -> TNode a b -> Maybe a -> TPath a b
update t n tr =
  case (path t) of
    (_:parents) -> TPath (n:parents) tr
--error case

--a natural transformation
maybeToList :: Maybe a -> [a]
maybeToList (Just x) = [x]
maybeToList Nothing = []

parentName :: (TPath a b) -> b
parentName t = case (path t) of
                 (parent:ancestors) ->  meN parent

instance (Treelike a b) => SearchPath a b (TPath a b) where
         --have to join up! Note this can be made more efficient
         curTree t =
           case (meTree t) of (Just a) -> a
                              Nothing -> curTree (up t)
         cur t = root (curTree t)
         down t =
           case (meTree t) of
             Nothing -> t
             Just tr -> TPath ((TNode (root tr) [] (children tr)):(path t)) Nothing
--also add nth down
         up t =
           let
             childList =
               case (meTree t) of
                 Nothing -> (reverse (left t)) ++ (right t)
                 Just c -> (reverse (left t)) ++ [c] ++ (right t)
             parentTree = graft (parentName t) childList
             (_:ancestors) = (path t)
           in
             TPath ancestors (Just parentTree)
         next t =
           let
             toAppend = maybeToList (meTree t)
           in
             case (path t) of
               (_:_) ->
                 case (right t) of
                   [] -> update t (TNode (parentName t) (toAppend ++ (left t)) []) Nothing
                   (hd:rest) -> update t (TNode (parentName t) (toAppend ++ (left t)) rest) (Just hd)
               [] -> t
         prev t =
           let
             toAppend = maybeToList (meTree t)
           in
             case (path t) of
               (_:_) ->
                 case (left t) of
                   [] -> update t (TNode (parentName t) [] (toAppend ++ (right t))) Nothing
                   (hd:rest) -> update t (TNode (parentName t) rest (toAppend ++ (right t))) (Just hd)
         hasNext t = case (right t) of
           [] -> False
           _  -> True
         hasPrev t = case (left t) of
           [] -> False
           _  -> True
         hasChild t = case (meTree t) of
           Nothing -> False
           Just tr ->
             case (children tr) of
               [] -> False
               _  -> True
         start x = (TPath [] (Just x))
         changeMe s x = x{meTree = Just s}
         atTop t = case (path t) of
           [] -> True
           _  -> False
         emptyPath = TPath [] Nothing

zipUp :: (SearchPath a b c) => c -> a
zipUp tp = if atTop tp then curTree tp else zipUp $ up tp

--change this to tell us where it went
dFSStep:: (SearchPath a b c) => (c, Bool) -> (c,Bool)
dFSStep (tpath, done) =
    if done
    then (tpath,done)
    else
          if (hasChild tpath)
          then (tpath |> down |> next, False)
          else (
                let
                    tpath2 = tpath |> up
                in
                  if (atTop tpath2)
                  then (tpath2, True)
                  else (tpath2 |> next, False)
                   )

dFSStep2:: (SearchPath a b c) => State c (b,String)
--(Treelike a b) => b -> State (TPath a b) (b,String)
dFSStep2 = state $ (\tpath ->
          if (hasChild tpath)
          then
              let tpath2 = tpath |> down |> next in
              ((cur tpath2, "down"), tpath2)
          else (
                if hasNext tpath
                then
                    let tpath2 = tpath |> next in
                    ((cur tpath2, "down"), tpath2)
                else
                    let
                        tpath2 = tpath |> up
                    in
                      if (atTop tpath2)
                      then ((cur tpath, "done"), tpath2)
                      else ((cur (tpath2 |> next), "up"), tpath2 |> next)
                   ))

{-
dFSStep:: (SearchPath a b c) => c -> State c Bool
dFSStep tpath = State (dFSStep')
-}


text:
module.exports = {
	config: {
		message_timestamp_format: "MMM D HH:mm",
		article_timestamp_format: "MMM D",
		language: "en-US",
		transfer_to_kefu_words: "Chat with agent",
		scheduler_role_nickname: "Scheduler",
	},
	common: {
		confirm: "Confirm",
		cancel: "Cancel",
		contact_agent: "Contact us",
		ticket: "Note",
		submit: "Submit",
		agent: "Agent",
		visitor: "Visitor",
		close: "Close",
		close_sound: "Mute",
		close_mute: "Close Mute",
		min_window: "Minimize",
		reply: "Reply",
		tip: "Tips",
		send_failed: "Failed to send",
		loading: "loading...",
		no_more_msg: "no more messages",
		press_save_img: "Press to save the picture",
		session_over_limit: "All agents are busy now. Please try again later…",
		faq: "FAQs",
		consult_agent: "Consult agent",
		refresh_tip: "You have initiated a consultation on other pages, and the current consultation is invalid. You can initiate a consultation again",
		re_consultation: "Reconnecting",
		camera_permissions: "The program needs to access your gallery and use camera permissions. Do you want to allow it?",
		file_permissions: "The program needs to access your file permission. Is it allowed?",
		video_permissions: "The program needs access to your photos and albums. Is it allowed?",
		allow: "Allow",
		refuse: "Refuse",
		Hangup: "Hang up",
		accept: "Accept",
		self_service: "Self service"
	},
	chat: {
		agent_is_typing: "Agent is typing...",
		current_queue_number: "Customers queuing: ",
		connecting: "Connecting...",
		send: "Send",
		input_placeholder: "Type your message here",
		click_to_ticket: "Note",
		evaluate_agent_title: "Please rate my service",
		click_to_evaluate: "Rate",
		invalid: "Invalid",
		paste_image_submit: "Send",
		read_full_version: "Read all",
		default_emoji: "default",
		agent: "Agent ",
		powered_by_easemob: "powered by easemob",
		ticket_Introduction: "You can click the message below to feed back your questions!",
		ticket: "ticket"
	},
	message_brief: {
		link: "[Link]",
		menu: "[Menu]",
		file: "[File]",
		picture: "[Image]",
		emoji: "[Emoticon]",
		unknown: "[Unknown]",
		video: "[Video]",
	},
	agent_status: {
		online: "(Online)",
		busy: "(Busy)",
		leave: "(Away)",
		hidden: "(Invisible)",
		offline: "(Offline)",
	},
	event_message: {
		no_agent_online: "Agent is offline. Please leave your contact info.",
		session_created: "Conversation is created",
		session_opened: "Conversation is opened",
		sessing_transfering: "Transferring. Please wait...",
		session_transfered: "Conversation is transferred",
		sessing_closed: "Conversation is closed",
	},
	evaluation: {
		rate_my_service: "Rate my service",
		rate_my_evalute: "Has your problem been resolved?",
		review: "Review",
		select_level_please: "Select a star",
		select_tag_please: "Select a label",
		submit_success: "Submit successfully",
		resolved: "Resolved",
		unsolved: "Unsolved",
		WEBIM_338: "Visitor evaluate timeout",
		level1: "Very dissatisfied",
		level2: "Dissatisfied",
		level3: "Satisfied",
		level4: "Good",
		level5: "Very satisfied",
		submit_evaluation: "Submit evaluation",
		no_evaluation: "No evaluation",
		WEBIM_OTHER: "Other errors",
		title: "Service evaluation",
	},
	ticket: {
		title: "Please fill in your contact info.",
		name: "Name",
		phone_number: "Phone",
		email: "Email",
		content_placeholder: "Type your note here",
		is_sending: "Submiting note...",
		invalid_name: "Name is incorrect",
		invalid_phone: "Phone number is incorrect",
		invalid_email: "Email address is incorrect",
		invalid_content: "Note cannot be empty. Up to 1500 characters are supported.",
		send_success: "Note sent successfully",
		send_failed_retry: "Failed to submit the note. Please try again later.",
		send_failed_invalid_token: "Failed to submit the note due to invalid token.",
		note_title: "Note",
	},
	video: {
		waiting: "Waiting",
		me: "Me",
		video_ended: "Video call ended",
		confirm_prompt: "Invite the agent to a video call? Send the invite and wait for the agent to join the video call.",
		confirm_prompt_agent: "The agent invite you to enter the video call",
		confirm_prompt_visitor: "You are inviting customer service for a video call",
		invite_agent_video: "Invite the agent to a video call",
		// 这个文案待确认
		connecting: "Recording",
		waiting_confirm: "Video call request. Waiting for your confirmation",
		can_not_connected: "Video call can't be connected. Please try again.",
		can_not_open_camera: "Can't open camera.",
		invite_exit_video: "The visitor abandoned the video call",
		answer: "Answer"
	},
	toolbar: {
		emoji: "Emoticon",
		picture: "Image",
		attachment: "File",
		ticket: "Note",
		video_invite: "Video call",
		evaluate_agent: "Satisfaction",
		transfer_to_kefu: "Agent",
		transfer_to_ticket: "Ticket",
		abandon_queue: "Abandon queue",
		send_video: "SendVideo",
		out_of_line: "Exit the queue",
		exit_video: "Abandon the video call",
		screen_shotTip: "Screenshot command + shift + 5",
		screen_shotTip_win: "Screenshot win + shift + s"
	},
	prompt: {
		mini_notip: "Type not supported:",
		not_upload: "This file format does not support sending, please select again",
		new_message_title_notice: "New message",
		no_valid_channel: "There is no channel account.",
		new_message: "New message",
		too_many_words: "Message too long",
		default_off_duty_word: "We are currently offline.",
		_10_mb_file_limit: "The file size cannot exceed 10 MB.",
		_20_mb_file_limit: "The file size cannot exceed 20 MB.",
		not_certified: "Not certified.",
		certification_failed: "Certification failed.",
		unavailable: "The consultation channel is unavailable until the certification is passed.",
		risk_alert: "Risk reminder: This  is a test system, and no formal business has been opened yet. Please be cautious when dealing with payment and other transactions!"
	},
};


text:
import Application from './Application';
import Router from './Router';

function leads(options) {
	return new Application(options);
}

leads.Router = function(options) {
	return new Router(options);
}

export default leads


text:
class WindowsMouse: public InputMouse
{
public:
	WindowsMouse();
	~WindowsMouse();
	void ProcessMouseMSG(float wheelValue);
protected:
	void UpdateState() override;

};


text:
CleanupTab::CleanupTab()
{
	QVBoxLayout *mainLayout = new QVBoxLayout(this);
	setLayout(mainLayout);

	mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
	mainLayout->setSpacing(0);
	mainLayout->setMargin(0);

	QWidget *settingsBox = new QWidget(this);
	mainLayout->addWidget(settingsBox);
	mainLayout->addStretch(); //This is the reason we need mainLayout

	QGridLayout *settingsLayout = new QGridLayout(settingsBox);
	settingsBox->setLayout(settingsLayout);

	settingsLayout->setSizeConstraint(QLayout::SetMaximumSize);
	settingsLayout->setSpacing(9);
	settingsLayout->setMargin(12);

	int row = 0;

	//  AutoCenter
	m_autoCenter = new DVGui::CheckBox(tr("Autocenter"), this);
	settingsLayout->addWidget(m_autoCenter, row++, 1, Qt::AlignLeft);

	m_autoCenter->setFixedSize(150, DVGui::WidgetHeight);

	//  Pegbar Holes
	settingsLayout->addWidget(new QLabel(tr("Pegbar Holes:")), row, 0, Qt::AlignRight);

	m_pegHolesOm = new QComboBox(this);
	settingsLayout->addWidget(m_pegHolesOm, row++, 1, Qt::AlignLeft);

	m_pegHolesOm->setFixedHeight(DVGui::WidgetHeight);
	m_pegHolesOm->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);

	QStringList pegbarHoles;
	pegbarHoles << "Bottom"
				<< "Top"
				<< "Left"
				<< "Right";
	m_pegHolesOm->addItems(pegbarHoles);

	//  Field Guide
	settingsLayout->addWidget(new QLabel(tr("Field Guide:")), row, 0, Qt::AlignRight);

	m_fieldGuideOm = new QComboBox(this);
	settingsLayout->addWidget(m_fieldGuideOm, row++, 1, Qt::AlignLeft);

	m_fieldGuideOm->setFixedHeight(DVGui::WidgetHeight);
	m_fieldGuideOm->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);

	std::vector<std::string> fdgNames;
	CleanupParameters::getFdgNames(fdgNames);

	for (int i = 0; i < (int)fdgNames.size(); i++)
		m_fieldGuideOm->addItem(QString(fdgNames[i].c_str()));

	settingsLayout->addWidget(new DVGui::Separator(), row++, 0, 1, 2);

	//  Rotate
	settingsLayout->addWidget(new QLabel(tr("Rotate:")), row, 0, Qt::AlignRight);

	m_rotateOm = new QComboBox(this);
	settingsLayout->addWidget(m_rotateOm, row++, 1, Qt::AlignLeft);

	m_rotateOm->setFixedHeight(DVGui::WidgetHeight);
	m_rotateOm->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);

	QStringList rotate;
	rotate << "0"
		   << "90"
		   << "180"
		   << "270";
	m_rotateOm->addItems(rotate);

	//  Flip
	settingsLayout->addWidget(new QLabel(tr("Flip:")), row, 0, Qt::AlignRight);

	QWidget *flipWidget = new QWidget();
	settingsLayout->addWidget(flipWidget, row++, 1, Qt::AlignLeft);

	QHBoxLayout *flipLayout = new QHBoxLayout();
	flipWidget->setLayout(flipLayout);

	flipLayout->setSizeConstraint(QLayout::SetFixedSize);
	flipLayout->setMargin(0);

	m_flipX = new DVGui::CheckBox(tr("Horizontal"), flipWidget);
	flipLayout->addWidget(m_flipX, 0, Qt::AlignLeft);

	m_flipX->setFixedHeight(DVGui::WidgetHeight);

	m_flipY = new DVGui::CheckBox(tr("Vertical"), flipWidget);
	flipLayout->addWidget(m_flipY, 0, Qt::AlignLeft);

	m_flipY->setFixedHeight(DVGui::WidgetHeight);

	flipLayout->addStretch(1);

	//  Save In
	settingsLayout->addWidget(new QLabel(tr("Save in:")), row, 0, Qt::AlignRight);

	m_pathField = new DVGui::FileField(this, QString(""));
	settingsLayout->addWidget(m_pathField, row++, 1);

	m_pathField->setFixedHeight(DVGui::WidgetHeight);

	//  Connections
	bool ret = true;
	ret = ret && connect(m_autoCenter, SIGNAL(stateChanged(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_pegHolesOm, SIGNAL(activated(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_fieldGuideOm, SIGNAL(activated(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_rotateOm, SIGNAL(activated(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_flipX, SIGNAL(stateChanged(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_flipY, SIGNAL(stateChanged(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_pathField, SIGNAL(pathChanged()), SLOT(onPathChange()));

	assert(ret);
}

//-----------------------------------------------------------------------------

QString CleanupTab::pathString(const TFilePath &path, bool lpNone)
{
	return path.isEmpty() ? lpNone ? QString("+extras") : QString("+drawings") : toQString(path);
}

//-----------------------------------------------------------------------------

void CleanupTab::updateGui(CleanupParameters *params, CleanupParameters *oldParams)
{
	m_autoCenter->setChecked(params->m_autocenterType == CleanupTypes::AUTOCENTER_FDG);
	m_pegHolesOm->setCurrentIndex(params->m_pegSide - 1);

	QString fieldName = QString::fromStdString(params->getFdgName());
	int index = (fieldName.isEmpty()) ? 0 : m_fieldGuideOm->findText(fieldName);
	assert(index != -1);
	m_fieldGuideOm->setCurrentIndex(index);

	m_rotateOm->setCurrentIndex(params->m_rotate / 90);
	m_flipX->setChecked(params->m_flipx);
	m_flipY->setChecked(params->m_flipy);

	m_path = params->m_path;
	m_pathField->setPath(pathString(m_path, params->m_lineProcessingMode == lpNone));
}

//-----------------------------------------------------------------------------

void CleanupTab::onGenericSettingsChange()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	params->m_autocenterType = m_autoCenter->isChecked() ? CleanupTypes::AUTOCENTER_FDG : CleanupTypes::AUTOCENTER_NONE;
	params->m_pegSide = (CleanupTypes::PEGS_SIDE)(m_pegHolesOm->currentIndex() + 1);
	params->setFdgByName(m_fieldGuideOm->currentText().toStdString());
	params->m_rotate = m_rotateOm->currentIndex() * 90;
	params->m_flipx = m_flipX->isChecked();
	params->m_flipy = m_flipY->isChecked();

	model->commitChanges();
}

//-----------------------------------------------------------------------------

void CleanupTab::onPathChange()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	m_path = params->m_path = TFilePath(m_pathField->getPath().toStdWString());

	model->commitChanges();
}

//**********************************************************************
//    Processing Tab implementation
//**********************************************************************

ProcessingTab::ProcessingTab()
{
	QVBoxLayout *mainLayout = new QVBoxLayout();
	setLayout(mainLayout);

	mainLayout->setSizeConstraint(QLayout::SetMinimumSize);
	mainLayout->addSpacing(6);

	m_settingsFrame = new QWidget(this);
	mainLayout->addWidget(m_settingsFrame);

	//----------------- Parameters Layout -----------------------

	QGridLayout *settingsLayout = new QGridLayout(m_settingsFrame);
	m_settingsFrame->setLayout(settingsLayout);

	settingsLayout->setSpacing(9);
	settingsLayout->setMargin(6);
	settingsLayout->setSizeConstraint(QLayout::SetMinimumSize);
	settingsLayout->setColumnStretch(1, 1); // needed when lpNone

	//-------------------- Parameters ---------------------------

	int row = 0;

	//  Line processing
	settingsLayout->addWidget(new QLabel(tr("Line Processing:")), row, 0, Qt::AlignRight);

	m_lineProcessing = new QComboBox(this);
	m_lineProcessing->setFixedHeight(DVGui::WidgetHeight);
	m_lineProcessing->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);

	QStringList items;
	items << tr("None") << tr("Greyscale") << tr("Color");
	m_lineProcessing->addItems(items);

	settingsLayout->addWidget(m_lineProcessing, row++, 1, Qt::AlignLeft);

	//  Antialias
	m_antialiasLabel = new QLabel(tr("Antialias:"));
	settingsLayout->addWidget(m_antialiasLabel, row, 0, Qt::AlignRight);

	m_antialias = new QComboBox(this);
	m_antialias->setFixedHeight(DVGui::WidgetHeight);
	m_antialias->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);

	items.clear();
	items << tr("Standard") << tr("None") << tr("Morphological");
	m_antialias->addItems(items);

	settingsLayout->addWidget(m_antialias, row++, 1, Qt::AlignLeft);

	//  Autoadjust
	m_autoadjustLabel = new QLabel(tr("Autoadjust:"));
	settingsLayout->addWidget(m_autoadjustLabel, row, 0, Qt::AlignRight);

	m_autoadjustOm = new QComboBox(this);
	m_autoadjustOm->setFixedHeight(DVGui::WidgetHeight);
	m_autoadjustOm->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum);

	items.clear();
	items << "None"
		  << "Black-Eq"
		  << "Histo"
		  << "Histo-L";
	m_autoadjustOm->addItems(items);

	settingsLayout->addWidget(m_autoadjustOm, row++, 1, Qt::AlignLeft);

	//  Sharpness
	m_sharpLabel = new QLabel(tr("Sharpness:"));
	settingsLayout->addWidget(m_sharpLabel, row, 0, Qt::AlignRight);
	m_sharpness = new DVGui::DoubleField(this);
	m_sharpness->setFixedHeight(DVGui::WidgetHeight);
	m_sharpness->setValues(90, 0, 100);
	settingsLayout->addWidget(m_sharpness, row++, 1);

	//  Despeckling
	m_despeckLabel = new QLabel(tr("Despeckling:"));
	settingsLayout->addWidget(m_despeckLabel, row, 0, Qt::AlignRight);
	m_despeckling = new DVGui::IntField(this);
	m_despeckling->setFixedHeight(DVGui::WidgetHeight);
	m_despeckling->setValues(2, 0, 20);
	settingsLayout->addWidget(m_despeckling, row++, 1);

	//  MLAA Value
	m_aaValueLabel = new QLabel(tr("MLAA Intensity:"));
	settingsLayout->addWidget(m_aaValueLabel, row, 0, Qt::AlignRight);
	m_aaValue = new DVGui::IntField(this);
	m_aaValue->setFixedHeight(DVGui::WidgetHeight);
	m_aaValue->setValues(70, 0, 100);
	settingsLayout->addWidget(m_aaValue, row++, 1);

	//---------------------- Palette ----------------------------

	m_paletteSep = new DVGui::Separator();
	mainLayout->addWidget(m_paletteSep);
	m_paletteViewer = new CleanupPaletteViewer(this);
	mainLayout->addWidget(m_paletteViewer, 1); // The palette viewer dominates on the stretch below

	mainLayout->addStretch(); // Lp: none sticks to the upper edge

	//-------------------- Connections --------------------------

	bool ret = true;
	ret = ret && connect(m_sharpness, SIGNAL(valueChanged(bool)), SLOT(onSharpnessChange(bool)));
	ret = ret && connect(m_lineProcessing, SIGNAL(activated(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_antialias, SIGNAL(activated(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_autoadjustOm, SIGNAL(activated(int)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_despeckling, SIGNAL(valueChanged(bool)), SLOT(onGenericSettingsChange()));
	ret = ret && connect(m_aaValue, SIGNAL(valueChanged(bool)), SLOT(onGenericSettingsChange()));
	assert(ret);
}

//-----------------------------------------------------------------------------

void ProcessingTab::updateGui(CleanupParameters *params, CleanupParameters *oldParams)
{
	m_lineProcessing->setCurrentIndex(params->m_lineProcessingMode);
	m_antialias->setCurrentIndex(params->m_postAntialias ? 2 : params->m_noAntialias ? 1 : 0);
	m_autoadjustOm->setCurrentIndex((int)params->m_autoAdjustMode);
	m_sharpness->setValue(params->m_sharpness);
	m_despeckling->setValue(params->m_despeckling);
	m_aaValue->setValue(params->m_aaValue);

	updateVisibility();
}

//------------------------------------------------------------------------------

void ProcessingTab::updateVisibility()
{
	bool lp = (m_lineProcessing->currentIndex() != 0);
	bool lpGrey = (m_lineProcessing->currentIndex() == 1);
	bool MLAA = lp && (m_antialias->currentIndex() == 2);

	m_antialiasLabel->setVisible(lp);
	m_antialias->setVisible(lp);
	m_autoadjustLabel->setVisible(lpGrey);
	m_autoadjustOm->setVisible(lpGrey);
	m_sharpLabel->setVisible(lp);
	m_sharpness->setVisible(lp);
	m_despeckLabel->setVisible(lp);
	m_despeckling->setVisible(lp);
	m_aaValueLabel->setVisible(MLAA);
	m_aaValue->setVisible(MLAA);

	m_paletteViewer->setMode(lpGrey);
	m_paletteViewer->setContrastEnabled(m_antialias->currentIndex() == 0);

	if (!lp && !m_paletteViewer->isHidden()) {
		m_paletteViewer->setVisible(false);
		m_paletteSep->setVisible(false);
	} else if (lp && m_paletteViewer->isHidden()) {
		m_paletteViewer->setVisible(true);
		m_paletteSep->setVisible(false);
	}
}

//-----------------------------------------------------------------------------

void ProcessingTab::onGenericSettingsChange()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	params->m_lineProcessingMode = m_lineProcessing->currentIndex();
	params->m_noAntialias = (m_antialias->currentIndex() > 0);
	params->m_postAntialias = (m_antialias->currentIndex() == 2);
	params->m_despeckling = m_despeckling->getValue();
	params->m_aaValue = m_aaValue->getValue();
	params->m_autoAdjustMode = (CleanupTypes::AUTO_ADJ_MODE)m_autoadjustOm->currentIndex();

	if (params->m_lineProcessingMode == lpNone)
		params->m_transparencyCheckEnabled = false;

	model->commitChanges();
}

//-----------------------------------------------------------------------------

void ProcessingTab::onSharpnessChange(bool dragging = false)
{
	if (dragging)
		return;

	CleanupSettingsModel *model = CleanupSettingsModel::instance();

	model->getCurrentParameters()->m_sharpness = m_sharpness->getValue();
	model->commitChanges();
}

//**********************************************************************
//    CameraTab implementation
//**********************************************************************

CameraTab::CameraTab()
{
	bool ret = true;
	ret = ret && connect(TApp::instance()->getCurrentLevel(),
						 SIGNAL(xshLevelSwitched(TXshLevel *)), SLOT(onLevelSwitched()));
	ret = ret && connect(this, SIGNAL(cleanupSettingsChanged()), SLOT(onGenericSettingsChange()));
	assert(ret);
}

//-----------------------------------------------------------------------------

void CameraTab::updateGui(CleanupParameters *params, CleanupParameters *oldParams)
{
	blockSignals(true);
	setFields(params);
	blockSignals(false);

	if (params->m_lineProcessingMode != oldParams->m_lineProcessingMode ||
		params->m_camera.getRes() != oldParams->m_camera.getRes() ||
		params->m_camera.getSize() != oldParams->m_camera.getSize() ||
		params->m_closestField != oldParams->m_closestField) {
		updateImageInfo();
	}
}

//-------------------------------------------------------

void CameraTab::updateImageInfo()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	TDimension outRes(0, 0);
	TPointD outDpi;

	params->getOutputImageInfo(outRes, outDpi.x, outDpi.y);
	setImageInfo(outRes.lx, outRes.ly, outDpi.x, outDpi.y);

	TXshSimpleLevel *sl;
	TFrameId fid;
	model->getCleanupFrame(sl, fid);

	ToonzScene *scene = TApp::instance()->getCurrentScene()->getScene();
	TFilePath outputPath(sl ? scene->decodeFilePath(model->getOutputPath(sl, params)) : TFilePath());

	setImageInfo(outputPath);
}

//-----------------------------------------------------------------------------

void CameraTab::onLevelSwitched()
{
	setCurrentLevel(TApp::instance()->getCurrentLevel()->getLevel());
}

//------------------------------------------------------------------------------

void CameraTab::onGenericSettingsChange()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	getFields(model->getCurrentParameters());
	model->commitChanges();
}

//**********************************************************************
//    CleanupSettings implementation
//**********************************************************************

CleanupSettings::CleanupSettings(QWidget *parent)
	: QWidget(parent), m_attached(false)
{
	QVBoxLayout *vLayout = new QVBoxLayout(this);
	vLayout->setMargin(1); // NOTE: This works to show the 1-pix black border,
						   // because this is a QWidget (not QFrame) heir...
	setLayout(vLayout);

	//   Tabs Container
	// Used to deal with styled background and other stuff

	TabBarContainter *tabBarContainer = new TabBarContainter(this);
	QHBoxLayout *hLayout = new QHBoxLayout(tabBarContainer);

	hLayout->setMargin(0);
	hLayout->setAlignment(Qt::AlignLeft);
	hLayout->addSpacing(6);

	vLayout->addWidget(tabBarContainer);

	//  Tabs Bar

	DVGui::TabBar *tabBar = new DVGui::TabBar(this);
	hLayout->addWidget(tabBar);

	tabBar->addSimpleTab(tr("Cleanup"));
	tabBar->addSimpleTab(tr("Processing"));
	tabBar->addSimpleTab(tr("Camera"));
	tabBar->setDrawBase(false);

	//  Splitter

	QSplitter *split = new QSplitter(Qt::Vertical, this);
	split->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
	vLayout->addWidget(split);

	//  Stacked Widget

	QStackedWidget *stackedWidget = new QStackedWidget(split);
	stackedWidget->setMinimumWidth(300);
	//stackedWidget->setMinimumHeight(250);

	split->addWidget(stackedWidget);
	split->setStretchFactor(0, 1);

	//  Cleanup Tab

	QScrollArea *scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cleanupTab = new CleanupTab;
	scrollArea->setWidget(m_cleanupTab);

	//  Processing Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_processingTab = new ProcessingTab;
	scrollArea->setWidget(m_processingTab);

	//  Camera Tab

	scrollArea = new QScrollArea(stackedWidget);
	stackedWidget->addWidget(scrollArea);

	scrollArea->setWidgetResizable(true);
	scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

	m_cameraTab = new CameraTab;
	scrollArea->setWidget(m_cameraTab);

	m_cameraTab->setCameraPresetListFile(ToonzFolder::getReslistPath(true));

	//  Swatch

	m_swatch = new CleanupSwatch(split, 200, 150);
	split->addWidget(m_swatch);

	//  ToolBar

	QWidget *toolBarWidget = new QWidget(this);
	vLayout->addWidget(toolBarWidget);

	toolBarWidget->setFixedHeight(22);

	QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
	toolBarWidget->setLayout(toolBarLayout);

	toolBarLayout->setMargin(0);
	toolBarLayout->setSpacing(0);

	QToolBar *leftToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(leftToolBar, 0, Qt::AlignLeft);

	leftToolBar->setFixedWidth(110);

	m_swatchAct = new QAction(createQIconOnOffPNG("preview", true), tr("Toggle Swatch Preview"), this);
	m_swatchAct->setCheckable(true);
	leftToolBar->addAction(m_swatchAct);
	leftToolBar->addSeparator();

	m_opacityAct = new QAction(createQIconOnOffPNG("opacitycheck", true), tr("Toggle Opacity Check"), this);
	m_opacityAct->setCheckable(true);
	leftToolBar->addAction(m_opacityAct);

	QToolBar *spacingToolBar1 = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(spacingToolBar1, 1);

	spacingToolBar1->setMinimumHeight(22);

	QToolBar *rightToolBar = new QToolBar(toolBarWidget);
	toolBarLayout->addWidget(rightToolBar, 0, Qt::AlignRight);

	rightToolBar->setFixedWidth(110);

	QAction *saveAct = new QAction(createQIconOnOffPNG("save", false), tr("Save Settings"), this);
	rightToolBar->addAction(saveAct);
	QAction *loadAct = new QAction(createQIconOnOffPNG("load", false), tr("Load Settings"), this);
	rightToolBar->addAction(loadAct);
	rightToolBar->addSeparator();
	QAction *resetAct = new QAction(createQIconOnOffPNG("resetsize", false), tr("Reset Settings"), this);
	rightToolBar->addAction(resetAct);

	//  Model-related stuff
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	m_backupParams.assign(model->getCurrentParameters(), false);

	//  Connections

	QAction *opacityCheckCmd = CommandManager::instance()->getAction(MI_OpacityCheck);
	assert(opacityCheckCmd);

	bool ret = true;
	ret = ret && connect(tabBar, SIGNAL(currentChanged(int)), stackedWidget, SLOT(setCurrentIndex(int)));
	ret = ret && connect(m_swatchAct, SIGNAL(toggled(bool)), SLOT(enableSwatch(bool)));
	ret = ret && connect(m_opacityAct, SIGNAL(triggered(bool)), opacityCheckCmd, SLOT(trigger()));
	ret = ret && connect(saveAct, SIGNAL(triggered()), model, SLOT(promptSave()));
	ret = ret && connect(loadAct, SIGNAL(triggered()), model, SLOT(promptLoad()));
	ret = ret && connect(resetAct, SIGNAL(triggered()), this, SLOT(onRestoreSceneSettings()));

	assert(ret);
}

//-----------------------------------------------------------------------------

void CleanupSettings::showEvent(QShowEvent *se)
{
	QWidget::showEvent(se);

	if (!m_attached) {
		m_attached = true;

		//Should ensure that swatch is off...
		CleanupSettingsModel *model = CleanupSettingsModel::instance();

		model->attach(CleanupSettingsModel::LISTENER);

		bool ret = true;
		ret = ret && connect(model, SIGNAL(imageSwitched()), this, SLOT(onImageSwitched()));
		ret = ret && connect(model, SIGNAL(modelChanged(bool)), this, SLOT(updateGui(bool)));
		ret = ret && connect(model, SIGNAL(clnLoaded()), this, SLOT(onClnLoaded()));
		assert(ret);

		m_cameraTab->setCurrentLevel(TApp::instance()->getCurrentLevel()->getLevel());

		updateGui(false);
		onImageSwitched();
		onClnLoaded();

		if (m_swatchAct->isChecked())
			enableSwatch(true); //attach swatch
	}
}

//-----------------------------------------------------------------------------

void CleanupSettings::hideEvent(QHideEvent *he)
{
	// Surprisingly enough, it seems that Qt may trigger hideEvents for widgets that
	// have never been shown - this is why we need to check a user-made bool to know whether
	// model attachment has happened... and no, detaching without attaching is *BAD*

	if (m_attached) {
		m_attached = false;

		//Should put swatch to off...
		CleanupSettingsModel *model = CleanupSettingsModel::instance();

		model->detach(CleanupSettingsModel::LISTENER);

		bool ret = true;
		ret = ret && disconnect(model, SIGNAL(imageSwitched()), this, SLOT(onImageSwitched()));
		ret = ret && disconnect(model, SIGNAL(modelChanged(bool)), this, SLOT(updateGui(bool)));
		ret = ret && disconnect(model, SIGNAL(clnLoaded()), this, SLOT(onClnLoaded()));
		assert(ret);

		if (m_swatchAct->isChecked())
			enableSwatch(false); //detach swatch
	}

	QWidget::hideEvent(he);
}

//-----------------------------------------------------------------------------

void CleanupSettings::updateGui(bool needsPostProcess)
{
	CleanupParameters *params = CleanupSettingsModel::instance()->getCurrentParameters();

	m_cleanupTab->updateGui(params, &m_backupParams);
	m_processingTab->updateGui(params, &m_backupParams);
	m_cameraTab->updateGui(params, &m_backupParams);

	m_backupParams.assign(params, false);

	m_opacityAct->setChecked(params->m_transparencyCheckEnabled);
	if (params->m_lineProcessingMode == lpNone) {
		m_swatch->setRaster(TRasterP(), TAffine(), TRasterP());
		m_swatchAct->setChecked(false);
	} else if (needsPostProcess)
		postProcess();
}

//-----------------------------------------------------------------------------

void CleanupSettings::enableSwatch(bool enable)
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	if (enable) {
		model->attach(CleanupSettingsModel::PREVIEWER);
		connect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged()));
		onPreviewDataChanged();
	} else {
		model->detach(CleanupSettingsModel::PREVIEWER);
		disconnect(model, SIGNAL(previewDataChanged()), this, SLOT(onPreviewDataChanged()));
		m_swatch->setRaster(TRasterP(), TAffine(), TRasterP());
	}
}

//-----------------------------------------------------------------------------

void CleanupSettings::enableOpacityCheck(bool enable)
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();
	CleanupParameters *params = model->getCurrentParameters();

	params->m_transparencyCheckEnabled = enable;

	model->commitChanges();
}

//-----------------------------------------------------------------------------

void CleanupSettings::onImageSwitched()
{
	m_cameraTab->updateImageInfo();
}

//-----------------------------------------------------------------------------

void CleanupSettings::onPreviewDataChanged()
{
	TRasterImageP original, transformed;
	TAffine transform;

	CleanupSettingsModel::instance()->getPreviewData(original, transformed, transform);
	m_swatch->setRaster(original ? original->getRaster() : TRasterP(),
						transform,
						transformed ? transformed->getRaster() : TRasterP());
}

//-----------------------------------------------------------------------------

void CleanupSettings::postProcess()
{
	m_swatch->updateCleanupped();
}

//-----------------------------------------------------------------------------

void CleanupSettings::onClnLoaded()
{
	const TFilePath &fp = CleanupSettingsModel::instance()->clnPath();

	const QString &newWindowTitle = (fp.isEmpty()) ? tr("Cleanup Settings") : tr("Cleanup Settings: %1").arg(toQString(fp.withoutParentDir()));

	if (windowTitle() != newWindowTitle) {
		setWindowTitle(newWindowTitle);
		emit windowTitleChanged(windowTitle());
	}
}

//-----------------------------------------------------------------------------

void CleanupSettings::onRestoreSceneSettings()
{
	CleanupSettingsModel *model = CleanupSettingsModel::instance();

	model->saveSettingsIfNeeded();
	model->restoreGlobalSettings();
}

//**********************************************************************
//    Toggle Opacity Check Command
//**********************************************************************

class ToggleOpacityCheckCommand : public MenuItemHandler
{
public:
	ToggleOpacityCheckCommand()
		: MenuItemHandler(MI_OpacityCheck) {}

	void execute()
	{
		CleanupSettingsModel *model = CleanupSettingsModel::instance();
		CleanupParameters *params = model->getCurrentParameters();

		params->m_transparencyCheckEnabled = !params->m_transparencyCheckEnabled;

		model->commitChanges();
	}

} toggleOpacityCheckCommand;

//**********************************************************************
//    Open Popup Command
//**********************************************************************

class CleanupSettingsFactory : public TPanelFactory
{
public:

  CleanupSettingsFactory() : TPanelFactory("CleanupSettings") {}

  void initialize(TPanel* panel)
  {
    CleanupSettings* cleanupSettings = new CleanupSettings(panel);
    panel->setWidget(cleanupSettings);

    bool ret = QObject::connect(
      cleanupSettings, SIGNAL(windowTitleChanged(const QString&)),
      panel,           SLOT(setWindowTitle(const QString&)));
    assert(ret);

    panel->setMinimumSize(320, 150);
    panel->resize(600, 500);
  }

} cleanupSettingsFactory;

OpenFloatingPanel cleanupSettingsCommand(MI_CleanupSettings, "CleanupSettings", QObject::tr("Cleanup Settings"));


text:
package org.axway.grapes.server.webapp.views;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.yammer.dropwizard.views.View;
import org.axway.grapes.server.db.datamodel.DbSearch;
import org.axway.grapes.server.webapp.views.serialization.SearchSerializer;

@JsonSerialize(using = SearchSerializer.class)
public class SearchView extends View {

    private DbSearch searchOj;

    public SearchView() {
        super("Search.ftl");
    }

    public void setSearchOj(DbSearch searchOj) {
       this.searchOj = searchOj;
    }

    public DbSearch getSearchOj() {
        return searchOj;
    }
}


text:
import React, { PropTypes, Component } from 'react'
import ImmutablePropTypes from 'react-immutable-proptypes'
import { color } from 'react-native-material-design-styles'
import { white } from '../../utils/colors'

import {
  View,
  Text,
  StyleSheet,
  ListView,
} from 'react-native'

import {
  Card,
} from 'react-native-material-design'

const styles = StyleSheet.create({
  cardTitleContainer: {
    borderTopRightRadius: 2,
    borderTopLeftRadius: 2,
    backgroundColor: color.googleBlue500.color,
    paddingLeft: 16,
    paddingRight: 16,
    paddingTop: 16,
    paddingBottom: 16,
  },
  cardTitleIdentifier: {
    color: white,
    fontSize: 30,
    fontWeight: 'bold',
    fontFamily: 'Montserrat-Normal',
  },
  cardTitleText: {
    color: white,
    fontSize: 20,
    fontWeight: 'normal',
    fontFamily: 'Montserrat-Thin',
    marginBottom: 10,
  },
  cardBody: {
    paddingLeft: 16,
    paddingRight: 16,
    paddingTop: 16,
    paddingBottom: 16,
    minHeight: 80,
  },
  cardTeaserText: {
    fontSize: 18,
  },
  scrollView: {
    paddingTop: 20,
    paddingLeft: 20,
    paddingRight: 20,
  },
})

class Topic extends Component {
  static propTypes = {
    topic: ImmutablePropTypes.map.isRequired,
    fetchDrips: PropTypes.func,
    navigate: PropTypes.object,
  }

  static defaultProps = {
    fetchDrips() {},
  }

  constructor(props) {
    super(props)
    const drips = this.getDripsFromProps(props)
    this.ds = new ListView.DataSource({ rowHasChanged: (row1, row2) => row1 !== row2 })
    this.state = {
      dataSource: this.ds.cloneWithRows(drips),
    }
    this.renderRow = this.renderRow.bind(this)
  }

  componentDidMount() {
    const { fetchDrips, topic } = this.props
    fetchDrips(topic.get('id'))
  }

  componentWillReceiveProps(nextProps) {
    const drips = this.getDripsFromProps(nextProps)
    this.setState({
      dataSource: this.ds.cloneWithRows(drips),
    })
  }

  getDripsFromProps(props) {
    const { topic } = props
    return topic.get('drips') ? topic.get('drips').toJS() : []
  }

  navigateToDrip(drip) {
    const { navigate } = this.props
    navigate.to('topics.topic.drip', drip.title, { id: drip.id })
  }

  renderRow(rowData) {
    return (
      <View style={styles.item}>
        <Card
          style={{ paddingLeft: 0, paddingRight: 0 }}
          onPress={() => this.navigateToDrip(rowData)}
        >
          <View style={styles.cardTitleContainer}>
            <Text style={styles.cardTitleIdentifier}>{rowData.identifier}</Text>
            <Text style={styles.cardTitleText}>{rowData.title}</Text>
          </View>
          <View style={styles.cardBody}>
            <Text style={styles.cardTeaserText}>{rowData.teaser}</Text>
          </View>
        </Card>
      </View>
    )
  }

  render() {
    return (
      <ListView
        styles={styles.scrollView}
        dataSource={this.state.dataSource}
        enableEmptySections
        renderRow={this.renderRow}
      />
    )
  }
}

export default Topic


text:
import BoostBuild

t = BoostBuild.Tester()

t.set_tree("../example/customization")

t.run_build_system()

t.expect_addition(["bin/$toolset/debug*/codegen.exe",
                   "bin/$toolset/debug*/usage.cpp"])

t.cleanup()


text:
<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://java.sun.com/xml/ns/javaee"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
                            http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
         version="2.5">

    <display-name>CrazyDog</display-name>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>classpath:application-config.xml</param-value>
    </context-param>

    <!--解决乱码的filter-->
    <filter>
        <filter-name>Character Encoding</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>Character Encoding</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!-- SpringOpenSessionInViewFilter -->
    <filter>
        <filter-name>SpringOpenSessionInViewFilter</filter-name>
        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>SpringOpenSessionInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <!--用来Spring核心组件的类-->
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

    <!--Spring MVC核心的分派类-->
    <servlet>
        <servlet-name>SpringMVC</servlet-name>
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>/WEB-INF/mvc-config.xml</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>

    <!--匹配所有的url请求 注意这里只能写/ 不能和Struts2写一样的/*-->
    <servlet-mapping>
        <servlet-name>SpringMVC</servlet-name>
        <url-pattern>/</url-pattern>
    </servlet-mapping>

    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
</web-app>


text:
extern "C"
{
#endif

//*****************************************************************************
//
// Values that can be passed to ADCSequenceConfigure as the ulTrigger
// parameter.
//
//*****************************************************************************
#define ADC_TRIGGER_PROCESSOR   0x00000000  // Processor event
#define ADC_TRIGGER_COMP0       0x00000001  // Analog comparator 0 event
#define ADC_TRIGGER_COMP1       0x00000002  // Analog comparator 1 event
#define ADC_TRIGGER_COMP2       0x00000003  // Analog comparator 2 event
#define ADC_TRIGGER_EXTERNAL    0x00000004  // External event
#define ADC_TRIGGER_TIMER       0x00000005  // Timer event
#define ADC_TRIGGER_PWM0        0x00000006  // PWM0 event
#define ADC_TRIGGER_PWM1        0x00000007  // PWM1 event
#define ADC_TRIGGER_PWM2        0x00000008  // PWM2 event
#define ADC_TRIGGER_ALWAYS      0x0000000F  // Always event

//*****************************************************************************
//
// Values that can be passed to ADCSequenceStepConfigure as the ulConfig
// parameter.
//
//*****************************************************************************
#define ADC_CTL_TS              0x00000080  // Temperature sensor select
#define ADC_CTL_IE              0x00000040  // Interrupt enable
#define ADC_CTL_END             0x00000020  // Sequence end select
#define ADC_CTL_D               0x00000010  // Differential select
#define ADC_CTL_CH0             0x00000000  // Input channel 0
#define ADC_CTL_CH1             0x00000001  // Input channel 1
#define ADC_CTL_CH2             0x00000002  // Input channel 2
#define ADC_CTL_CH3             0x00000003  // Input channel 3
#define ADC_CTL_CH4             0x00000004  // Input channel 4
#define ADC_CTL_CH5             0x00000005  // Input channel 5
#define ADC_CTL_CH6             0x00000006  // Input channel 6
#define ADC_CTL_CH7             0x00000007  // Input channel 7

//*****************************************************************************
//
// Prototypes for the APIs.
//
//*****************************************************************************
extern void ADCIntRegister(unsigned long ulBase, unsigned long ulSequenceNum,
                           void (*pfnHandler)(void));
extern void ADCIntUnregister(unsigned long ulBase,
                             unsigned long ulSequenceNum);
extern void ADCIntDisable(unsigned long ulBase, unsigned long ulSequenceNum);
extern void ADCIntEnable(unsigned long ulBase, unsigned long ulSequenceNum);
extern unsigned long ADCIntStatus(unsigned long ulBase,
                                  unsigned long ulSequenceNum,
                                  tBoolean bMasked);
extern void ADCIntClear(unsigned long ulBase, unsigned long ulSequenceNum);
extern void ADCSequenceEnable(unsigned long ulBase,
                              unsigned long ulSequenceNum);
extern void ADCSequenceDisable(unsigned long ulBase,
                               unsigned long ulSequenceNum);
extern void ADCSequenceConfigure(unsigned long ulBase,
                                 unsigned long ulSequenceNum,
                                 unsigned long ulTrigger,
                                 unsigned long ulPriority);
extern void ADCSequenceStepConfigure(unsigned long ulBase,
                                     unsigned long ulSequenceNum,
                                     unsigned long ulStep,
                                     unsigned long ulConfig);
extern long ADCSequenceOverflow(unsigned long ulBase,
                                unsigned long ulSequenceNum);
extern long ADCSequenceUnderflow(unsigned long ulBase,
                                 unsigned long ulSequenceNum);
extern long ADCSequenceDataGet(unsigned long ulBase,
                               unsigned long ulSequenceNum,
                               unsigned long *pulBuffer);
extern void ADCProcessorTrigger(unsigned long ulBase,
                                unsigned long ulSequenceNum);
extern void ADCSoftwareOversampleConfigure(unsigned long ulBase,
                                           unsigned long ulSequenceNum,
                                           unsigned long ulFactor);
extern void ADCSoftwareOversampleStepConfigure(unsigned long ulBase,
                                               unsigned long ulSequenceNum,
                                               unsigned long ulStep,
                                               unsigned long ulConfig);
extern void ADCSoftwareOversampleDataGet(unsigned long ulBase,
                                         unsigned long ulSequenceNum,
                                         unsigned long *pulBuffer,
                                         unsigned long ulCount);

#ifdef __cplusplus
}
#endif

#endif // __ADC_H__


text:
export declare function patchSetClearFunction(window: any, Zone: any, fnNames: any): void;
export declare function patchFunction(obj: any, fnNames: any): void;


text:
var baseIteratee = require('./_baseIteratee'),
    baseUniq = require('./_baseUniq');

/**
 * This method is like `_.uniq` except that it accepts `iteratee` which is
 * invoked for each element in `array` to generate the criterion by which
 * uniqueness is computed. The iteratee is invoked with one argument: (value).
 *
 * @static
 * @memberOf _
 * @since 4.0.0
 * @category Array
 * @param {Array} array The array to inspect.
 * @param {Array|Function|Object|string} [iteratee=_.identity]
 *  The iteratee invoked per element.
 * @returns {Array} Returns the new duplicate free array.
 * @example
 *
 * _.uniqBy([2.1, 1.2, 2.3], Math.floor);
 * // => [2.1, 1.2]
 *
 * // The `_.property` iteratee shorthand.
 * _.uniqBy([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
 * // => [{ 'x': 1 }, { 'x': 2 }]
 */
function uniqBy(array, iteratee) {
  return (array && array.length)
    ? baseUniq(array, baseIteratee(iteratee))
    : [];
}

module.exports = uniqBy;


text:
import chai from 'chai';
import OrderApi from '../../app/sources/orderApi.js';
import chaiPromises from 'chai-as-promised';
import chaiProperties from 'chai-properties';
import chaiThings from 'chai-things';

chai.should();
//chai.config.truncateThreshold = 0;
chai.use(chaiProperties);
chai.use(chaiThings);
chai.use(chaiPromises);

describe('Order and Flight HTTP Source', () => {

  let order = { orderName: 'what a great order name' },
      flight = { flightName: 'what a great flight name' };

  it("should create a new order with an ID",
    (done) => OrderApi.createOrder(order).should.eventually
      .include.a.thing.with.property('id')
      .and.notify(done));

  it("should create a new order with the correct order name",
    (done) => OrderApi.createOrder(order).should.eventually
      .include.a.thing.with.property('orderName', order.orderName)
      .and.notify(done));

  it("should create a new flight with an associated order",
    (done) => OrderApi.createFlight(flight, 1).should.eventually
      .all.have.properties(flight).and
      .all.have.property('id').and
      .notify(done));

  it("should retreive a list of flights",
    (done) => OrderApi.getAllFlights().should.eventually
      .all.have.property('id').and
      .notify(done));

  it("should retreive a list of orders",
    (done) => OrderApi.getAllOrders().should.eventually
      .all.have.property('id').and
      .notify(done));

  it("should retreive a single order by id",
    (done) => OrderApi.getOrder(1).should.eventually
      .have.length(1).and
      .all.have.property('id', 1)
      .and.notify(done));

});


text:
default['xml']['compiletime'] = false

case node['platform_family']
when 'rhel', 'fedora', 'suse'
  default['xml']['packages'] = %w(libxml2-devel libxslt-devel)
when 'debian'
  default['xml']['packages'] = %w(libxml2-dev libxslt-dev zlib1g-dev)
when 'freebsd', 'arch'
  default['xml']['packages'] = %w(libxml2 libxslt)
when 'mac_os_x'
  default['xml']['packages'] = %w(libxml2)
else
  default['xml']['packages'] = []
end

default['xml']['nokogiri']['use_system_libraries'] = false

# Newest versions will not compile with system libraries
# https://github.com/sparklemotion/nokogiri/issues/1099
default['xml']['nokogiri']['version'] = '1.6.2.1'


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package sjl.mlbapp.gui.util;

import java.awt.Color;

/**
 *
 * @author samlevin
 */
public abstract class ColorFactory {

    public static final Color BACKGROUND = new Color(30,60,90);
    public static final Color FOREGROUND = new Color(90,120,150);
    public static final Color HIGHLIGHT = new Color(120,150,180);
    public static final Color TEXT_COLOR = Color.WHITE;

}


text:
namespace CoinNews.Administration.Pages
{
    using Serenity.Web;
    using System.Web.Mvc;

    [RoutePrefix("Administration/Role"), Route("{action=index}")]
    [PageAuthorize(typeof(Entities.RoleRow))]
    public class RoleController : Controller
    {
        public ActionResult Index()
        {
            return View(MVC.Views.Administration.Role.RoleIndex);
        }
    }
}


text:
using System;

namespace PageFeedback.Service.NhSessionFactory
{
    public interface ICreateDate
    {
        DateTime CreateDate { get; set; }
    }
}


text:
namespace search_provider_logos {
namespace features {

const base::Feature kDoodleLogging{"DoodleLogging",
                                   base::FEATURE_ENABLED_BY_DEFAULT};

}  // namespace features
}  // namespace search_provider_logos


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.albumbrazil"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-permission android:name="android.permission.INTERNET" >
    </uses-permission>

    <uses-sdk
        android:minSdkVersion="11"
        android:targetSdkVersion="19" />

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/CustomActionBarTheme" >
        <activity
            android:name="com.example.albumbrazil.MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait" >
        </activity>
        <activity android:name="com.example.albumbrazil.AlbumFullImagePagerFragment" >
        </activity>
        <activity
            android:name="com.example.albumbrazil.SplashScreen"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:screenOrientation="portrait"
            android:label="@string/app_name"
            android:theme="@style/FullscreenTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="org.achartengine.GraphicalActivity" />
    </application>
</manifest>


text:
package controllers.business

import config.{AuthClientConnector, BaseControllerComponents, FrontendAppConfig}
import controllers.BaseController
import forms.LandAndPropertyForm
import play.api.mvc.{Action, AnyContent}
import services.BusinessService.LandAndPropertyAnswer
import services.{BusinessService, SessionProfile, SessionService}
import views.html.sicandcompliance.LandAndProperty

import javax.inject.{Inject, Singleton}
import scala.concurrent.{ExecutionContext, Future}

@Singleton
class LandAndPropertyController @Inject()(val sessionService: SessionService,
                                          val authConnector: AuthClientConnector,
                                          businessService: BusinessService,
                                          view: LandAndProperty)
                                         (implicit appConfig: FrontendAppConfig,
                                          val executionContext: ExecutionContext,
                                          baseControllerComponents: BaseControllerComponents)
  extends BaseController with SessionProfile {

  val show: Action[AnyContent] = isAuthenticatedWithProfile {
    implicit request =>
      implicit profile =>
        businessService.getBusiness.map {
          _.hasLandAndProperty match {
            case Some(answer) => Ok(view(LandAndPropertyForm.form.fill(answer)))
            case None => Ok(view(LandAndPropertyForm.form))
          }
        }
  }

  val submit: Action[AnyContent] = isAuthenticatedWithProfile {
    implicit request =>
      implicit profile =>
        LandAndPropertyForm.form.bindFromRequest.fold(
          errors => Future.successful(BadRequest(view(errors))),
          success => businessService.updateBusiness(LandAndPropertyAnswer(success)).map { _ =>
            Redirect(routes.BusinessActivityDescriptionController.show)
          }
        )
  }
}


text:
module Mongo
  class Error

    # Raised when a socket has an error.
    #
    # @since 2.0.0
    class SocketError < Error; end
  end
end


text:
package org.web3j.abi.datatypes.generated;

import java.math.BigInteger;

import org.web3j.abi.datatypes.Fixed;

/**
 *
Auto generated code.

 * Do not modifiy!

 * Please use {@link org.web3j.codegen.AbiTypesGenerator} to update.

 */
public class Fixed24x200 extends Fixed {
    public static final Fixed24x200 DEFAULT = new Fixed24x200(BigInteger.ZERO);

    public Fixed24x200(BigInteger value) {
        super(24, 200, value);
    }

    public Fixed24x200(int mBitSize, int nBitSize, BigInteger m, BigInteger n) {
        super(24, 200, m, n);
    }
}


text:
require 'em-ftpd'
require File.dirname(__FILE__) + "/examples/driver.rb"

AWS_KEY    = 'place your aws key here'
AWS_SECRET = 'place your aws secrete key here'
AWS_BUCKET = 'place your aws bucket name here'

driver      Driver
driver_args AWS_KEY, AWS_SECRET, AWS_BUCKET


text:
<?php
namespace Concrete\Core\Entity\Page;

use Concrete\Core\Entity\PackageTrait;
use Doctrine\ORM\Mapping as ORM;
use HtmlObject\Image;

/**
 * @ORM\Entity
 * @ORM\Table(
 *     name="PageContainers"
 * )
 */
class Container
{
    use PackageTrait;

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue
     */
    protected $containerID;

    /**
     * @ORM\Column(type="string")
     */
    protected $containerHandle = '';

    /**
     * @ORM\Column(type="string")
     */
    protected $containerIcon = '';

    /**
     * @ORM\Column(type="string")
     */
    protected $containerName = '';

    public function getContainerID(): ?int
    {
        return $this->containerID;
    }

    public function getContainerHandle(): string
    {
        return $this->containerHandle;
    }

    /**
     * @return $this
     */
    public function setContainerHandle(string $containerHandle): self
    {
        $this->containerHandle = $containerHandle;

        return $this;
    }

    public function getContainerName(): string
    {
        return $this->containerName;
    }

    public function getContainerDisplayName(): string
    {
        return tc('PageContainerName', $this->getContainerName());
    }

    /**
     * @return $this
     */
    public function setContainerName(string $containerName): self
    {
        $this->containerName = $containerName;

        return $this;
    }

    public function getContainerIcon(): string
    {
        return $this->containerIcon;
    }

    /**
     * @return $this
     */
    public function setContainerIcon(string $containerIcon): self
    {
        $this->containerIcon = $containerIcon;

        return $this;
    }

    /**
     * @return \HtmlObject\Image|string|null
     */
    public function getContainerIconImage(bool $asTag = true)
    {
        if ($this->getContainerIcon()) {
            $image = ASSETS_URL_IMAGES . '/icons/containers/' . $this->getContainerIcon();
            if ($asTag) {
                $image = new Image($image);
            }
            return $image;
        }
    }

    public function export(\SimpleXMLElement $node): void
    {
        $container = $node->addChild('container');
        $container->addAttribute('handle', $this->getContainerHandle());
        $container->addAttribute('name', h($this->getContainerName()));
        $container->addAttribute('icon', $this->getContainerIcon());
        $container->addAttribute('package', $this->getPackageHandle());
    }
}


text:
/* Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.camunda.bpm.engine.impl.runtime;

import java.util.Map;

import org.camunda.bpm.engine.impl.MessageCorrelationBuilderImpl;

public class CorrelationSet {

  protected final String businessKey;
  protected final Map<String, Object> correlationKeys;
  protected final Map<String, Object> localCorrelationKeys;
  protected final String processInstanceId;
  protected final String processDefinitionId;
  protected final String tenantId;
  protected final boolean isTenantIdSet;

  public CorrelationSet(MessageCorrelationBuilderImpl builder) {
    this.businessKey = builder.getBusinessKey();
    this.processInstanceId = builder.getProcessInstanceId();
    this.correlationKeys = builder.getCorrelationProcessInstanceVariables();
    this.localCorrelationKeys = builder.getCorrelationLocalVariables();
    this.processDefinitionId = builder.getProcessDefinitionId();
    this.tenantId = builder.getTenantId();
    this.isTenantIdSet = builder.isTenantIdSet();
  }

  public String getBusinessKey() {
    return businessKey;
  }

  public Map<String, Object> getCorrelationKeys() {
    return correlationKeys;
  }

  public Map<String, Object> getLocalCorrelationKeys() {
    return localCorrelationKeys;
  }

  public String getProcessInstanceId() {
    return processInstanceId;
  }

  public String getProcessDefinitionId() {
    return processDefinitionId;
  }

  public String getTenantId() {
    return tenantId;
  }

  public boolean isTenantIdSet() {
    return isTenantIdSet;
  }

  @Override
  public String toString() {
    return "CorrelationSet [businessKey=" + businessKey + ", processInstanceId=" + processInstanceId + ", processDefinitionId=" + processDefinitionId
        + ", correlationKeys=" + correlationKeys + ", localCorrelationKeys=" + localCorrelationKeys + ", tenantId=" + tenantId + ", isTenantIdSet=" + isTenantIdSet + "]";
  }

}


text:
# Conference.From Property

The phone number that will host the conference.

**Namespace:** Bandwidth.Net.Xml.Verbs
**Assembly:** Bandwidth.Net (in Bandwidth.Net.dll) Version: 3.0.3

## Syntax

**C#**

``` C#
public string From { get; set; }
```

#### Property Value
Type: String

## See Also

#### Reference
Conference Class
Bandwidth.Net.Xml.Verbs Namespace


text:
package org.foxbpm.engine.impl.identity;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.foxbpm.engine.identity.UserDefinition;
import org.foxbpm.engine.impl.Context;
import org.foxbpm.engine.impl.db.ListQueryParameterObject;
import org.foxbpm.engine.impl.entity.UserEntity;

public class UserDefinitionImpl implements UserDefinition {
	public UserEntity findUserById(String userId) {
		return (UserEntity) Context.getCommandContext().getSqlSession().selectOne("selectUserById", userId);
	}

	@SuppressWarnings("unchecked")

	public List<UserEntity> findUsers(String idLike, String nameLike) {
		Map<String, Object> map = new HashMap<String, Object>();
		if (idLike != null) {
			map.put("userId", idLike);
		}
		if (nameLike != null) {
			map.put("userName", nameLike);
		}
		return (List<UserEntity>) Context.getCommandContext().getSqlSession().selectList("selectUsers", map);
	}

	@SuppressWarnings("unchecked")

	public List<UserEntity> findUsers(String idLike, String nameLike, int pageIndex, int pageSize) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		if (idLike != null) {
			queryMap.put("userId", idLike);
		}
		if (nameLike != null) {
			queryMap.put("userName", nameLike);
		}
		int firstResult = pageIndex * pageSize - pageSize;
		int maxResults = pageSize;
		ListQueryParameterObject queryParams = new ListQueryParameterObject(queryMap, firstResult, maxResults);
		return (List<UserEntity>) Context.getCommandContext().getSqlSession().selectList("selectUsersByPage", queryParams);
	}

	public Long findUserCount(String idLike, String nameLike) {
		Map<String, Object> queryMap = new HashMap<String, Object>();
		if (idLike != null) {
			queryMap.put("userId", idLike);
		}
		if (nameLike != null) {
			queryMap.put("userName", nameLike);
		}
		return (Long) Context.getCommandContext().getSqlSession().selectOne("selectUsersCount", queryMap);
	}

	public void updateUser(UserEntity user) {
		Context.getCommandContext().getSqlSession().update("updateUser", user);
	}

	public void addUser(UserEntity user) {
		Context.getCommandContext().getSqlSession().insert("insertUser", user);
	}

	public void deleteUser(String userId) {
		Context.getCommandContext().getSqlSession().delete("insertUser", userId);
	}
}


text:
'use strict';

/**
 * @ngdoc function
 * @name dhcomApp.controller:ResumeCtrl
 * @description
 * # ResumeCtrl
 * Controller of the dhcomApp
 */
angular.module('dhcomApp')
  .controller('ResumeCtrl', function ($scope) {
    $scope.resumeThings = [
    ];
  });


text:
package com.coolweather.adnroid.gson;

import com.google.gson.annotations.SerializedName;

/**
 * Created by wu on 2017/4/14.
 */
public class AQI {

    public City city;
    public class City {
        public String aqi;
        public String pm25;
    }
}


text:
const CHAR_CODE_A = 97;
const CHAR_CODE_0 = 48;

function intToHex(num: number) {
	if (num < 10) return String.fromCharCode(CHAR_CODE_0 + num);
	else return String.fromCharCode(CHAR_CODE_A + (num - 10));
}

export function Uint8ArrayToHexString(buffer: Uint8Array) {
	let str = '';
	// hex conversion - 2 chars per 8 bit component
	for (let i = 0; i < buffer.length; i++) {
		const num = buffer[i];
		// big endian conversion, but whatever
		str += intToHex(num >> 4);
		str += intToHex(num & 0xf);
	}
	return str;
}

export function Uint8ArrayXor(to: Uint8Array, from: Uint8Array) {
	for (let i = 0; i < to.length; i++) to[i] = to[i] ^ from[i];
	return to;
}

export function randomUint8Array(len: number) {
	const buffer = new Uint8Array(len);
	for (let i = 0; i < buffer.length; i++) buffer[i] = Math.random() * (2 << 8);
	return buffer;
}

export function Uint8ArrayEqual(bufferA: Uint8Array, bufferB: Uint8Array) {
	for (let i = 0; i < bufferA.length; i++) {
		if (bufferA[i] !== bufferB[i]) return false;
	}
	return true;
}

export function randomHexString(len: number) {
	return Uint8ArrayToHexString(randomUint8Array(Math.floor(len / 2)));
}


text:
layout: collaborations-layout
title: Collaborations
bg-url: /img/background-collab.png
description:
permalink: /about/collaborations/
collaborations:
  -
    title: India Foundation for the Arts
    img: /img/collaborations/ifa_logo.png
    url: https://indiaifa.org/
    categories: team
    ide: ifa
  -
    title: Technology, Policy and Management, TU Delft
    img: /img/collaborations/TUDelft.png
    url: http://www.tbm.tudelft.nl/en/
    categories: team
    ide: tudelft
  -
    title: Netherlands eSciences Centre
    img: /img/collaborations/esciencecentre.png
    url: https://www.esciencecenter.nl/
    categories: team
    ide: escience
  -
    title: MediaLAB Amsterdam
    img: /img/collaborations/medialab.png
    url: http://medialabamsterdam.com/
    categories: team
    ide: medialab
  -
    title: KTH Royal Institute of Technology
    img: /img/collaborations/kth.png
    url: https://www.kth.se/en
    categories: team
    ide: kth
  -
    title: International Institute of Information Technology, Bangalore
    img: /img/collaborations/iiitb.png
    url: http://www.iiitb.ac.in/
    categories: team
    ide: iiit-b
  -
    title: Institute for Plasma Research
    img: /img/collaborations/ipr.png
    url: http://www.ipr.res.in/
    categories: team
    ide: ipr
  -
    title: Department of Computational Sciences, University of Amsterdam
    img: /img/collaborations/dcsa.png
    url: http://uva.computationalscience.nl/
    categories: team
    ide: dcsa
  -
    title: College of Engineering, Carnegie Mellon University
    img: /img/collaborations/cmu.png
    url: http://engineering.cmu.edu/
    categories: team
    ide: cmu
  -
    title: Netherlands Organisation for Scientific Research (NWO)
    img: /img/collaborations/nwo.png
    url: http://www.nwo.nl/en
    categories: team
    ide: nwo
  -
    title: Department of Science and Technology (DST)
    img: /img/collaborations/dst.png
    url: http://www.dst.gov.in/
    categories: team
    ide: dst
  -
    title: UNESCO Mahatma Gandhi Institute of Education for Peace and Sustainable Development (MGIEP)
    img: /img/collaborations/mgiep.png
    url: http://mgiep.unesco.org/
    categories: team
    ide: mgiep
  -
    title: United Nations Development Programme (UNDP) - Sri Lanka
    img: /img/collaborations/undp_srilanka.png
    url: http://www.lk.undp.org/
    categories: team
    ide: undp
  -
    title: Sahjeevan
    img: /img/collaborations/sahjeevan.png
    url: http://www.sahjeevan.org/
    categories: team
    ide: sahjeevan
  -
    title: Gender at work
    img: /img/collaborations/gatw.png
    url: http://www.genderatwork.org/
    categories: team
    ide: gatw
  -
    title: TARU Leading Edge
    img: /img/collaborations/taru.png
    url: http://taru.co.in/
    categories: team
    ide: taru
  -
    title: Directorate of Urban Land Transport (DULT)
    img: /img/collaborations/dult.png
    url: http://www.urbantransport.kar.gov.in/
    categories: team
    ide: dult
  -
    title: National Institute of Design (NID) - Bangalore
    img: /img/collaborations/nid.png
    url: http://www.nid.edu/institute/campuses/bengaluru.html
    categories: team
    ide: nid-b
  -
    title: Tata Institute of Social Sciences (TISS)
    img: /img/collaborations/tiss.png
    url: http://www.tiss.edu/
    categories: team
    ide: tiss
  -
    title: Centre for Budget and Policy Studies (CBPS)
    img: /img/collaborations/cbps.png
    url: http://cbps.in/
    categories: team
    ide: cbps
  -
    title: Navgurukul
    img: /img/collaborations/navgurukul.png
    url: http://navgurukul.org/
    categories: team
    ide: navgurukul
  -
    title: Cclub
    img: /img/collaborations/cclub.png
    url: http://www.cclub.io/
    categories: team
    ide: cclub
  -
    title: Sir Dorabji Tata Trust
    img: /img/collaborations/tata_trust.png
    url: http://www.tatatrusts.org/aboutus/index_SDTT/aboutusindex_sdtt
    categories: team
    ide: tatatrust
  -
    title: IIT Madras
    img: /img/collaborations/iit_madras.png
    url: https://www.iitm.ac.in
    categories: team
    ide: iitmadras
  -
    title: Okapi
    img: /img/collaborations/okapi.png
    url: http://okapia.co
    categories: team
    ide: okapi
  -
    title: Goethe Institut Max Muller Bhavan
    img: /img/collaborations/goetheinstitut.png
    url: https://www.goethe.de/ins/in/en/index.html
    categories: team
    ide: goetheinstitut
  -
    title: Sandbox Collective
    img: /img/collaborations/sandboxcollective.png
    url: http://sandboxcollective.org
    categories: team
    ide: sandboxcollective
  -
    title: Tamil Nadu State Land Use Board (SLUB)
    img: /img/collaborations/slub.png
    url: http://www.tn.gov.in/slub/
    categories: team
    ide: slub
---


text:
#pragma once

#include "canary.h"

namespace avr_halib
{
namespace canary
{
	namespace can_templates
	{
		/** \brief Transformator to deactivate interrupt usage **/
		template<typename userConfig>
		struct ConfigTransform_DisableInterrupts : public userConfig
		{
			enum
			{
				useReceiveInterrupt=false,
				useTransmitInterrupt=false,
				useErrorInterrupt=false
			};
		};
	}

	/** \brief An interrupt free CAN driver class for the AVR at90can128.

 *  \tparam Config A struct containing the configuration parameters for the CAN
 *  driver

 * This class provides the interface to use the CAN functionality of the
 * at90can128.  It uses no interrupts, therefor the user needs to call
 * checkEvents() everytime he wants to know if something happened. To save code
 * size the receive and transmit functionality can be (de)activated. If a
 * functionality is disabled, the public functions to use the functionality are
 * not existent. If a user tries to use them he will get a compile error,
 * telling him of his misconfiguration. The checkEvents() function will
 * automatically look up the correspondig message structure and update any
 * value that has changed. Normally every operation is one shot, therefore used
 * messages, that finished there operations can be used again for different
 * operations, the only exceptions are message that are in autoReply mode or in
 * cyclic receive mode.
 **/
	template<typename userConfig>
	class CanNoInt : public Canary<can_templates::ConfigTransform_DisableInterrupts<userConfig> >
	{};

/** \example canInNoInt.cpp This is an example Application, that demonstrates
 * the receiving of can messages.  It uses the interrupt free receive method of
 * the CanNoInt. To display the received message, the LCD driver of the
 * avr_halib is used.

 * The configuration for this example can be found at \link canConfigNoInt.h
 * \endlink.
 **/

/** \example canOutNoInt.cpp This is an example Application, that demonstrates
 * the periodic sending of can messages.  It uses the ExactEggTimer of the
 * avr-halib, for periodic sending of the messages.  To show the flash size of
 * the driver, no ouput besides the message will be generated.

 * The configuration for this example can be found at \link canConfigNoInt.h
 * \endlink.
 **/

}
}


text:
<?php

namespace Google\Service\DisplayVideo\Resource;

use Google\Service\DisplayVideo\BulkEditSitesRequest;
use Google\Service\DisplayVideo\BulkEditSitesResponse;
use Google\Service\DisplayVideo\DisplayvideoEmpty;
use Google\Service\DisplayVideo\ListSitesResponse;
use Google\Service\DisplayVideo\ReplaceSitesRequest;
use Google\Service\DisplayVideo\ReplaceSitesResponse;
use Google\Service\DisplayVideo\Site;

/**
 * The "sites" collection of methods.
 * Typical usage is:
 *  <code>
 *   $displayvideoService = new Google\Service\DisplayVideo(...);
 *   $sites = $displayvideoService->sites;
 *  </code>
 */
class AdvertisersChannelsSites extends \Google\Service\Resource
{
  /**
   * Bulk edits sites under a single channel. The operation will delete the sites
   * provided in BulkEditSitesRequest.deleted_sites and then create the sites
   * provided in BulkEditSitesRequest.created_sites. (sites.bulkEdit)
   *
   * @param string $advertiserId The ID of the advertiser that owns the parent
   * channel.
   * @param string $channelId Required. The ID of the parent channel to which the
   * sites belong.
   * @param BulkEditSitesRequest $postBody
   * @param array $optParams Optional parameters.
   * @return BulkEditSitesResponse
   */
  public function bulkEdit($advertiserId, $channelId, BulkEditSitesRequest $postBody, $optParams = [])
  {
    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'postBody' => $postBody];
    $params = array_merge($params, $optParams);
    return $this->call('bulkEdit', [$params], BulkEditSitesResponse::class);
  }
  /**
   * Creates a site in a channel. (sites.create)
   *
   * @param string $advertiserId The ID of the advertiser that owns the parent
   * channel.
   * @param string $channelId Required. The ID of the parent channel in which the
   * site will be created.
   * @param Site $postBody
   * @param array $optParams Optional parameters.
   *
   * @opt_param string partnerId The ID of the partner that owns the parent
   * channel.
   * @return Site
   */
  public function create($advertiserId, $channelId, Site $postBody, $optParams = [])
  {
    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'postBody' => $postBody];
    $params = array_merge($params, $optParams);
    return $this->call('create', [$params], Site::class);
  }
  /**
   * Deletes a site from a channel. (sites.delete)
   *
   * @param string $advertiserId The ID of the advertiser that owns the parent
   * channel.
   * @param string $channelId Required. The ID of the parent channel to which the
   * site belongs.
   * @param string $urlOrAppId Required. The URL or app ID of the site to delete.
   * @param array $optParams Optional parameters.
   *
   * @opt_param string partnerId The ID of the partner that owns the parent
   * channel.
   * @return DisplayvideoEmpty
   */
  public function delete($advertiserId, $channelId, $urlOrAppId, $optParams = [])
  {
    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'urlOrAppId' => $urlOrAppId];
    $params = array_merge($params, $optParams);
    return $this->call('delete', [$params], DisplayvideoEmpty::class);
  }
  /**
   * Lists sites in a channel. (sites.listAdvertisersChannelsSites)
   *
   * @param string $advertiserId The ID of the advertiser that owns the parent
   * channel.
   * @param string $channelId Required. The ID of the parent channel to which the
   * requested sites belong.
   * @param array $optParams Optional parameters.
   *
   * @opt_param string filter Allows filtering by site fields. Supported syntax: *
   * Filter expressions for site currently can only contain at most one *
   * restriction. * A restriction has the form of `{field} {operator} {value}`. *
   * The operator must be `CONTAINS (:)`. * Supported fields: - `urlOrAppId`
   * Examples: * All sites for which the URL or app ID contains "google":
   * `urlOrAppId : "google"`
   * @opt_param string orderBy Field by which to sort the list. Acceptable values
   * are: * `urlOrAppId` (default) The default sorting order is ascending. To
   * specify descending order for a field, a suffix " desc" should be added to the
   * field name. Example: `urlOrAppId desc`.
   * @opt_param int pageSize Requested page size. Must be between `1` and `10000`.
   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
   * if an invalid value is specified.
   * @opt_param string pageToken A token identifying a page of results the server
   * should return. Typically, this is the value of next_page_token returned from
   * the previous call to `ListSites` method. If not specified, the first page of
   * results will be returned.
   * @opt_param string partnerId The ID of the partner that owns the parent
   * channel.
   * @return ListSitesResponse
   */
  public function listAdvertisersChannelsSites($advertiserId, $channelId, $optParams = [])
  {
    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId];
    $params = array_merge($params, $optParams);
    return $this->call('list', [$params], ListSitesResponse::class);
  }
  /**
   * Replaces all of the sites under a single channel. The operation will replace
   * the sites under a channel with the sites provided in
   * ReplaceSitesRequest.new_sites. (sites.replace)
   *
   * @param string $advertiserId The ID of the advertiser that owns the parent
   * channel.
   * @param string $channelId Required. The ID of the parent channel whose sites
   * will be replaced.
   * @param ReplaceSitesRequest $postBody
   * @param array $optParams Optional parameters.
   * @return ReplaceSitesResponse
   */
  public function replace($advertiserId, $channelId, ReplaceSitesRequest $postBody, $optParams = [])
  {
    $params = ['advertiserId' => $advertiserId, 'channelId' => $channelId, 'postBody' => $postBody];
    $params = array_merge($params, $optParams);
    return $this->call('replace', [$params], ReplaceSitesResponse::class);
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(AdvertisersChannelsSites::class, 'Google_Service_DisplayVideo_Resource_AdvertisersChannelsSites');


text:
define(["../_base/declare", "./Moveable" /*=====, "./Mover" =====*/], function(declare, Moveable /*=====, Mover =====*/){
	// module:
	//		dojo/dnd/TimedMoveable

	/*=====
	var __TimedMoveableArgs = declare([Moveable.__MoveableArgs], {
		// timeout: Number
		//		delay move by this number of ms,
		//		accumulating position changes during the timeout
		timeout: 0
	});
	=====*/

	// precalculate long expressions
	var oldOnMove = Moveable.prototype.onMove;

	return declare("dojo.dnd.TimedMoveable", Moveable, {
		// summary:
		//		A specialized version of Moveable to support an FPS throttling.
		//		This class puts an upper restriction on FPS, which may reduce
		//		the CPU load. The additional parameter "timeout" regulates
		//		the delay before actually moving the moveable object.

		// object attributes (for markup)
		timeout: 40,	// in ms, 40ms corresponds to 25 fps

		constructor: function(node, params){
			// summary:
			//		an object that makes a node moveable with a timer
			// node: Node||String
			//		a node (or node's id) to be moved
			// params: __TimedMoveableArgs
			//		object with additional parameters.

			// sanitize parameters
			if(!params){ params = {}; }
			if(params.timeout && typeof params.timeout == "number" && params.timeout >= 0){
				this.timeout = params.timeout;
			}
		},

		onMoveStop: function(/*Mover*/ mover){
			if(mover._timer){
				// stop timer
				clearTimeout(mover._timer);
				// reflect the last received position
				oldOnMove.call(this, mover, mover._leftTop);
			}
			Moveable.prototype.onMoveStop.apply(this, arguments);
		},
		onMove: function(/*Mover*/ mover, /*Object*/ leftTop){
			mover._leftTop = leftTop;
			if(!mover._timer){
				var _t = this;	// to avoid using dojo.hitch()
				mover._timer = setTimeout(function(){
					// we don't have any pending requests
					mover._timer = null;
					// reflect the last received position
					oldOnMove.call(_t, mover, mover._leftTop);
				}, this.timeout);
			}
		}
	});
});


text:
package org.jboss.pnc.facade.providers;

import org.jboss.pnc.dto.response.Page;
import org.jboss.pnc.enums.RepositoryType;
import org.jboss.pnc.facade.validation.ConflictedEntryException;
import org.jboss.pnc.facade.validation.InvalidEntityException;
import org.jboss.pnc.model.TargetRepository;
import org.jboss.pnc.spi.datastore.repositories.TargetRepositoryRepository;
import org.jboss.pnc.spi.datastore.repositories.api.Predicate;
import org.jboss.pnc.spi.datastore.repositories.api.Repository;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.ArrayList;
import java.util.List;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

@RunWith(MockitoJUnitRunner.class)
public class TargetRepositoryProviderTest extends AbstractIntIdProviderTest<TargetRepository> {

    @Mock
    private TargetRepositoryRepository repository;

    @InjectMocks
    private TargetRepositoryProviderImpl provider;

    private TargetRepository targetRepositoryMock = prepareNewTargetRepository("mock1");
    private TargetRepository targetRepositoryMockSecond = prepareNewTargetRepository("mock2");

    @Override
    protected AbstractProvider provider() {
        return provider;
    }

    @Override
    protected Repository<TargetRepository, Integer> repository() {
        return repository;
    }

    @Before
    public void setup() {
        List<TargetRepository> targetRepositories = new ArrayList<>();

        targetRepositories.add(targetRepositoryMock);
        targetRepositories.add(targetRepositoryMockSecond);
        targetRepositories.add(prepareNewTargetRepository("pnc-targetRepository"));
        targetRepositories.add(prepareNewTargetRepository("targetRepository-zion"));
        targetRepositories.add(prepareNewTargetRepository("targetRepository-trinity"));

        fillRepository(targetRepositories);
    }

    @Test
    public void testStoreNewTargetRepositoryWithoutId() {

        org.jboss.pnc.dto.TargetRepository targetRepositoryDTO = org.jboss.pnc.dto.TargetRepository.refBuilder()
                .identifier("indy-mvn")
                .repositoryPath("/path/to/maven/repo")
                .repositoryType(RepositoryType.MAVEN)
                .temporaryRepo(false)
                .build();

        org.jboss.pnc.dto.TargetRepository targetRepositoryDTOSaved = provider.store(targetRepositoryDTO);

        // then
        assertThat(targetRepositoryDTOSaved.getId()).isNotNull().isNotBlank();
        // check if DTO pre-save is the same as DTO post-save
        assertThat(targetRepositoryDTOSaved.getIdentifier()).isEqualTo(targetRepositoryDTO.getIdentifier());
        assertThat(targetRepositoryDTOSaved.getRepositoryPath()).isEqualTo(targetRepositoryDTO.getRepositoryPath());
        assertThat(targetRepositoryDTOSaved.getRepositoryType()).isEqualTo(targetRepositoryDTO.getRepositoryType());
    }

    @Test
    public void testStoreNewTargetRepositoryWithIdShouldFail() {

        org.jboss.pnc.dto.TargetRepository targetRepositoryDTO = org.jboss.pnc.dto.TargetRepository.refBuilder()
                .id(Integer.toString(entityId.getAndIncrement()))
                .identifier("indy-mvn")
                .repositoryPath("/path/to/naughty/repo")
                .repositoryType(RepositoryType.MAVEN)
                .temporaryRepo(false)
                .build();

        // then: can't store new targetRepository with id already set
        assertThatThrownBy(() -> provider.store(targetRepositoryDTO)).isInstanceOf(InvalidEntityException.class);
    }

    @Test
    public void testStoreTargetRepositoryWithExistingIdentifierAndPathShouldFail() {

        // Prepare
        // return entity of targetRepository with same name as dto
        when(repository.queryByPredicates(any(Predicate.class))).thenAnswer(env -> targetRepositoryMock);

        // when
        org.jboss.pnc.dto.TargetRepository targetRepositoryDTO = org.jboss.pnc.dto.TargetRepository.refBuilder()
                .identifier(targetRepositoryMock.getIdentifier())
                .repositoryPath(targetRepositoryMock.getRepositoryPath())
                .repositoryType(RepositoryType.NPM)
                .temporaryRepo(true)
                .build();

        // then
        assertThatThrownBy(() -> provider.store(targetRepositoryDTO)).isInstanceOf(ConflictedEntryException.class);
    }

    @Test
    public void testUpdate() {

        // Prepare
        String newPath = targetRepositoryMock.getRepositoryPath() + "/updated";

        org.jboss.pnc.dto.TargetRepository targetRepositoryUpdate = org.jboss.pnc.dto.TargetRepository.refBuilder()
                .id(targetRepositoryMock.getId().toString())
                .identifier(targetRepositoryMock.getIdentifier())
                .repositoryPath(newPath)
                .repositoryType(targetRepositoryMock.getRepositoryType())
                .temporaryRepo(targetRepositoryMock.getTemporaryRepo())
                .build();

        assertThatThrownBy(() -> provider.update(targetRepositoryMock.getId().toString(), targetRepositoryUpdate))
                .isInstanceOf(UnsupportedOperationException.class);
    }

    @Test
    public void testGetAll() {

        // when
        Page<org.jboss.pnc.dto.TargetRepository> all = provider.getAll(0, 10, null, null);

        // then
        assertThat(all.getContent()).hasSize(5);
    }

    @Test
    public void testGetSpecific() {

        // when
        org.jboss.pnc.dto.TargetRepository targetRepository = provider
                .getSpecific(targetRepositoryMock.getId().toString());

        // then
        assertThat(targetRepository.getId()).isEqualTo(targetRepositoryMock.getId().toString());
        assertThat(targetRepository.getIdentifier()).isEqualTo(targetRepositoryMock.getIdentifier());
        assertThat(targetRepository.getRepositoryPath()).isEqualTo(targetRepositoryMock.getRepositoryPath());
        assertThat(targetRepository.getRepositoryType()).isEqualTo(targetRepositoryMock.getRepositoryType());
    }

    @Test
    public void testDeleteShouldFail() {

        assertThatThrownBy(() -> provider.delete(targetRepositoryMock.getId().toString()))
                .isInstanceOf(UnsupportedOperationException.class);
    }

    private TargetRepository prepareNewTargetRepository(String name) {
        return TargetRepository.newBuilder()
                .id(entityId.getAndIncrement())
                .identifier("indy-mvn")
                .repositoryPath("/path/to/" + name + "/repo")
                .repositoryType(RepositoryType.MAVEN)
                .temporaryRepo(false)
                .build();
    }

}